Skip to content

feat(cli): add --simd flag for runtime SIMD level override - #3743

Merged
oferchen merged 4 commits into
masterfrom
feat/simd-cli-flag-1825
May 6, 2026
Merged

oferchen merged 4 commits into
masterfrom
feat/simd-cli-flag-1825

Conversation

@oferchen

@oferchen oferchen commented May 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a process-wide SIMD level override (SimdLevel::{Auto, Avx512, Avx2, Sse4, Neon, None}) in checksums::cpu_features, backed by a lock-free AtomicU8 so dispatch reads stay zero-cost.
  • Wires the override into the rolling-checksum x86 and NEON paths and into the MD5 batch dispatcher; every CPUID gate now consults feature_allowed before activating a backend.
  • Surfaces the override on the command line via --simd=<auto|avx512|avx2|sse4|neon|none>. The CLI installs the override exactly once at workflow start and surfaces a clear diagnostic on conflicting installs.
  • Adds parser unit tests for every variant plus aliases (avx-512, sse4.1, scalar, ...) and integration tests in crates/checksums/tests/simd_override.rs that verify pinning forces the expected dispatcher backend and that none reproduces scalar parity with auto.

Test plan

  • cargo nextest run -p checksums --test simd_override (CI)
  • cargo nextest run -p cli -E 'test(simd_)' (CI)
  • Confirm --help and SUPPORTED_OPTIONS_LIST advertise the new flag (CI help golden)

@github-actions github-actions Bot added the enhancement New feature or request label May 5, 2026
@oferchen
oferchen force-pushed the feat/simd-cli-flag-1825 branch 2 times, most recently from c5e0c6c to e3f2a00 Compare May 6, 2026 12:16
oferchen added 4 commits May 6, 2026 20:45
Adds a process-wide SIMD level override that lets callers pin checksum
dispatch to a specific instruction-set family (auto, avx512, avx2, sse4,
neon, none) via the new --simd CLI flag. The override is consulted by
the rolling-checksum dispatcher (x86 AVX2/SSE2 path and aarch64 NEON
path) and the MD5 batch dispatcher before CPUID, so callers can force a
narrower backend even on hosts that advertise wider SIMD.
@oferchen
oferchen force-pushed the feat/simd-cli-flag-1825 branch from 042727b to 41f48aa Compare May 6, 2026 17:45
@oferchen
oferchen merged commit bb110d3 into master May 6, 2026
39 checks passed
@oferchen
oferchen deleted the feat/simd-cli-flag-1825 branch May 6, 2026 18:10
oferchen added a commit that referenced this pull request May 18, 2026
* feat(cli): add --simd flag for runtime SIMD level override

Adds a process-wide SIMD level override that lets callers pin checksum
dispatch to a specific instruction-set family (auto, avx512, avx2, sse4,
neon, none) via the new --simd CLI flag. The override is consulted by
the rolling-checksum dispatcher (x86 AVX2/SSE2 path and aarch64 NEON
path) and the MD5 batch dispatcher before CPUID, so callers can force a
narrower backend even on hosts that advertise wider SIMD.

* fix(cli): use format! in rsync_error! to avoid macro ambiguity

* fix(cli): inline format args to satisfy clippy uninlined_format_args

* fix(checksums): inline format args to satisfy clippy uninlined_format_args
oferchen added a commit that referenced this pull request Aug 24, 2026
* feat(cli): add --simd flag for runtime SIMD level override

Adds a process-wide SIMD level override that lets callers pin checksum
dispatch to a specific instruction-set family (auto, avx512, avx2, sse4,
neon, none) via the new --simd CLI flag. The override is consulted by
the rolling-checksum dispatcher (x86 AVX2/SSE2 path and aarch64 NEON
path) and the MD5 batch dispatcher before CPUID, so callers can force a
narrower backend even on hosts that advertise wider SIMD.

* fix(cli): use format! in rsync_error! to avoid macro ambiguity

* fix(cli): inline format args to satisfy clippy uninlined_format_args

* fix(checksums): inline format args to satisfy clippy uninlined_format_args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant