Skip to content

Add CPU feature detection tests with emulated CPU support - #10451

Merged
joseph-isaacs merged 7 commits into
developfrom
ji/determined-mccarthy-2qi5lf
Oct 13, 2026
Merged

joseph-isaacs merged 7 commits into
developfrom
ji/determined-mccarthy-2qi5lf

Conversation

@joseph-isaacs

@joseph-isaacs joseph-isaacs commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds a comprehensive CPU feature detection test suite that validates runtime-dispatched SIMD kernel tiers across different CPU architectures. It enables testing on emulated CPUs (via Intel SDE for x86_64 and QEMU for aarch64) to ensure every kernel tier is exercised regardless of the runner's native CPU capabilities.

Changes

New Test: vortex-buffer/tests/cpu_features.rs

Added a new test module that:

  • Detects CPU features at runtime for x86_64 (SSE2, BMI1/2, AVX, AVX2, AVX-512 variants) and aarch64 (NEON, SVE, SVE2)
  • Validates detected features against an expected set via the VORTEX_EXPECT_CPU_FEATURES environment variable
  • Supports both positive assertions (feature must be detected) and negative assertions (feature must not be detected) using ! prefix
  • Fails the test if the emulated/actual CPU does not expose exactly the expected feature set, preventing silent mismatches between emulator configuration and actual kernel testing

CI Workflow: rust-test-cpu-features Job

Added a new CI job that:

  • Tests on four emulated CPU configurations:
    • x86_64 Haswell (AVX2, BMI2, no AVX-512)
    • x86_64 Ice Lake (AVX2, BMI2, full AVX-512 support)
    • aarch64 Neoverse-N1 (NEON only, no SVE)
    • aarch64 Max (NEON, SVE, SVE2 with bitperm)
  • Uses Intel SDE for x86_64 emulation and QEMU user mode for aarch64
  • Sets VORTEX_EXPECT_CPU_FEATURES to validate each tier's feature set
  • Runs tests on vortex-buffer, vortex-mask, and vortex-array crates where SIMD kernels are implemented
  • Uses cargo test (not nextest) to minimize emulator startup overhead

Add a `rust-test-cpu-features` matrix job that runs the vortex-buffer,
vortex-mask and vortex-array tests (debug `ci` profile) under Intel SDE
(`-hsw` for AVX2, `-icx` for AVX-512) and QEMU user mode (`neoverse-n1`
for NEON, `max` for SVE2), so every runtime-dispatched kernel tier is
exercised regardless of the runner's CPU.

A new vortex-buffer `cpu_features` test checks
`VORTEX_EXPECT_CPU_FEATURES` against runtime detection, so a matrix entry
fails instead of silently testing a different tier.

Signed-off-by: Claude <noreply@anthropic.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JrpkFgXTULvqViTeJ7bbfM
@joseph-isaacs
joseph-isaacs marked this pull request as ready for review October 12, 2026 15:33
@joseph-isaacs joseph-isaacs added changelog/chore A trivial change changelog/ci and removed changelog/chore A trivial change labels Oct 12, 2026
NEON is mandatory on aarch64, so the regular linux-arm64 test job
already covers it.

Signed-off-by: Claude <noreply@anthropic.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JrpkFgXTULvqViTeJ7bbfM
@joseph-isaacs
joseph-isaacs requested a review from myrrc October 12, 2026 15:40
Replace Intel SDE and QEMU with EC2 instance families pinned via
runs-on that natively have each feature tier: c6a (AVX2, no AVX-512),
c6i (AVX-512 F/BW/VBMI2/VPOPCNTDQ) and c8g (SVE2 + BITPERM). Tests now
run with nextest like the other test jobs.

Signed-off-by: Claude <noreply@anthropic.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JrpkFgXTULvqViTeJ7bbfM
@codspeed

codspeed Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 26.59%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ 11 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

❌ 5 regressed benchmarks
✅ 2208 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ WallTime filter_neon[80] 3 µs 5.4 µs -43.55%
❌ WallTime threshold_neon[64] 4.4 µs 6.1 µs -28.95%
❌ WallTime threshold_neon[8] 2.9 µs 4 µs -28.02%
❌ WallTime filter_neon[64] 2.8 µs 3.3 µs -15.42%
❌ WallTime threshold_neon[80] 4.7 µs 5.4 µs -12.68%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ji/determined-mccarthy-2qi5lf (a748ec4) with develop (1a9ed68)

Open in CodSpeed

The guard test now treats VORTEX_EXPECT_CPU_FEATURES as the complete set
of known features the runner must have: every listed feature must be
detected and every other known feature must not be, so e.g. any AVX-512
feature on the avx2 entry fails the job.

Signed-off-by: Claude <noreply@anthropic.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JrpkFgXTULvqViTeJ7bbfM
The guard test prints each known feature's detection and the expected
set, and runs as its own --no-capture step so the job log shows which
features each instance has.

Signed-off-by: Claude <noreply@anthropic.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JrpkFgXTULvqViTeJ7bbfM

@myrrc myrrc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM sans two comments

Comment thread .github/workflows/ci.yml Resolved
…cros

Use spot instances (price-capacity-optimized) for all three entries, and
move the cpu_features guard test into vortex-array-macros.

Signed-off-by: Claude <noreply@anthropic.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JrpkFgXTULvqViTeJ7bbfM
Drop the ci-profile comment in the workflow and the module explanation
in the cpu_features guard test.

Signed-off-by: Claude <noreply@anthropic.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JrpkFgXTULvqViTeJ7bbfM
@joseph-isaacs
joseph-isaacs merged commit 58d0490 into develop Oct 13, 2026
103 of 104 checks passed
@joseph-isaacs
joseph-isaacs deleted the ji/determined-mccarthy-2qi5lf branch October 13, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants