use combine_x for sse/avx vector combination#6113
Merged
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6113 +/- ##
==========================================
- Coverage 95.59% 95.59% -0.01%
==========================================
Files 829 829
Lines 270462 270452 -10
==========================================
- Hits 258556 258546 -10
Misses 11906 11906 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The binary size change of libncnn.so (bytes)
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR consolidates manual AVX/SSE insert intrinsics into unified combine* helper functions for cleaner vector concatenation.
- Introduced
#if __AVX2__fallback incombine4x2_epi32and added new combine helpers. - Replaced direct
_mm*_insert*calls withcombine4x2_ps,combine4x2_epi32,combine8x2_ps, andcombine4x4_psacross x86 layer implementations. - Added
#include "x86_usability.h"where helper functions are used.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/layer/x86/x86_usability.h | Added AVX2 guard to combine4x2_epi32 with fallback. |
| src/layer/x86/unaryop_x86.cpp | Replaced _mm512_insertf32x8 with combine8x2_ps. |
| src/layer/x86/shufflechannel_x86.cpp | Added include and used combine4x2_ps. |
| src/layer/x86/scale_x86.cpp | Replaced multiple insert intrinsics with combine helpers. |
| src/layer/x86/rmsnorm_x86.cpp | Swapped insert calls for combine4x2_ps/combine8x2_ps. |
| src/layer/x86/prelu_x86.cpp | Used combine helpers in slope loading. |
| src/layer/x86/lstm_int8.h | Replaced integer insert with combine4x2_epi32. |
| src/layer/x86/layernorm_x86.cpp | Replaced insert calls with combine helpers. |
| src/layer/x86/innerproduct_gemm_fp.h | Replaced _mm256_insertf128_ps/_mm512_insertf32x8 with combine. |
| src/layer/x86/innerproduct_fp.h | Swapped out insert intrinsics for combine calls. |
| src/layer/x86/groupnorm_x86.cpp | Used combine helpers for mean/var broadcasts. |
| src/layer/x86/gemm_x86.cpp | Replaced insert intrinsics in transpose-pack with combine. |
| src/layer/x86/convolution_packed_int8.h | Replaced integer insert calls with combine4x2_epi32. |
| src/layer/x86/convolution_packed.h | Used combine* helpers instead of nested insert intrinsics. |
| src/layer/x86/convolution_3x3_winograd_int8.h | Swapped _mm512_inserti32x8 with combine8x2_epi32. |
| src/layer/x86/convolution_3x3_winograd.h | Replaced insert intrinsics in Winograd transforms. |
| src/layer/x86/convolution1d_packed.h | Updated insert intrinsics to combine helpers. |
| src/layer/x86/binaryop_x86.cpp | Replaced broadcast insert calls with combine helpers. |
| src/layer/x86/batchnorm_x86.cpp | Used combine* helpers for parameter loading. |
Comments suppressed due to low confidence (1)
src/layer/x86/x86_usability.h:888
- The fallback branch for
combine4x2_epi32uses_mm256_insertf128_si256, which appears to be the float-version intrinsic. It should use the integer insert intrinsic_mm256_inserti128_si256to correctly handle__m256ivectors.
return _mm256_insertf128_si256(_mm256_castsi128_si256(a), b, 1);
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.
No description provided.