Skip to content

Commit 882f456

Browse files
committed
Fix the merge regression that broke every compile job
My 2026-08-11 merge of origin/master kept BOTH sides of the simd.rs re-export block, which introduced a duplicate `bf16_tile_gemm_16x16` name: once unaliased from `hpc::bf16_tile_gemm` (this branch's W1a re-export) and once from `simd_ops` (master's canonical polyfill export). The collision is a hard compile error, which is why clippy, tests, native-backend, tier4-avx512, wasm-simd, neon-qemu and hpc-stream-parallel all went red at once on 921bd7a. Resolution: drop this branch's unaliased re-export and keep master's deliberate two-name split — `bf16_tile_gemm_16x16` (the pure polyfill kernel, from simd_ops) and `bf16_tile_gemm_16x16_amx` (the tile-dispatching wrapper, from hpc). Master's arrangement already satisfies the W1a "reach it via ndarray::simd::*" intent that this branch's export was written for, so nothing is lost. No tile-GEMM function is added or removed by this branch — `int8_tile_gemm_16x16` (used by the geostrophic example) has been on master since 58200fb, and no 16x32 tile GEMM exists in the crate; the only 16x32 symbols are SIMD register types (I16x32/U16x32) in simd_nightly, which are lane widths, not tile kernels. 16x16 is AMX's native TDPBUSD accumulator geometry, not a choice. Also in this commit: - Restore the newline my merge script ate between the `_amx` re-export and the CPU-generation comment (this was the `format/stable` failure). - Correct the arch_prctl wording in AMX_GOTCHAS Gotcha 15: 158 is the x86_64 SYS_arch_prctl syscall NUMBER, not an operation argument, so both diagnostics now read `syscall(SYS_arch_prctl /* 158 */, ARCH_{REQ,GET}_XCOMP_PERM, ...)`. Raised by CodeRabbit on #275 and correct on the merits. Gates, run locally on the merged tree: `cargo fmt --check` clean, `cargo check --lib --features std` clean, `cargo clippy --lib --features std` no errors, and `cargo run --example geostrophic_stencil` green with all 4 pre-registered bars PASS on the scalar-fallback path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
1 parent 921bd7a commit 882f456

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎.claude/AMX_GOTCHAS.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,11 @@ directly (not just CPUID) — each a few lines of stable asm (Gotcha 4/5 has the
281281
0 (a generic model name like `Xeon @ 2.80GHz` is the tell).
282282
- `_xgetbv(0)` XCR0 b17/b18 (TILECFG/TILEDATA) — if **0**, the OS never enabled
283283
tile XSTATE; AMX cannot run, full stop.
284-
- `arch_prctl(158, ARCH_REQ_XCOMP_PERM, XTILEDATA=18)` — `-95 / -EOPNOTSUPP`
284+
- `syscall(SYS_arch_prctl /* 158 */, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA=18)`
285+
— `-95 / -EOPNOTSUPP`
285286
means the kernel REFUSES the grant; **no byte-call can force it**.
286-
- `arch_prctl(158, ARCH_GET_XCOMP_PERM, &mask)` — XTILEDATA (b18) must be in mask.
287+
- `syscall(SYS_arch_prctl /* 158 */, ARCH_GET_XCOMP_PERM, &mask)` — XTILEDATA (b18)
288+
must be in mask.
287289

288290
Observed once on one provisioning (kernel 6.18.5 guest): CPUID=0 **and** XCR0
289291
b17/b18=0 **and** REQ=`-EOPNOTSUPP` → genuinely unavailable. `detect_amx()`

‎src/simd.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -645,12 +645,11 @@ pub use crate::hpc::cascade;
645645
// `backend::gemm_bf16` (portable scalar / NEON / wasm-SIMD paths).
646646
#[cfg(all(feature = "std", target_arch = "x86_64"))]
647647
pub use crate::hpc::amx_matmul::{amx_available, matmul_i8_to_i32};
648-
// BF16 16×16 tile GEMM — AMX `TDPBF16PS` when `amx_available()`, `F32x16` FMA
649-
// fallback otherwise. Same W1a rule: reach it via `ndarray::simd::*`, never
650-
// `crate::hpc` directly (the one-time `arch_prctl(158)` XTILEDATA grant is gated
651-
// inside `amx_available()`, which this dispatcher calls before any tile op).
652-
#[cfg(feature = "std")]
653-
pub use crate::hpc::bf16_tile_gemm::bf16_tile_gemm_16x16;
648+
// (The BF16 tile GEMM this branch re-exported unaliased is already surfaced
649+
// twice below — `bf16_tile_gemm_16x16` from `simd_ops` (the pure polyfill
650+
// kernel) and `bf16_tile_gemm_16x16_amx` from `hpc` (the tile-dispatching
651+
// wrapper). A third, unaliased `hpc` re-export collided with the `simd_ops`
652+
// name; dropped at the 2026-08-11 merge in favour of master's two-name split.)
654653
// Runtime-dispatch trampolines (`simd_runtime`, feature = "runtime-dispatch")
655654
// surfaced through the canonical `ndarray::simd::*` namespace — the W1a
656655
// consumer invariant is "all SIMD from `ndarray::simd`", so consumers that
@@ -682,7 +681,8 @@ pub use crate::simd_runtime::matmul_i8_to_i32;
682681
#[cfg(all(feature = "std", target_arch = "x86_64"))]
683682
pub use crate::hpc::bf16_tile_gemm::{
684683
bf16_tile_gemm_16x16 as bf16_tile_gemm_16x16_amx, bf16_tile_gemm_16x16_packed, bf16_tile_gemm_tier, PackedBf16B,
685-
};// CPU-generation detection (cached): SPR / EMR / GNR / Sierra Forest. Lets a
684+
};
685+
// CPU-generation detection (cached): SPR / EMR / GNR / Sierra Forest. Lets a
686686
// consumer report which silicon a run landed on and distinguish "no AMX
687687
// silicon" from "AMX present but not OS-enabled" — both surface via `amx_report`.
688688
#[cfg(target_arch = "x86_64")]

0 commit comments

Comments
 (0)