Commit ca2fc14
committed
refactor(substrate): graduate 5 modules from hpc/ to crate root
Continues the substrate-graduation thread documented in #192's wrap-up
and extended in #193's simd_caps lift. Five more modules move from
`crate::hpc::*` (the rustynum migration staging area) to crate root
where they sit alongside `simd.rs`, `simd_runtime/`, `simd_caps`, and
the W1a polyfill surface they're supposed to compose with.
| Module | Reason |
|---|---|
| `bitwise` | Pure SIMD primitives (popcount, hamming over byte slices); already uses `crate::simd::U64x8` polyfill internally; already re-exported via `simd.rs:512`. |
| `heel_f64x8` | All-F64x8 polyfill consumer (dot, cosine, sum-sq, weighted-hamming); already re-exported via `simd.rs:563`. |
| `distance` | Spatial 3D + slice-shape L1/L2/L∞ (PR-X10 A6); the linalg/mod.rs hard-boundary comment now points here at root. |
| `byte_scan` | Pure SIMD utility (needle search, delimiter find). |
| `spatial_hash` | Pure SIMD utility (bucketing, candidate gather). |
# Why these five, why now
All five satisfied the low-hanging-fruit criteria from #193's wrap-up
discussion:
1. No internal `hpc/` dependencies (only `super::simd_caps` which
still resolves correctly because `simd_caps` is itself at crate
root post-#192).
2. Already polyfill-clean — no raw-intrinsic refactor needed before
the move.
3. Already partially exposed via `crate::simd::*` re-exports.
The next graduation tier (`fingerprint`, `dn_tree`, `ogit_bridge`,
`splat3d`) needs a polyfill audit before it can move, and
`fingerprint` in particular is gated on the W1a-#5 POPCOUNT-U64
primitive landing (so its bit ops can route through `U64xN.popcnt()`
instead of raw `u64.count_ones()`).
# Back-compat preserved end-to-end
Every cross-repo consumer using `ndarray::hpc::{bitwise, heel_f64x8,
distance, byte_scan, spatial_hash}::*` continues to compile
unmodified. The `src/hpc/mod.rs` declarations change from
`pub mod X;` to `pub use crate::X;` — Rust re-exports modules just
like other items, so `crate::hpc::X::*` resolves through to the same
items as `crate::X::*`. Internal `super::simd_caps::simd_caps()`
calls inside the moved files continue to work because `super::` at
crate root resolves to `crate::*` which has `simd_caps` (graduated
in #192).
# Changes
- `git mv` five files from `src/hpc/` to `src/`.
- `src/lib.rs` gains five `#[cfg(feature = "std")] pub mod X;`
declarations next to the existing `simd_caps` block, each with a
one-liner docstring naming the graduation source and the
substrate-tier reason for the move.
- `src/hpc/mod.rs` replaces five `pub mod X;` with `pub use crate::X;`
(back-compat re-exports).
- `src/hpc/linalg/mod.rs` updates the hard-boundary comment from
"No distance metrics — those live in `crate::hpc::distance`" to
point at `crate::distance` (the new canonical path) with a
parenthetical noting the back-compat re-export.
- The `bitwise.rs` declaration in `src/hpc/mod.rs` is now a comment
instead of being interleaved with `pub mod hdc`/`pub mod projection`
to make the graduation status visible at a glance.
# Verification
- `cargo build -p ndarray --lib` — clean
- `cargo build -p ndarray --lib --no-default-features` — clean
(the new `#[cfg(feature = "std")]` gates match the existing
`simd_caps` pattern; nostd targets see no change)
- `cargo test -p ndarray --lib bitwise:: distance:: heel_f64x8::
byte_scan:: spatial_hash::` — all 119 tests on the five graduated
modules pass at the new path (test names now `bitwise::tests::*`
rather than `hpc::bitwise::tests::*`)
- `cargo test -p ndarray --lib --features "pillar,ogit_bridge,
runtime-dispatch" hpc::` — 2167 passed, 0 failed, 28 ignored
- `cargo fmt --all --check` — clean
- `cargo clippy --features "pillar,ogit_bridge,runtime-dispatch"
--lib -- -D warnings` — clean
# Next graduation candidates (deferred)
- `hpc::fingerprint` — needs W1a-#5 POPCOUNT-U64 to land first so
bit ops can route through `U64xN.popcnt()` instead of raw
`u64.count_ones()`. Cognitive-shader-foundation explicitly names
`Fingerprint<N>` as a MUST-be-in-`ndarray::simd::*` type.
- `hpc::dn_tree` (bitwise core) — same polyfill-audit dependency.
The cognitive DNTree/DNConfig/TraversalHit state stays in
`hpc/` after the split.
- `hpc::ogit_bridge` — pure logic, no SIMD, can move once the
fingerprint + dn_tree audits are out of the way (avoids three
partial graduations in flight at once).
- `hpc::splat3d` — already mostly polyfill-clean; pure path
rewrite. Defer because it's a larger consumer surface than
the five in this PR.1 parent a0f8fb3 commit ca2fc14
8 files changed
Lines changed: 40 additions & 8 deletions
File tree
- src
- hpc
- linalg
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
60 | | - | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
275 | 304 | | |
276 | 305 | | |
277 | 306 | | |
| |||
File renamed without changes.
0 commit comments