Skip to content

Commit 530ffaa

Browse files
committed
docs(simd): correct stale '5 of 30 types' claim — PR #146 shipped full parity
The note in src/simd.rs (and the matching paragraph in scripts/miri-tests.sh) was written against an early draft of simd_nightly that defined 5 types: F32x16, F64x8, U8x64, U32x16, F32Mask16. PR #146 expanded the polyfill to full parity: simd_nightly: 24 types simd_avx512 + simd_avx2: 24 types (F32x8/16, F64x4/8, BF16x8/16, F16x16, I8x32/64, I16x16/32, I32x16, I64x8, U8x32/64, U16x32, U32x8/16, U64x4/8, plus the F32/F64 mask types — `grep '^pub struct ' src/simd_nightly/*.rs | grep -v _original_draft | sort -u | wc -l` confirms.) `src/simd_nightly/_original_draft.rs` survives on disk as the early 5-type sketch but is NOT in `simd_nightly/mod.rs` — dead-file, not compiled. Separate janitorial concern (file deletion); the comment correction lands here. The architectural follow-up for Miri-clean `hpc::*` coverage is NOT polyfill expansion — that work is done. It's a cfg(miri) switch in `src/simd.rs` that re-exports from `simd_nightly` instead of `simd_avx*` when Miri is the target. Comment rewritten to say so.
1 parent 6590b9e commit 530ffaa

2 files changed

Lines changed: 21 additions & 22 deletions

File tree

scripts/miri-tests.sh

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,14 @@ export RUSTFLAGS="-Zrandomize-layout"
4848
# Miri target doesn't enable AVX/AVX2/AVX-512/NEON target features.
4949
#
5050
# The `nightly-simd` feature ships a parallel module `crate::simd_nightly`
51-
# (the 30-type `core::simd` polyfill) which IS Miri-checkable, but the
52-
# default `crate::simd::*` dispatch is NOT routed through it — that's a
53-
# deliberate decision noted in `src/simd.rs:212`. Consumer modules that
54-
# import `crate::simd::F32x16` (most of `hpc::*`) therefore go through
55-
# intrinsics and abort under Miri.
56-
#
57-
# Until the polyfill expands to full type-parity (5/30 today) AND
58-
# `crate::simd::*` gains a `cfg(miri)` dispatch through it, we constrain
59-
# this sweep to:
60-
# * `simd_nightly::tests::*` — the polyfill itself, full coverage.
61-
# * `hpc::byte_scan::*` — already exercises scalar fallback paths
62-
# through `simd_caps()` cfg(miri) bypass.
63-
# * everything else ndarray ships that does NOT pull `_mm*` intrinsics.
64-
#
65-
# `--no-fail-fast` so a single regression doesn't mask the rest. CI
66-
# nextest profile `default-miri` already configures isolated retry-on-flake.
51+
# (the 24-type `core::simd` polyfill, at full parity with the 24 types
52+
# defined across `simd_avx2.rs` + `simd_avx512.rs` — landed in PR #146)
53+
# which IS Miri-checkable. But the default `crate::simd::*` dispatch is
54+
# NOT routed through it; consumer modules that import `crate::simd::F32x16`
55+
# (most of `hpc::*` + the `simd::tests::*` suite) go through intrinsics.
56+
# The polyfill is no longer the bottleneck — the missing piece is a
57+
# `cfg(miri)` switch in `src/simd.rs` that re-exports from `simd_nightly`
58+
# instead of `simd_avx*` under Miri.
6759
cargo +nightly miri nextest run -v \
6860
--no-fail-fast \
6961
-p ndarray -p ndarray-rand \

src/simd.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,19 @@ pub const PREFERRED_I16_LANES: usize = 16;
205205

206206
// Note on the `nightly-simd` feature: it adds the `crate::simd_nightly`
207207
// module (a portable-simd backend wrapping `core::simd`) but does NOT
208-
// replace the intrinsics dispatch below. Full type-parity coverage
209-
// would require the nightly module to define ~30 types; the current
210-
// draft covers 5 (F32x16, F64x8, U8x64, U32x16, F32Mask16). Consumers
211-
// who want miri-runnable SIMD code import from `simd_nightly`
212-
// explicitly (e.g. `use ndarray::simd_nightly::F32x16`). The main
213-
// polyfill via `crate::simd::F32x16` continues to use intrinsics.
208+
// replace the intrinsics dispatch below. The polyfill ships full
209+
// type-parity with production (PR #146): 24 types covering F32x8/16,
210+
// F64x4/8, BF16x8/16, F16x16, I8x32/64, I16x16/32, I32x16, I64x8,
211+
// U8x32/64, U16x32, U32x8/16, U64x4/8, plus the F32/F64 mask types —
212+
// matches the 24 types defined in `simd_avx2.rs` + `simd_avx512.rs`.
213+
// Consumers who want miri-runnable SIMD code import from `simd_nightly`
214+
// explicitly today (e.g. `use ndarray::simd_nightly::F32x16`).
215+
//
216+
// The remaining work for Miri-clean coverage of `hpc::*` is wiring this
217+
// file's `pub use crate::simd_{avx512,avx2,neon}::*` re-exports to
218+
// route through `simd_nightly` under `cfg(miri)`. Once that lands,
219+
// every `use crate::simd::F32x16` call site becomes miri-checkable
220+
// without source changes. The polyfill itself is no longer the bottleneck.
214221

215222
#[cfg(all(target_arch = "x86_64", target_feature = "avx512f"))]
216223
pub use crate::simd_avx512::{

0 commit comments

Comments
 (0)