ci: cover i386 and ClangCL for the AVX2-dispatch guard; drop dead _M_X64 - #144
filipecosta90 wants to merge 8 commits into
Conversation
The AVX2 runtime-dispatch guard in src/hdr_histogram.c is the subject of two recently merged fixes (#142 clang-cl, #143 i386), yet CI exercised neither configuration: the matrix excludes 32-bit Linux and never selects the ClangCL toolset. Add two regression jobs that build exactly those configurations, in both of which HDR_HAS_AVX2_DISPATCH must be compiled out: - build-linux-i386: 32-bit GCC (-m32, gcc-multilib), HDR_LOG_REQUIRED=DISABLED so no 32-bit zlib is needed; the core suites still run hdr_value_at_percentile. - build-windows-clangcl: the ClangCL VS toolset (-T ClangCL) on x64. Also simplify the guard: _M_X64 is dead once _MSC_VER is excluded (only the MSVC family defines _M_X64, and clang-cl uses _M_X64 rather than __x86_64__), so gate on __x86_64__ alone and document why 32-bit / MSVC-ABI / ICC are out. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…index type) The ClangCL CI job added in this PR surfaced a pre-existing clang-cl build break that PR #142 did not cover: _BitScanReverse{,64} take an 'unsigned long *' out-parameter, but the index was declared uint32_t. MSVC cl.exe tolerates this (same width), but clang-cl treats the pointer-type mismatch as a hard error (-Wincompatible-pointer-types is a default error in Clang 16+). Declare the index as 'unsigned long' to match the intrinsic; on Windows it is 32-bit, so behavior is unchanged. Fixes both the _WIN64 and 32-bit branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Second clang-cl-only break surfaced by the new ClangCL CI job: on the MSVC
atomic path, hdr_atomic_{load,store}_pointer are typed 'void**' functions, so
passing 'struct hdr_histogram**' is a hard error under clang-cl
(-Wincompatible-pointer-types, default error in Clang 16+). GCC/Clang use a
type-generic __atomic_* macro, so this never showed on Linux/macOS. Cast the
call-site arguments to (void**), matching the existing idiom in
test/hdr_atomic_test.c. void* and object pointers share representation
(C11 6.2.5p28), so behavior is unchanged on all platforms.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-bit Adversarial review of the guard comment found a factual error: clang-cl defines __x86_64__ AND __clang__ (alongside _MSC_VER), so it is the !defined(_MSC_VER) clause -- not the arch/compiler check -- that keeps clang-cl out of the AVX2 dispatch. Correct the comment so a future editor does not drop _MSC_VER and reintroduce the #142 break. Verified with clang --target=x86_64-pc-windows-msvc -dM -E. Also harden the i386 job: assert the built test binary is 'ELF 32-bit' so the job fails loudly if -m32 is ever silently ignored (would otherwise be a false-positive regression test). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
149bddd to
e2d1506
Compare
|
🤖 Automated first-pass review — a human maintainer's review is still required before merge. The guard simplification checks out: Two things I'd tighten in the CI half:
One thing I can't verify from the diff: whether the i386 build actually links, specifically whether 64-bit |
The negative assert used 'cc -m32 ... | grep -q ... && { exit 1; } || true'.
The trailing '|| true' greens the step even if 'cc -m32' itself breaks (e.g.
missing multilib): grep sees empty input, doesn't match, and the step passes
— the same false-positive class the 'ELF 32-bit' check was added to close.
Write the preprocessor macros to a file first so a broken 'cc -m32' fails the
step under 'set -e', then assert with an explicit if-guard. (A '! grep'
one-liner would not work: a pipeline preceded by '!' is exempted from 'set -e',
so a match would not fail the step.) Now fails on both a broken command and a
regressed guard.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts: # .github/workflows/ci.yml
Follow-up to #142 (ClangCL) and #143 (i386), which both edited the AVX2 runtime-dispatch guard in
src/hdr_histogram.cbut were validated manually rather than in CI.Why
The CI matrix excludes 32-bit Linux and never selects the ClangCL toolset, so neither configuration the guard specifically handles was exercised. A future refactor of the guard could silently reintroduce either break.
What
Two regression jobs, in both of which
HDR_HAS_AVX2_DISPATCHmust be compiled out:build-linux-i386— 32-bit GCC (-m32,gcc-multilib),HDR_LOG_REQUIRED=DISABLEDso no 32-bit zlib is needed. The core suites still runhdr_value_at_percentile(the dispatched path). Guards against the Don't attempt AVX2 on i386 #143 break (_mm_extract_epi64is unavailable in 32-bit codegen).build-windows-clangcl— the ClangCL VS toolset (-T ClangCL) on x64. Guards against the Fix ClangCL build on Windows #142 break (clang-cl defines__clang__+_MSC_VERand previously failed to link__cpu_model).Also simplifies the guard:
_M_X64is a dead term once_MSC_VERis excluded (only the MSVC family defines_M_X64, and clang-cl uses_M_X64rather than__x86_64__), so it now gates on__x86_64__alone, with a comment documenting why 32-bit / MSVC-ABI / ICC are excluded.No functional change on the platforms that ship the AVX2 path (64-bit GCC/Clang on Linux/macOS): the fast path stays enabled there.
🤖 Generated with Claude Code