AVX2: Improve SIMD portability by replacing non‑portable indexing and casts#1475
Open
StormBytePP wants to merge 3 commits intoNetflix:masterfrom
Open
AVX2: Improve SIMD portability by replacing non‑portable indexing and casts#1475StormBytePP wants to merge 3 commits intoNetflix:masterfrom
StormBytePP wants to merge 3 commits intoNetflix:masterfrom
Conversation
StormBytePP
added a commit
to StormBytePP/vmaf
that referenced
this pull request
Mar 25, 2026
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.
This PR improves the portability of the AVX2 implementation by removing two GCC/Clang‑specific behaviors that are not supported by other compilers:
Non‑portable SIMD vector indexing
Direct indexing of
__m128i/__m256i(e.g.,v[i]) is a compiler extension and not part of the standard Intel intrinsic API.It has been replaced with
_mm_extract_epi64, which provides a portable and well‑defined way to access individual lanes.Non‑standard casts between SIMD types (
__m256→__m256i)Some compilers allow direct casting between float and integer vector types, but this is not universally supported.
These casts have been replaced with
_mm256_castps_si256, which performs a safe, zero‑cost bit reinterpretation and is supported across compilers.These changes do not alter the algorithm or performance characteristics.
They simply ensure that the AVX2 backend behaves consistently across different toolchains, improving portability and maintainability.