Skip to content

refactor(substrate): graduate 5 modules from hpc/ to crate root (bitwise, heel_f64x8, distance, byte_scan, spatial_hash)#194

Merged
AdaWorldAPI merged 3 commits into
masterfrom
claude/continue-ndarray-x0Oaw
May 21, 2026
Merged

refactor(substrate): graduate 5 modules from hpc/ to crate root (bitwise, heel_f64x8, distance, byte_scan, spatial_hash)#194
AdaWorldAPI merged 3 commits into
masterfrom
claude/continue-ndarray-x0Oaw

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

@AdaWorldAPI AdaWorldAPI commented May 21, 2026

Summary

Five-module substrate-graduation batch. Continues the thread documented in #192's wrap-up and extended in #193's simd_caps lift. Each module moves from crate::hpc::* (the rustynum migration staging area) to crate root where it sits alongside simd.rs, simd_runtime/, simd_caps, and the W1a polyfill surface it's supposed to compose with.

Module Reason it's low-hanging fruit
bitwise Pure SIMD primitives (popcount_raw, hamming_distance_raw over byte slices); already uses crate::simd::U64x8 polyfill internally; already re-exported via simd.rs:512.
heel_f64x8 All-F64x8 polyfill consumer (dot_f64_simd, cosine_f64_simd, sum_sq_f64_simd, cosine_f32_to_f64_simd, heel_weighted_distance/hamming); already re-exported via simd.rs:563.
distance Spatial 3D-point + slice-shape L1/L2/L∞ kernels (incl. PR-X10 A6 closeout from #193); the linalg/mod.rs hard-boundary comment text gets a one-word update.
byte_scan Pure SIMD utility (needle search, delimiter find, parallel byte compare).
spatial_hash Pure SIMD utility (bucketing, candidate gather, hash collision).

Selection criteria (the low-hanging-fruit test)

All five satisfied three criteria from the post-#193 graduation discussion:

  1. No internal hpc/ dependencies. Only super::simd_caps::simd_caps() calls — and simd_caps already lives at crate root (graduated in feat(simd_caps): CPUID 7,1 + new x86 caps fields + AMX OS-gate in cpu_ops (salvage from #190) #192), so super:: resolution works in either parent location.
  2. Already polyfill-clean. No raw-intrinsic refactor needed before the move; the f64 slice kernels and bit primitives already go through crate::simd::* polyfilled types.
  3. Already partially exposed via crate::simd::* re-exports — so the graduation is consistent with the established public-surface flow.

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. Rust re-exports modules just like other items: pub use crate::X; inside crate::hpc::mod makes crate::hpc::X::* resolve 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 (from #192).

Mechanical changes

src/hpc/bitwise.rs        → src/bitwise.rs
src/hpc/heel_f64x8.rs     → src/heel_f64x8.rs
src/hpc/distance.rs       → src/distance.rs
src/hpc/byte_scan.rs      → src/byte_scan.rs
src/hpc/spatial_hash.rs   → src/spatial_hash.rs
  • 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.
  • 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.

Verification

Check Result
cargo build -p ndarray --lib clean
cargo build -p ndarray --lib --no-default-features clean — new #[cfg(feature = "std")] gates match the simd_caps pattern; nostd targets see no change
cargo test -p ndarray --lib bitwise:: distance:: heel_f64x8:: byte_scan:: spatial_hash:: 119 tests 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, 0 measured
cargo fmt --all --check clean
cargo clippy --features "pillar,ogit_bridge,runtime-dispatch" --lib -- -D warnings clean

Next graduation candidates (deferred to follow-up PRs)

Module What's needed before move
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.md:32-33 explicitly names Fingerprint<N> as a MUST-be-in-ndarray::simd::* type.
hpc::dn_tree (bitwise core) Same polyfill-audit dependency on W1a-#5. The cognitive DNTree / DNConfig / TraversalHit state stays in hpc/ after the split.
hpc::ogit_bridge Pure logic, no SIMD; can move after fingerprint + dn_tree (avoids three partial graduations in flight at once).
hpc::splat3d Already mostly polyfill-clean; pure path rewrite. Deferred because it's a larger consumer surface than the five in this PR.

The mechanical pattern these five establish (move file → add pub mod at root → flip pub mod to pub use crate::X in hpc/mod.rs) is the template each subsequent graduation will follow.


Generated by Claude Code

Summary by CodeRabbit

  • Refactor

    • Exposed several SIMD/HPC modules from the crate root while preserving backward-compatible import paths.
    • Reworked internal iteration and accumulator patterns across SIMD and scalar tails; no behavioral or API changes.
  • Documentation

    • Clarified module-level docs about where distance utilities now live and noted back-compat re-exports.

Review Change Stack

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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

📝 Walkthrough

Walkthrough

Five std-only HPC/SIMD modules (bitwise, heel_f64x8, distance, byte_scan, spatial_hash) are exposed at the crate root; crate::hpc re-exports them for back-compat. SIMD internals received small refactors: iterator-based scalar tails and compound-assignment accumulator updates; no public APIs changed.

Changes

HPC module restructuring with back-compat re-exports and SIMD micro-refactors

Layer / File(s) Summary
New public module declarations at crate root
src/lib.rs
Five std-only public modules (bitwise, heel_f64x8, distance, byte_scan, spatial_hash) are declared at the crate root with documentation indicating their prior crate::hpc::* origin.
Back-compat re-exports in hpc module and docs
src/hpc/mod.rs, src/hpc/linalg/mod.rs
hpc converts local pub mod declarations to pub use crate::... re-exports for the graduated modules; hpc::linalg docs updated to reference the migrated distance metrics location.
SIMD implementation micro-refactors
src/bitwise.rs, src/byte_scan.rs, src/distance.rs, src/spatial_hash.rs, src/aabb.rs, src/nibble.rs, src/palette_codec.rs, src/property_mask.rs
Localized changes in SIMD and AVX paths: replace acc = acc + ... with acc += ..., refactor scalar tail loops to slice iteration/iter().enumerate(), and switch some manual ceil-divs to div_ceil; behavior and public APIs unchanged.
Append-only release log entry
.claude/board/AGENT_LOG.md
Appended a session entry documenting the substrate-graduation batch, moved modules, clippy/doctest fixes, and verification results.

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • AdaWorldAPI/ndarray#193: Related earlier work introducing l1_f64_simd/distance SIMD kernels referenced by the distance changes in this PR.

🐰 From hpc nests to root so bright,
Five modules hop into the light,
Tiny tweaks in loops and sums,
Same results, just cleaner runs! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: five modules (bitwise, heel_f64x8, distance, byte_scan, spatial_hash) are being graduated from hpc/ to the crate root, which is the primary architectural refactoring in this PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/continue-ndarray-x0Oaw

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/hpc/mod.rs`:
- Around line 30-31: The public re-exports (pub use crate::bitwise, pub use
crate::heel_f64x8, pub use crate::byte_scan, pub use crate::distance, pub use
crate::spatial_hash) are missing /// doc comments and examples; add triple-slash
documentation above each re-export describing the export and include a short
fenced rust example that references it (e.g. "use ndarray::hpc::bitwise as _;",
"use ndarray::hpc::heel_f64x8 as _;", and "use ndarray::hpc::{byte_scan as _,
distance as _, spatial_hash as _};") so the API carries required
docs/examples—apply the same change to the other re-export sites noted for
bitwise/HEEL/distance/byte_scan/spatial_hash.

In `@src/lib.rs`:
- Around line 275-302: The public modules bitwise, heel_f64x8, distance,
byte_scan, and spatial_hash lack runnable rustdoc examples; add a minimal `///`
doc example for each module (above the `pub mod ...` declarations) using a
fenced ```rust block that simply references the module to prove it compiles
(e.g. `use <crate>::bitwise as _;`) so the docs are exercisable; ensure each
example is wrapped in a code fence and marked rust, placed directly above the
corresponding `#[cfg(feature = "std")] pub mod <name>;` declarations for
bitwise, heel_f64x8, distance, byte_scan, and spatial_hash.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3349d9c5-755d-4e7e-8481-c2cdf82be7d9

📥 Commits

Reviewing files that changed from the base of the PR and between a0f8fb3 and ca2fc14.

📒 Files selected for processing (8)
  • src/bitwise.rs
  • src/byte_scan.rs
  • src/distance.rs
  • src/heel_f64x8.rs
  • src/hpc/linalg/mod.rs
  • src/hpc/mod.rs
  • src/lib.rs
  • src/spatial_hash.rs

Comment thread src/hpc/mod.rs
Comment on lines +30 to +31
// Bitwise SIMD primitives — graduated to crate root. Back-compat re-export.
pub use crate::bitwise;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Document the new hpc public re-exports with /// examples.

These public re-exports currently use regular // comments (or none), so they miss required API docs/examples.

Proposed doc-comment patch
-// Bitwise SIMD primitives — graduated to crate root. Back-compat re-export.
+/// Bitwise SIMD primitives — graduated to crate root. Back-compat re-export.
+///
+/// ```rust
+/// use ndarray::hpc::bitwise as _;
+/// ```
 pub use crate::bitwise;
@@
-// HEEL F64x8 distance kernels — graduated to crate root. Back-compat re-export.
+/// HEEL F64x8 distance kernels — graduated to crate root. Back-compat re-export.
+///
+/// ```rust
+/// use ndarray::hpc::heel_f64x8 as _;
+/// ```
 pub use crate::heel_f64x8;
@@
-// SIMD-accelerated spatial / byte-scan / hash utilities — graduated to crate root.
-// Back-compat re-exports for existing `use ndarray::hpc::{distance,byte_scan,spatial_hash}::*`.
+/// SIMD-accelerated spatial / byte-scan / hash utilities — graduated to crate root.
+/// Back-compat re-exports for existing `use ndarray::hpc::{distance,byte_scan,spatial_hash}::*`.
+///
+/// ```rust
+/// use ndarray::hpc::{byte_scan as _, distance as _, spatial_hash as _};
+/// ```
 pub use crate::byte_scan;
 pub use crate::distance;
 pub use crate::spatial_hash;

As per coding guidelines: “All public APIs must include /// doc comments with examples”.

Also applies to: 60-61, 173-177

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hpc/mod.rs` around lines 30 - 31, The public re-exports (pub use
crate::bitwise, pub use crate::heel_f64x8, pub use crate::byte_scan, pub use
crate::distance, pub use crate::spatial_hash) are missing /// doc comments and
examples; add triple-slash documentation above each re-export describing the
export and include a short fenced rust example that references it (e.g. "use
ndarray::hpc::bitwise as _;", "use ndarray::hpc::heel_f64x8 as _;", and "use
ndarray::hpc::{byte_scan as _, distance as _, spatial_hash as _};") so the API
carries required docs/examples—apply the same change to the other re-export
sites noted for bitwise/HEEL/distance/byte_scan/spatial_hash.

Comment thread src/lib.rs
claude added 2 commits May 21, 2026 15:28
Two CI / review-feedback fixes on PR #194:

1) Clippy (`-D warnings`, --features rayon / approx,serde,rayon):
   10 errors surfaced because the graduated modules are no longer
   under hpc/mod.rs's `#![allow(clippy::all, ...)]` umbrella.
   Fixed each at the canonical Rust idiom rather than re-applying
   the umbrella — graduated modules hold to the higher standard:

   - `bitwise.rs:110,155` — `acc = acc + (x + y);` →
     `acc += x + y;` (assign_op_pattern; bare without parens).
   - `distance.rs:99` — `for j in i..n { points[j] }` →
     `for p in &points[i..n] { p[0]..p[2] }` (needless_range_loop).
   - `byte_scan.rs:38,71` — `for j in i..n { if haystack[j] == needle
     { result.push(j); }}` → `for (offset, &byte) in haystack[i..n]
     .iter().enumerate() { if byte == needle { result.push(i + offset);
     }}` (needless_range_loop with index preservation).
   - `byte_scan.rs:101,129` — same pattern but counting via
     `total += 1`; switched to `for &byte in &haystack[i..n]`
     (no index needed at all).
   - `spatial_hash.rs:334` — `for lane in 0..8 { d2_arr[lane] }` →
     `for (lane, &d2_lane) in d2_arr.iter().enumerate()`.
   - `spatial_hash.rs:342` — `for i in (chunks*8)..candidates.len()
     { candidates[i] }` → `let tail_start = chunks * 8;
     for (offset, &cand) in candidates[tail_start..].iter()
     .enumerate() { result.push((tail_start + offset, d2)) }`.

2) CodeRabbit + CLAUDE.md hard rule ("All public APIs need ///
   doc comments with examples"):
   Added `# Example` rustdoc blocks to each of the five new
   `pub mod` declarations in `src/lib.rs`. Each example uses
   only the actual public API of the target module (verified by
   running the doctests):

   - `bitwise` — popcount + hamming over [0xFF; 16]/[0x00; 16]
   - `heel_f64x8` — cosine_f64_simd + dot_f64_simd over [1.0; 32]
   - `distance` — l1/l2/linf_f64_simd over pythagorean (3,0)/(0,4)
   - `byte_scan` — byte_find_all over a 23-char fixture
   - `spatial_hash` — SpatialHash::new + insert + len

All five doctests pass under `cargo test --doc`. `cargo clippy
--features rayon --lib -- -D warnings` and `cargo clippy
--features approx,serde,rayon -- -D warnings` both green.
Continues the substrate-graduation thread from #192 (simd_caps),
#193 (clippy/doc cleanup), and #194 (bitwise/heel_f64x8/distance/
byte_scan/spatial_hash). Same low-hanging-fruit criteria — no
internal hpc/ deps, polyfill-clean, single-line back-compat shim
keeps every existing import resolving.

| Module          | Reason                                                         |
|---|---|
| `aabb`          | SIMD AABB intersection/expansion/distance; only deps are       |
|                 | `crate::simd::F32x16` + `super::simd_caps` (graduated #192).   |
| `nibble`        | 4-bit packed nibble batch ops; only dep is `crate::simd::U8x64`.|
| `palette_codec` | Variable-width palette index codec (1-8 bit packing); zero deps.|
| `property_mask` | AVX-512 VPTERNLOGD bitset queries on block state bits;         |
|                 | only dep is `crate::simd::U64x8`.                              |

# Why these four, why now

All four satisfy the criteria from #194's wrap-up:
  1. No internal `hpc/` dependencies — only `crate::simd::*`
     (polyfill surface) and `super::simd_caps` (which is itself
     at crate root post-#192).
  2. Polyfill-clean — no raw-intrinsic refactor required.
  3. Single in-tree downstream caller (`hpc::framebuffer` uses
     `palette_codec`) → the `pub use crate::palette_codec;`
     back-compat shim keeps that resolution working zero-touch.

# Mechanical changes

- `git mv src/hpc/{aabb,nibble,palette_codec,property_mask}.rs src/`
- `src/lib.rs`: added four `pub mod` declarations under
  `#[cfg(feature = "std")]`, each with a `# Example` rustdoc block
  per CLAUDE.md "all public APIs need doc comments with examples".
- `src/hpc/mod.rs`: replaced the four `pub mod` declarations with
  `pub use crate::{aabb, nibble, palette_codec, property_mask};`
  back-compat re-exports. `crate::hpc::aabb::*` and friends keep
  resolving for every existing call site, identical to how
  `crate::hpc::bitwise::*` works post-#194.

# Clippy / lint cleanup

17 clippy errors surfaced under `-D warnings` once the modules
left the `hpc/mod.rs` `#![allow(clippy::all, ...)]` umbrella.
Fixed each at the canonical Rust idiom (the #194 cleanup pattern,
417131b), no umbrella re-application:

- **manual_div_ceil (6 sites)** — `(n + d - 1) / d` → `n.div_ceil(d)`
  in `nibble.rs` (x2), `palette_codec.rs` (x3), `property_mask.rs`.
- **needless_range_loop (10 sites)** — `for i in start..vec.len()`
  rewrites to `for x in &vec[start..]` (when index unused) or
  `for (i, &x) in iter().enumerate().skip(start)` (when index used).
  Sites: `aabb.rs` x4, `nibble.rs` x3, `palette_codec.rs` x1,
  `property_mask.rs` x2.
- **missing_docs (4 sites)** — added field doc comments on
  `pub struct Aabb { min, max }` and `pub struct Ray { origin,
  inv_dir }`. Previously masked by the `hpc/mod.rs` umbrella's
  `#![allow(missing_docs)]`.

# Doctest correction

Initial `# Example` in `src/lib.rs` for `palette_codec` asserted
`bits_for_palette_size(1) == 1` per the module's own docstring
table, but the impl returns 0 for `palette_size <= 1` (trivial-
palette special case). Changed assertion to use `bits_for_palette_
size(2) == 1` — exercises the same code path with input the impl
actually handles per spec.

# Verification

```
cargo check --lib                                          green
cargo clippy --lib -- -D warnings                          green
cargo clippy --lib --features rayon -- -D warnings         green
cargo clippy --features approx,serde,rayon -- -D warnings  green
cargo test --doc (15 graduated-module doctests)            pass
cargo test --lib (104 unit tests across 4 modules)         pass
```

# What's next

`hpc/` inventory: ~55 → ~51 modules at the staging path. Next-batch
candidates per the same criteria need a deps audit before move:
`framebuffer` (uses `palette_codec` shim, otherwise crate-root),
`ocr_simd`/`ocr_felt`, `audio`. Filed in AGENT_LOG entry for the
follow-up pass.

https://claude.ai/code/session_01HbqooFZHAjaUtFEzhA1R2u
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/hpc/mod.rs (1)

179-187: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add rustdoc comments and examples for these new public re-exports.

These pub use items are public APIs but currently documented with // comments, so they miss required /// docs with examples.

📌 Suggested patch
-// Variable-width palette index codec — graduated to crate root.
-// Back-compat re-export for existing `use ndarray::hpc::palette_codec::*`.
+/// Variable-width palette index codec — graduated to crate root.
+/// Back-compat re-export for existing `use ndarray::hpc::palette_codec::*`.
+///
+/// ```rust
+/// use ndarray::hpc::palette_codec as _;
+/// ```
 pub use crate::palette_codec;
 
-// SIMD-accelerated HPC modules (block properties, nibble light data, AABB
-// collision) — all three graduated to crate root. Back-compat re-exports.
+/// Axis-aligned bounding box operations — crate-root module re-exported for back-compat.
+///
+/// ```rust
+/// use ndarray::hpc::aabb as _;
+/// ```
 pub use crate::aabb;
+/// Nibble-packed 4-bit utilities — crate-root module re-exported for back-compat.
+///
+/// ```rust
+/// use ndarray::hpc::nibble as _;
+/// ```
 pub use crate::nibble;
+/// Block property mask queries — crate-root module re-exported for back-compat.
+///
+/// ```rust
+/// use ndarray::hpc::property_mask as _;
+/// ```
 pub use crate::property_mask;

As per coding guidelines: “All public APIs must include /// doc comments with examples”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hpc/mod.rs` around lines 179 - 187, The public re-exports palette_codec,
aabb, nibble, and property_mask are missing rustdoc comments and examples;
replace the inline `//` comments with `///` doc comments for each pub use
(palette_codec, aabb, nibble, property_mask) and add a short docstring plus a
minimal doctest example (e.g., ```rust\nuse ndarray::hpc::aabb as _;\n``` style)
for each to satisfy the “public APIs must include /// doc comments with
examples” guideline, ensuring each re-export has its own descriptive line and
fenced-rust example.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/board/AGENT_LOG.md:
- Around line 68-75: The fenced code block that contains the cargo commands in
.claude/board/AGENT_LOG.md is missing a language tag (triggering markdownlint
MD040); update the opening fence for that block (the one containing the lines
starting with "cargo check --lib" and subsequent cargo commands) from ``` to
```bash so the block is annotated as bash.

---

Duplicate comments:
In `@src/hpc/mod.rs`:
- Around line 179-187: The public re-exports palette_codec, aabb, nibble, and
property_mask are missing rustdoc comments and examples; replace the inline `//`
comments with `///` doc comments for each pub use (palette_codec, aabb, nibble,
property_mask) and add a short docstring plus a minimal doctest example (e.g.,
```rust\nuse ndarray::hpc::aabb as _;\n``` style) for each to satisfy the
“public APIs must include /// doc comments with examples” guideline, ensuring
each re-export has its own descriptive line and fenced-rust example.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dd67c007-4910-477a-b063-9a88df9558d9

📥 Commits

Reviewing files that changed from the base of the PR and between 417131b and 17d0eae.

📒 Files selected for processing (7)
  • .claude/board/AGENT_LOG.md
  • src/aabb.rs
  • src/hpc/mod.rs
  • src/lib.rs
  • src/nibble.rs
  • src/palette_codec.rs
  • src/property_mask.rs

Comment on lines +68 to +75
```
cargo check --lib → clean
cargo clippy --lib -- -D warnings → clean
cargo clippy --lib --features rayon -- -D warnings → clean
cargo clippy --features approx,serde,rayon -- -D warnings → clean
cargo test --doc (filtered: graduated modules) → 15 doctests pass
cargo test --lib aabb::tests nibble::tests palette_codec::tests property_mask::tests → 104 unit tests pass
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a language tag to the fenced code block.

Line 68 opens a fenced block without a language, which triggers markdownlint MD040. Please annotate it (e.g., bash).

Suggested patch
-```
+```bash
 cargo check --lib                                              → clean
 cargo clippy --lib -- -D warnings                              → clean
 cargo clippy --lib --features rayon -- -D warnings             → clean
 cargo clippy --features approx,serde,rayon -- -D warnings      → clean
 cargo test --doc (filtered: graduated modules)                 → 15 doctests pass
 cargo test --lib aabb::tests nibble::tests palette_codec::tests property_mask::tests → 104 unit tests pass
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 68-68: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/board/AGENT_LOG.md around lines 68 - 75, The fenced code block that
contains the cargo commands in .claude/board/AGENT_LOG.md is missing a language
tag (triggering markdownlint MD040); update the opening fence for that block
(the one containing the lines starting with "cargo check --lib" and subsequent
cargo commands) from ``` to ```bash so the block is annotated as bash.

@AdaWorldAPI AdaWorldAPI merged commit 6ff6f48 into master May 21, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants