Skip to content

Commit b4c6692

Browse files
committed
feat(hpc/blocked_grid): add blocked_grid_struct! macro for SoA-of-grids (PR-X3 B)
The macro generates an SoA-of-grids struct: each named field becomes its own BlockedGrid<FieldT, BR, BC> with shared rows/cols/padded dimensions. Generated API (v1 — L1 only; L2/L3/L4 deferred to follow-up): - {Name}::new(rows, cols) constructor - rows/cols/padded_rows/padded_cols accessors - blocks_l1() lockstep iteration → {Name}L1Block<'_> - map_l1() PRIMARY compute path → new {Name}, input unchanged - bulk_apply_l1() SECONDARY write-back, carries verbatim # Data-flow rule docstring section per .claude/rules/data-flow.md Rule #3 - field_n::<I>() compile-time field accessor (P1 G4 ruling) - {Name}L1Block / {Name}L1BlockMut / {Name}L1BlockIter view types Also adds: - FieldGridRef trait (object-safe dimension accessor for &dyn use) - Clone impl for BlockedGrid<T: Copy + Default, BR, BC> - paste = "1" dependency (identifier concat for {Name}L1Block naming) - pub use paste re-export in lib.rs for $crate::paste::paste! macro hygiene Reserved field names enforced (compile error if shadowed): `new`, `rows`, `cols`, `padded_rows`, `padded_cols`, `blocks_l1/2/3/4`, `map_l1/2/3/4`, `bulk_apply_l1/2/3/4`, `field_n`, `default`. Inline tests: 2/3/4-field generation, pub/private field visibility, #[derive(Clone)] passthrough, map_l1 input-unchanged invariant, bulk_apply_l1 lockstep mutation, field_n::<0>/<1> accessor. 5-gate result: check OK, lib 111/111, doc 79/79, fmt OK, clippy OK. https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS
1 parent 32eaf11 commit b4c6692

5 files changed

Lines changed: 821 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ fractal = { path = "crates/fractal", default-features = false, optional = true }
9898
serde = { version = "1.0", optional = true, default-features = false, features = ["alloc"] }
9999
rawpointer = { version = "0.2" }
100100

101+
# paste — identifier concatenation in macro_rules! expansions.
102+
# Required by `blocked_grid_struct!` to generate {Name}L1Block / {Name}L1BlockMut
103+
# view types. Already present in the workspace lockfile (via crates/burn).
104+
paste = "1"
105+
101106

102107
# Cranelift JIT (optional, behind "jit-native" feature)
103108
# For AVX-512 VPOPCNTDQ/VNNI/VPTERNLOG/BITALG support, use the patched fork:

0 commit comments

Comments
 (0)