Merged
Conversation
4 tasks
ea0432e to
f7d349b
Compare
asmorkalov
requested changes
Jun 8, 2023
| float16_t* weightsWinoBufPtr_FP16; | ||
| #endif | ||
|
|
||
| Ptr<WinoParams> winoParams = makePtr<WinoParams>(); |
Contributor
There was a problem hiding this comment.
Ptr to structure with constants is overkill for me. I propose do the following:
- remain const int for NEON and other non-Intel platforms.
- for x86 branch use something like
static const int CONV_WINO_IBLOCK = (checkHardwareSupport(CPU_AVX) || checkHardwareSupport(CPU_AVX2)) 6 : 3;
It means that: - no code changes in compute part
- no performance side effects for others
- single instance of constant values, but not copy for each layer
Also useAVX, useAVX2 and others may be static const too.
Member
Author
There was a problem hiding this comment.
Got it, will update the patch today later.
Contributor
|
The solution passes all tests on old hardware, thanks! |
f7d349b to
9469f39
Compare
9469f39 to
fc0557f
Compare
asmorkalov
reviewed
Jun 8, 2023
asmorkalov
reviewed
Jun 8, 2023
| float* outptr, int Cg, const int winoIblock, const int winoAtomF32) | ||
| { | ||
| CV_Assert(CONV_WINO_IBLOCK == 3 && CONV_WINO_KBLOCK == 4 && CONV_WINO_ATOM_F32 == 4); | ||
| CV_Assert(winoIblock == 3 && winoAtomF32 == 4); |
Contributor
There was a problem hiding this comment.
Why do you need function parameters, if they always should have the same value? They should be local constants like const int winoIblock = 3;
Member
Author
There was a problem hiding this comment.
What I want to do is to align the API.
#if CV_TRY_AVX2
if (conv->useAVX2)
opt_AVX2::winofunc_accum_f32(inwptr, wptr, out_wbuf, Cg, block_id1 - block_id0, CONV_WINO_IBLOCK,
CONV_WINO_KBLOCK, CONV_WINO_ATOM_F32, CONV_WINO_NATOMS_F32);
else
#endif
#if CV_TRY_AVX
if (conv->useAVX)
opt_AVX::winofunc_accum_f32(inwptr, wptr, out_wbuf, Cg, block_id1 - block_id0, CONV_WINO_IBLOCK,
CONV_WINO_KBLOCK, CONV_WINO_ATOM_F32, CONV_WINO_NATOMS_F32);
else
#endif
#if CV_NEON && CV_NEON_AARCH64
if (conv->useNEON)
opt_NEON::winofunc_accum_f32(inwptr, wptr, out_wbuf, Cg, block_id1 - block_id0, CONV_WINO_IBLOCK,
CONV_WINO_KBLOCK, CONV_WINO_ATOM_F32, CONV_WINO_NATOMS_F32);
else
#endif
winofunc_accum_f32(inwptr, wptr, out_wbuf, Cg, block_id1 - block_id0, CONV_WINO_IBLOCK,
CONV_WINO_KBLOCK, CONV_WINO_ATOM_F32, CONV_WINO_NATOMS_F32);
For SIMD implementation, the parameters is the same, but for other dispatch, it may be different.
asmorkalov
approved these changes
Jun 9, 2023
Contributor
asmorkalov
left a comment
There was a problem hiding this comment.
👍 Thanks a lot for the patch!
Merged
thewoz
pushed a commit
to thewoz/opencv
that referenced
this pull request
Jan 4, 2024
DNN: fix bug for X86 Winograd opencv#23763 Address opencv#23760 The patch aims to add a runtime check for X86 platform without AVX(2). ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
thewoz
pushed a commit
to thewoz/opencv
that referenced
this pull request
May 29, 2024
DNN: fix bug for X86 Winograd opencv#23763 Address opencv#23760 The patch aims to add a runtime check for X86 platform without AVX(2). ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Address #23760
The patch aims to add a runtime check for X86 platform without AVX(2).
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.