Skip to content

AVX2: Improve SIMD portability by replacing non‑portable indexing and casts#1475

Open
StormBytePP wants to merge 3 commits intoNetflix:masterfrom
StormBytePP:avx_portability
Open

AVX2: Improve SIMD portability by replacing non‑portable indexing and casts#1475
StormBytePP wants to merge 3 commits intoNetflix:masterfrom
StormBytePP:avx_portability

Conversation

@StormBytePP
Copy link
Contributor

@StormBytePP StormBytePP commented Mar 25, 2026

This PR improves the portability of the AVX2 implementation by removing two GCC/Clang‑specific behaviors that are not supported by other compilers:

  1. 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.

  2. 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.

StormBytePP added a commit to StormBytePP/vmaf that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant