Commit 6245c00
committed
fix(ci): gate AMX modules behind x86_64 + scope nostd build to -p ndarray + rustfmt
Three additional CI failures surfaced by PR #141 (all pre-existing latent
issues, none caused by the original migration):
(1) s390x-unknown-linux-gnu cross-tests — x86-only inline asm leaks
`src/hpc/amx_matmul.rs` + `src/hpc/bf16_tile_gemm.rs` (its wrapper) +
`src/simd_amx.rs` all use `asm!` with `rcx` / `rax` register names. AMX
is an Intel-only ISA (Sapphire Rapids+); the registers don't exist on
s390x / aarch64 / wasm32 / etc. and the asm parser rejects them at
compile time.
Fix: gate all three module declarations behind `#[cfg(target_arch =
"x86_64")]`. On x86_64 CI runners (most) they compile normally and
runtime gating via `amx_available()` already prevents execution on
CPUs without AMX. On non-x86 targets they're skipped entirely.
External consumer audit clean — only `bf16_tile_gemm` uses `amx_matmul`,
and only `amx_matmul` uses `simd_amx`. No cascade gating needed.
(2) thumbv6m-none-eabi nostd — criterion dev-dep tree leaks into
workspace cross-build
CI runs `cargo rustc --target=thumbv6m-none-eabi --no-default-features
--features portable-atomic-critical-section` from the workspace root.
Without `-p ndarray` scoping, cargo evaluates the whole workspace's dep
graph (including dev-deps from ndarray-rand / serialization-tests /
numeric-tests). The bench migration in PR #140 added `criterion 0.5`
as a dev-dep; criterion transitively pulls `serde_core` (which doesn't
declare `#![no_std]`) and `getrandom` (which has its own
no_std-incompatible paths) into the dep tree.
The library `ndarray` itself builds cleanly on thumbv6m no-default-
features (verified: `cargo check -p ndarray --target=thumbv6m-none-eabi
--no-default-features --features portable-atomic-critical-section` is
clean). The CI command just needs scoping.
Fix: add `-p ndarray` to the cargo rustc invocation in the nostd CI
job so dev-dep evaluation is limited to the library's own deps.
(3) cargo fmt --all --check failures
Bench files migrated to criterion in PR #140 used the workspace's
prior-style "brace on next line" formatting (`fn foo(c: &mut Criterion)
\n{`). Stable rustfmt 1.94.1 (pinned per CLAUDE.md) wants "brace on
same line" (`fn foo(c: &mut Criterion) {`). Plus single-statement
closures inlined.
Fix: run `cargo fmt --all` (no manual changes needed). 13 bench files
+ examples/life.rs touched with mechanical formatting changes only;
no semantic changes.
Verification (local, 2026-05-13):
- `cargo clippy --no-deps` (default) → clean
- `cargo check --no-default-features --features portable-atomic-critical-section --lib` → clean
- `cargo rustc -p ndarray --target=thumbv6m-none-eabi --no-default-features --features portable-atomic-critical-section` → clean (CI command as updated)
- `cargo fmt --all --check` → clean
Pre-existing latent bugs (amx asm registers since the module was added,
criterion dev-dep regression introduced by PR #140 itself); fixes land
on the same PR series that exposed them.1 parent 5f3a43f commit 6245c00
16 files changed
Lines changed: 290 additions & 686 deletions
File tree
- .github/workflows
- benches
- examples
- ndarray-rand/benches
- src
- hpc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 13 | + | |
18 | 14 | | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
23 | 19 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 20 | + | |
27 | 21 | | |
28 | 22 | | |
29 | 23 | | |
| |||
0 commit comments