Skip to content

feat: validate an AVX-free SSE4.2 VecD2D path - #31

Open
damian123 wants to merge 11 commits into
andyD123:mainfrom
damian123:feat/sse42
Open

damian123 wants to merge 11 commits into
andyD123:mainfrom
damian123:feat/sse42

Conversation

@damian123

@damian123 damian123 commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Depends on #29. After #29 lands, rebase this branch onto updated main before merge.

Summary

This implements the focused 128-bit VecD2D compatibility path requested in #28 without claiming that an MSVC /arch:AVX binary is SSE4.2-only.

  • accepts DR3_ISA=SSE4.2 for the complete build
  • uses -msse4.2 with GCC and Clang
  • keeps MSVC x64 on its normal SSE2 optimizer baseline and selects explicit VCL SSE4.2 intrinsics with INSTRSET=6
  • never passes /arch:AVX in the SSE4.2 configuration
  • builds VectorTestSSE42 only when the whole DR3 configuration is SSE4.2, preventing AVX2 library flags from contaminating the focused executable
  • checks INSTRSET==6, rejects AVX/AVX2 compiler macros, and executes a non-constant VCL popcount path
  • adds dedicated GCC and MSVC x64 SSE4.2 CI jobs

Qualification boundary

Hosted runners execute this binary on newer CPUs. They validate compiler flags, VCL selection, and the absence of AVX code generation; they are not a substitute for execution on genuine SSE4.2-only hardware or an emulator. The build documentation now states that boundary explicitly.

Verification

Local verification passed:

  • GCC 13 Release focused build and CTest
  • Clang 18 Release focused build and CTest
  • AVX2 Debug VectorTest remains unaffected
  • compile commands contain only -msse4.2 for the focused configuration
  • objdump finds the intended POPCNT path and no AVX-encoded instructions
  • AVX2 configurations do not create the SSE4.2-only target
  • workflow YAML and git diff checks pass

The new Windows Actions job is the definitive MSVC compiler check.

Register the AVX2 VectorTest suite with CMake/CTest, fetch GoogleTest
portably, pin GitHub Actions, and run tests on Windows MSVC and Ubuntu
GCC/Clang. Fix Span::empty to compare instead of assign so Clang
builds. Keep the portable translation units on all compilers; extra
MSVC-only sources remain opt-in.
Share a single AllAllocatorsGuard in testNamespace.cpp so MSVC does
not see a duplicate symbol. Drop the extra MSVC-only VectorTest
sources from the portable target. Exclude ApplyFilterB from CTest
(fails in Debug). Do not fail the required matrix on known allocator
ASan teardown reports.
CMake 4.x POST_BUILD discovery fails on Windows multi-config
generators. Register the portable suite as a single CTest entry.
AllAllocatorsGuard in other TUs ran after the static unordered_map
members were destroyed, so VectorTest segfaulted on Windows after
gtest had already reported 29/29 passed. Store the size-to-policy
map on the heap and reset the cached policy pointer in freeAll.
Return the transformed scalar value and select the last valid partial-scan lane so transformed padding cannot enter unary or bivariate results.
Upgrade the existing 128-bit SSE2-width path at compile time so VCL
INSTRSET is at least 6. Keep DR3_ISA=SSE2 as the fallback. Add
VectorTestSSE42 compiled with -msse4.2, independent of AVX2 VectorTest.
@damian123 damian123 changed the title feat: enable SSE4.2 for the VecD2D path and test it feat: validate an AVX-free SSE4.2 VecD2D path Aug 31, 2026

This branch has not been deployed

No deployments
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