diff --git a/.claude/blackboard.md b/.claude/blackboard.md index 503addb3b..60d835951 100644 --- a/.claude/blackboard.md +++ b/.claude/blackboard.md @@ -4578,3 +4578,64 @@ laws, ExtentUnsupported, row bounds) and WITNESS in OrderedLaneWitness; no new t 41 hits reported, 6 files; checked against my own grep of src/ and crates/: 0 wrong, 0 missed. - Consumer: lance-graph mask-risc `SelFold` (gate B), not started. + +## 2026-11-30 — Rust 1.99.0 → 1.100.1 (channel only; `rust-version` floor stays 1.99.0) + +Edited: `rust-toolchain.toml` (+ bump log), CI clippy matrix and the four +`dtolnay/rust-toolchain@` steps, both Dockerfiles, CLAUDE.md, README(-DE), the +safe-intrinsic probe header. Kept: `rust-version = "1.99.0"` and CI +`MSRV`/`BLAS_MSRV` (no 1.100-only API used), as lance-graph did for the same bump. + +Toolchain leg measured alone first: error-SET diff of +`clippy --workspace --all-targets --keep-going --message-format=short -D warnings` +on 1.99.0 vs 1.100.1, unchanged code. The first 1.100.1 run reported FEWER +errors (10 vs 16): a new `needless_bool` in the library (`blas_compat_1d`, +feature blas) failed `ndarray`, so the targets with baseline errors were never +reached. Fixed in order, each re-measured on both toolchains: + +- `needless_bool`: src/linalg/impl_linalg.rs, same truth table. +- `needless_range_loop` ×2, reached once the lib built: examples/u9_abacus, + examples/u9_domino (`iter_mut().skip(start)` keeps a start past BITS empty). +- `cargo::unused_dependencies` (Cargo's new lint, warn): p64 → fractal removed; + ndarray-gen / ndarray-rand / ndarray + ron moved to dev-dependencies of + blas-tests / numeric-tests / serialization-tests. +- rustfmt 1.100 splits macro arguments after a doc comment: 39 sites in + amx_ops.rs and simd_masking_ops.rs; both rustfmts accept the result. +- Cargo 1.100's new build-dir layout: a bare `--emit=asm` no longer writes next + to the example / into deps/. codegen-witness.sh and neon-asm-rung3.sh found + nothing (unchanged neon gate on 1.100.1: exit 2); codec8_asm_diff.sh read a + STALE .s from the 1.99.0 build. All three now pass `--emit=asm=`. + +After the fixes the error sets are identical (16 pre-existing: cesium lib +tests, u64x64 example, blas-tests without a backend; 0 unused-dep warnings). + +Gates on 1.100.1: + +| gate | result | +|---|---| +| CI rows: clippy `--features approx,serde,rayon` / `--features native` (CI RUSTFLAGS) | exit 0 | +| `fmt --all --check` (1.100.1 and 1.99.0) | exit 0 | +| `test --lib` native (host, avx512f=true) | 2744 passed, 32 ignored | +| `test --lib` v3 | 2693 passed, 31 ignored | +| `test --doc` | 927 passed, 44 ignored | +| masking-parity native (avx512f=true) / native v3 (avx512f=false) | PASS / PASS | +| codegen-witness avx2 (v3) / avx512 (v4) / neon (aarch64) | PASS ×3 (also on 1.99.0) | +| neon-asm-rung3 | PASS, 800 vector / 48 scalar (same on 1.99.0) | +| aarch64 configs pi5 / graviton / apple-m2, `check --lib` | exit 0 (1.100 rejects ABI-altering ARM target features; none of ours do) | +| floor: `cargo +1.99.0 check --workspace --exclude blas-tests --all-targets` | exit 0 | +| safe_intrinsic_probe | unchanged: E0133 on aarch64 / x86-64-v4 without `#[target_feature]`; wasm OK | + +Not run here: masking-parity wasm / wasm-scalar / neon-qemu / avx-qemu / +v2-qemu / nightly, the i686 and s390x cross rows (1.100 changes the x86 "Rust" +ABI to use SSE registers where always available). + +1.100 abilities, measured as compiling on 1.100.1 and E0658 on 1.99.0: +`Allocator` + `Vec::with_capacity_in` (a 64-byte `Align64` allocator probe +gives a 64-aligned `Vec`), `core::mem::DropGuard`, +`Vec::from_fn`, the `!` type. Synergy notes and the probe plan are in the +PR body; nothing adopts them yet (`rust-version` would move to 1.100). + +Loose ends: `OwnedRepr` is a plain `Vec`, so `f32` arrays are 4-byte +aligned while every SIMD backend uses unaligned loads (0 aligned load/store +intrinsics in src/). An aligned-allocator `OwnedRepr` is the candidate; it +needs a split-load benchmark first, never a claim. diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f869d3f08..f421bfa70 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -68,20 +68,23 @@ jobs: matrix: # Must equal `rust-toolchain.toml`'s channel. The version is NOT # restated in this comment on purpose: CI here does NOT read the - # toolchain file (it uses `dtolnay/rust-toolchain@`), so the - # number lives in two places — the matrix entry below and each - # `dtolnay/rust-toolchain@` step — which move together with the + # toolchain file (it uses `dtolnay/rust-toolchain@master` with an + # explicit `toolchain:` input — the action publishes a tag per Rust + # release only after a delay, so `@` can fail to resolve), so + # the number lives in two places — the matrix entry below and each + # `toolchain:` input — which move together with the # toolchain file. The `MSRV`/`BLAS_MSRV` env above tracks # `Cargo.toml`'s `rust-version` floor instead, which can lag the # channel (it did from the 1.99.0 bump). The toolchain file's bump log # records WHY each move happened. rust: - - "1.99.0" + - "1.100.1" name: clippy/${{ matrix.rust }} steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.99.0 + - uses: dtolnay/rust-toolchain@master with: + toolchain: ${{ matrix.rust }} components: clippy - uses: Swatinem/rust-cache@v2 - run: cargo clippy --features approx,serde,rayon -- -D warnings @@ -105,8 +108,9 @@ jobs: # Stable rustfmt on the pinned channel (see `rust-toolchain.toml`; # version deliberately not restated here). No nightly dependency since # rustfmt.toml is stable-clean post-PR #133. - - uses: dtolnay/rust-toolchain@1.99.0 + - uses: dtolnay/rust-toolchain@master with: + toolchain: 1.100.1 components: rustfmt - run: cargo fmt --all --check @@ -238,7 +242,9 @@ jobs: name: hpc-stream-parallel/rayon steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.99.0 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.100.1 - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@nextest - name: cargo check (no rayon — scalar path unchanged) @@ -492,7 +498,9 @@ jobs: name: dr512/epistemic-presence steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.99.0 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.100.1 - uses: Swatinem/rust-cache@v2 - name: Exhaustive codeword, distance, sparse-WHERE and negative-ceiling oracles run: cargo test --test dr512_epistemic_contract diff --git a/CLAUDE.md b/CLAUDE.md index 13094ba3e..cee487946 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -75,7 +75,7 @@ shape is never a reason to write more of it. - **What**: High-performance linear algebra with pluggable BLAS backends (Native SIMD, MKL, OpenBLAS) - **Source**: `adaworldapi/rustynum` — reference GEMM, SIMD, and FFI implementations - **Target**: This repo — ndarray fork enhanced with HPC backends -- **Rust**: stable only — the pinned `rust-toolchain.toml` (1.99.0; `rust-version` in `Cargo.toml` is the floor, 1.98.1). No nightly features on any default or supported build path. +- **Rust**: stable only — the pinned `rust-toolchain.toml` (1.100.1; `rust-version` in `Cargo.toml` is the floor, 1.99.0). No nightly features on any default or supported build path. - **The one documented exception — `nightly-simd` (opt-in, validation-only, since PR #173):** a Cargo feature that swaps the SIMD realization for `core::simd` (`src/simd_nightly/*`, `#![feature(portable_simd)]`) so the realization matrix can witness that backend too. It is never enabled by default, nothing on stable may depend on it, every stable CI row builds without it, and it is exercised only by the dedicated nightly CI rows (`nightly-simd-polyfill`, the `simd-matrix` nightly row) and `scripts/masking-parity.sh nightly`. Removing the feature would drop that backend from the matrix; enabling it anywhere by default would violate this rule. ## Agent Protocol diff --git a/Dockerfile b/Dockerfile index f6e85c28d..ed6bc23ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,8 +27,8 @@ ENV RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ PATH=/usr/local/cargo/bin:$PATH RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ - sh -s -- -y --default-toolchain 1.99.0 --profile minimal \ - && rustc --version | grep -q "1.99.0" + sh -s -- -y --default-toolchain 1.100.1 --profile minimal \ + && rustc --version | grep -q "1.100.1" WORKDIR /app diff --git a/Dockerfile.avx512 b/Dockerfile.avx512 index b29e8b103..68552b5d3 100644 --- a/Dockerfile.avx512 +++ b/Dockerfile.avx512 @@ -21,8 +21,8 @@ ENV RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ PATH=/usr/local/cargo/bin:$PATH RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ - sh -s -- -y --default-toolchain 1.99.0 --profile minimal \ - && rustc --version | grep -q "1.99.0" + sh -s -- -y --default-toolchain 1.100.1 --profile minimal \ + && rustc --version | grep -q "1.100.1" WORKDIR /app diff --git a/README-DE.md b/README-DE.md index e8fe01042..5e4ef541c 100644 --- a/README-DE.md +++ b/README-DE.md @@ -1,6 +1,6 @@ # ndarray — HPC-Erweiterung fuer Rust -*Fork von [rust-ndarray/ndarray](https://github.com/rust-ndarray/ndarray) mit 100 HPC-Modulen, 2,534 bestandenen Bibliothekstests und SIMD-Kernels von Intel AMX bis Raspberry Pi NEON. Laeuft auf stabilem Rust 1.99.0 ohne Nightly-Features.* +*Fork von [rust-ndarray/ndarray](https://github.com/rust-ndarray/ndarray) mit 100 HPC-Modulen, 2,534 bestandenen Bibliothekstests und SIMD-Kernels von Intel AMX bis Raspberry Pi NEON. Laeuft auf stabilem Rust 1.100.1 ohne Nightly-Features.* Zaehlungen bei Commit `f2c1aea`: `pub mod`-Eintraege in `src/hpc/mod.rs`; `cargo test --lib` (2,534 bestanden, 32 ignoriert). Wie jede Zahl auf dieser Seite ermittelt wurde: [Belege](#belege-fuer-die-zahlen-auf-dieser-seite). @@ -197,7 +197,7 @@ cargo test --lib ## Anforderungen -- Rust 1.99.0 stable (festgelegt in `rust-toolchain.toml`; kein Nightly, keine instabilen Features) +- Rust 1.100.1 stable (festgelegt in `rust-toolchain.toml`; kein Nightly, keine instabilen Features) - Optional: gcc-aarch64-linux-gnu fuer Pi-Cross-Kompilierung - Optional: Intel MKL oder OpenBLAS (Feature-gesteuert) diff --git a/README.md b/README.md index deeec44f2..b3bcd9ef0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ndarray — HPC Expansion for Rust -*Fork of [rust-ndarray/ndarray](https://github.com/rust-ndarray/ndarray) with 100 HPC modules, 2,534 passing library tests, and SIMD kernels from Intel AMX to Raspberry Pi NEON. Runs on stable Rust 1.99.0 without nightly features.* +*Fork of [rust-ndarray/ndarray](https://github.com/rust-ndarray/ndarray) with 100 HPC modules, 2,534 passing library tests, and SIMD kernels from Intel AMX to Raspberry Pi NEON. Runs on stable Rust 1.100.1 without nightly features.* Counts at commit `f2c1aea`: `pub mod` entries in `src/hpc/mod.rs`; `cargo test --lib` (2,534 passed, 32 ignored). How every number on this page was obtained: [Evidence](#evidence-for-the-numbers-on-this-page). @@ -197,7 +197,7 @@ cargo test --lib ## Requirements -- Rust 1.99.0 stable (pinned in `rust-toolchain.toml`; no nightly, no unstable features) +- Rust 1.100.1 stable (pinned in `rust-toolchain.toml`; no nightly, no unstable features) - Optional: gcc-aarch64-linux-gnu for Pi cross-compilation - Optional: Intel MKL or OpenBLAS (feature-gated) diff --git a/crates/blas-tests/Cargo.toml b/crates/blas-tests/Cargo.toml index 4b0209ac5..e2ee82cc7 100644 --- a/crates/blas-tests/Cargo.toml +++ b/crates/blas-tests/Cargo.toml @@ -12,7 +12,6 @@ doctest = false [dependencies] ndarray = { workspace = true, features = ["approx", "blas"] } -ndarray-gen = { workspace = true } blas-src = { version = "0.10", optional = true } openblas-src = { version = ">=0.10.11", optional = true } @@ -20,6 +19,7 @@ netlib-src = { version = "0.8", optional = true } blis-src = { version = "0.2", features = ["system"], optional = true } [dev-dependencies] +ndarray-gen = { workspace = true } defmac = "0.2" approx = { workspace = true } num-traits = { workspace = true } diff --git a/crates/numeric-tests/Cargo.toml b/crates/numeric-tests/Cargo.toml index 3e4014d25..6b8e4e9c9 100644 --- a/crates/numeric-tests/Cargo.toml +++ b/crates/numeric-tests/Cargo.toml @@ -12,7 +12,6 @@ doctest = false [dependencies] ndarray = { workspace = true, features = ["approx"] } -ndarray-rand = { workspace = true } approx = { workspace = true } rand = { workspace = true } @@ -22,6 +21,7 @@ blas-src = { optional = true, version = "0.10", default-features = false, featur openblas-src = { optional = true, version = ">=0.10.11", default-features = false, features = ["cblas", "system"] } [dev-dependencies] +ndarray-rand = { workspace = true } num-traits = { workspace = true } num-complex = { workspace = true } diff --git a/crates/p64/Cargo.toml b/crates/p64/Cargo.toml index f36ccce35..8bcd1cbb5 100644 --- a/crates/p64/Cargo.toml +++ b/crates/p64/Cargo.toml @@ -6,9 +6,6 @@ rust-version = "1.99.0" description = "Palette64: 64×64 BNN attention matrix from 8 phyllotactic HEEL planes" license = "MIT OR Apache-2.0" -[dependencies] -fractal = { path = "../fractal", default-features = false } - [dev-dependencies] criterion = { version = "0.5", features = ["html_reports"] } diff --git a/crates/serialization-tests/Cargo.toml b/crates/serialization-tests/Cargo.toml index 7531fc978..0bff39f87 100644 --- a/crates/serialization-tests/Cargo.toml +++ b/crates/serialization-tests/Cargo.toml @@ -11,12 +11,11 @@ doc = false doctest = false [dependencies] -ndarray = { workspace = true, features = ["serde"] } - serde = { version = "1.0.100", default-features = false } -ron = { version = "0.8.1" } [dev-dependencies] +ndarray = { workspace = true, features = ["serde"] } +ron = { version = "0.8.1" } serde_json = { version = "1.0.40" } # >=0.8.11 to avoid rmp-serde security vulnerability # <0.8.14 to allows MSRV 1.64.0 diff --git a/examples/u9_abacus/abacus.rs b/examples/u9_abacus/abacus.rs index f10dbb2ef..a3b946c81 100644 --- a/examples/u9_abacus/abacus.rs +++ b/examples/u9_abacus/abacus.rs @@ -96,8 +96,8 @@ impl Abacus { pub fn value(&self) -> i128 { let mut v = 0i128; for w in 0..COLUMNS { - for k in 0..usize::from(self.n[w]) { - v += i128::from(self.col[w][k].count_ones()) << w; + for plane in &self.col[w][..usize::from(self.n[w])] { + v += i128::from(plane.count_ones()) << w; } } v diff --git a/examples/u9_domino/domino.rs b/examples/u9_domino/domino.rs index f7780d580..1ef5c17bd 100644 --- a/examples/u9_domino/domino.rs +++ b/examples/u9_domino/domino.rs @@ -353,9 +353,9 @@ impl Abacus { #[cold] fn undo(&mut self, start: usize, lanes: u64) { let mut m = lanes; - for k in start..BITS { - let old = self.col[k] ^ m; - self.col[k] = old; + for c in self.col.iter_mut().skip(start) { + let old = *c ^ m; + *c = old; m &= old; if m == 0 { break; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index fcd1dc576..ee322dc05 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.99.0" +channel = "1.100.1" # The pinned version is the `channel` line ABOVE — deliberately not restated # here. This comment used to open "Pinned to 1.97.1", and this file's own # warning explains why that is a trap: "A stale comment on a version pin is how @@ -32,6 +32,19 @@ channel = "1.99.0" # `clippy::manual_contains` x3 (blas-mock-tests), # deprecated `std::f64::NAN` via `use std::f64;` x4 # (tests/numeric.rs). +# 1.99.0 → 1.100.1 current stable (1.100.0 2026-11-12, 1.100.1 2026-11-27); +# stack alignment with lance-graph, OGAR and report-rs. +# Channel ONLY: `rust-version` stays 1.99.0 (no 1.100-only +# API is used). Measured alone first, as an error-SET diff +# of `clippy --workspace --all-targets --keep-going` on +# both toolchains: `needless_bool` (impl_linalg.rs, feature +# blas; it failed the library and hid its dependents), +# `needless_range_loop` x2 (u9 examples) and Cargo's new +# `unused_dependencies` x5 (p64, three test crates) were +# fixed first, clean on both. rustfmt 1.100 splits macro +# arguments after a doc comment (39 sites, accepted by both +# rustfmts). Cargo's new build-dir layout moved `--emit=asm` +# output, so the three asm gates now name their output path. # # Never auto-track `stable` — bump explicitly when a future version is # reviewed and the workspace clippy passes clean. diff --git a/scripts/codec8_asm_diff.sh b/scripts/codec8_asm_diff.sh index 2137f314b..c83ae4d64 100755 --- a/scripts/codec8_asm_diff.sh +++ b/scripts/codec8_asm_diff.sh @@ -5,8 +5,16 @@ set -euo pipefail cfg=() [ $# -ge 1 ] && cfg=(--config "$1") -env -u RUSTFLAGS cargo "${cfg[@]}" rustc --release --example codec8_asm_probe -- --emit asm -C codegen-units=1 >/dev/null -asm=$(ls -t target/release/examples/codec8_asm_probe-*.s | head -1) +# rustc writes the assembly to this exact path: cargo's build directory layout +# is not a stable interface (from Rust 1.100 an `.s` emitted without a path no +# longer lands in `release/examples/`, and the old glob then read a stale file). +# The source is touched so a cached build cannot skip re-emitting it. +asm="${CARGO_TARGET_DIR:-target}/codec8-asm-diff/codec8_asm_probe.s" +mkdir -p "$(dirname "$asm")" +rm -f "$asm" +touch examples/codec8_asm_probe.rs +env -u RUSTFLAGS cargo "${cfg[@]}" rustc --release --example codec8_asm_probe -- --emit "asm=$asm" -C codegen-units=1 >/dev/null +[ -f "$asm" ] || { echo "no .s produced at $asm"; exit 2; } cut() { awk -v f="$1" '$0 ~ "^"f":" {p=1} p {print} p && /\.cfi_endproc/ {exit}' "$asm" \ | sed -E 's/\.(LBB|LCPI|Ltmp|Lfunc_end)[0-9_]+/.L/g; s/\<'"$1"'\>/FN/g'; } status=0 diff --git a/scripts/codegen-witness.sh b/scripts/codegen-witness.sh index 25a7b1d87..ce0e0ee42 100755 --- a/scripts/codegen-witness.sh +++ b/scripts/codegen-witness.sh @@ -30,12 +30,17 @@ EXPECT="${1:?expect: avx512|avx2|neon}" TRIPLE="${2:-$(rustc -vV | sed -n 's/^host: //p')}" ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" TD="${CARGO_TARGET_DIR:-$ROOT/target}" -OUT="$TD/$TRIPLE/ci-codegen/examples" +# rustc writes the assembly to this exact path (`--emit=asm=`). Cargo's +# build directory layout is not a stable interface: from Rust 1.100 an `.s` +# emitted without a path lands under `/build///out/` +# instead of next to the example, which the old `ls -t` glob never found. +ASM="$TD/codegen-witness/$TRIPLE/ternlog_codegen_probe.s" +mkdir -p "$(dirname "$ASM")" cd "$ROOT" -rm -f "$OUT"/ternlog_codegen_probe-*.s +rm -f "$ASM" # Deleting the old .s is only half of "never grade stale assembly": a cached -# build re-emits nothing, so the glob below would find no file at all (it did, +# build re-emits nothing, so there would be no file at all (there was none, # on the first run after the rm landed). Touching the probe source forces the # ONE crate that produces the .s to recompile; the library stays cached. touch "$ROOT/examples/ternlog_codegen_probe.rs" @@ -47,12 +52,11 @@ HOST="$(rustc -vV | sed -n 's/^host: //p')" # WITNESS_NO_RUN=1: build and inspect only, never execute — for a NATIVE triple # on a host that cannot run the arm (an x86-64-v4 build on a runner without # avx512f would SIGILL in the self-check). The assembly assertions still run. -if [ "$TRIPLE" = "$HOST" ] && [ "${WITNESS_NO_RUN:-0}" != "1" ]; then EMIT="asm,link"; else EMIT="asm"; fi +if [ "$TRIPLE" = "$HOST" ] && [ "${WITNESS_NO_RUN:-0}" != "1" ]; then EMIT="asm=$ASM,link"; else EMIT="asm=$ASM"; fi echo "==> building ternlog_codegen_probe (profile ci-codegen, --emit=$EMIT) for $TRIPLE, expecting $EXPECT" # shellcheck disable=SC2086 # CARGO_ARGS is deliberately word-split cargo ${CARGO_ARGS:-} rustc --profile ci-codegen --example ternlog_codegen_probe --target "$TRIPLE" -- --emit="$EMIT" -C debuginfo=0 -ASM="$(ls -t "$OUT"/ternlog_codegen_probe-*.s | head -1)" -[ -f "$ASM" ] || { echo "no .s produced under $OUT"; exit 2; } +[ -f "$ASM" ] || { echo "no .s produced at $ASM"; exit 2; } if [ "$TRIPLE" = "$HOST" ] && [ "${WITNESS_NO_RUN:-0}" != "1" ]; then echo "==> running the probe's self-check natively" diff --git a/scripts/neon-asm-rung3.sh b/scripts/neon-asm-rung3.sh index bd10f9d7d..cb95c42b2 100755 --- a/scripts/neon-asm-rung3.sh +++ b/scripts/neon-asm-rung3.sh @@ -25,15 +25,19 @@ TD="${CARGO_TARGET_DIR:-$ROOT/target-aarch64}" echo "==> emitting aarch64 assembly of neon-simd-parity (link step skipped)" # Stale-assembly guard: remove any previous .s FIRST and let a build failure # fail the script — with `|| true` and suppressed output, a broken build would -# leave an older .s for `ls -t` to pick up and the gate would PASS on assembly +# leave an older .s for the check below to read and the gate would PASS on assembly # that does not match the source (CodeRabbit, PR #306). -rm -f "$TD/$TARGET/release/deps/"neon_simd_parity-*.s +# rustc writes the assembly to this exact path: cargo's build directory layout +# is not a stable interface, and from Rust 1.100 an `.s` emitted without a path +# no longer lands in `release/deps/`. +ASM="$TD/neon-asm-rung3/$TARGET/neon_simd_parity.s" +mkdir -p "$(dirname "$ASM")" +rm -f "$ASM" # A cached build re-emits no .s after the rm, so force the harness crate to # recompile (the library stays cached); see scripts/codegen-witness.sh. touch "$ROOT/crates/neon-simd-parity/src/main.rs" CARGO_TARGET_DIR="$TD" cargo rustc --release --manifest-path "$MANIFEST" --target "$TARGET" \ - -- --emit=asm -C debuginfo=0 -ASM="$(ls -t "$TD/$TARGET/release/deps/"neon_simd_parity-*.s | head -1)" + -- --emit="asm=$ASM" -C debuginfo=0 [ -f "$ASM" ] || { echo "no .s produced"; exit 2; } echo "asm: $ASM" diff --git a/src/hpc/amx_ops.rs b/src/hpc/amx_ops.rs index fe36556e2..599b7d0c7 100644 --- a/src/hpc/amx_ops.rs +++ b/src/hpc/amx_ops.rs @@ -416,57 +416,81 @@ macro_rules! tdp3 { tdp3!( /// `TDPBSSD` — signed i8 × signed i8 → i32 (AMX-INT8). - tdpbssd, "tdpbssd", int8 + tdpbssd, + "tdpbssd", + int8 ); tdp3!( /// `TDPBSUD` — signed i8 (S1) × unsigned u8 (S2) → i32 (AMX-INT8). - tdpbsud, "tdpbsud", int8 + tdpbsud, + "tdpbsud", + int8 ); tdp3!( /// `TDPBUSD` — unsigned u8 (S1) × signed i8 (S2) → i32 (AMX-INT8). The /// kernel's op: [`tdpbusd::<0, 2, 1>`] is the validated `C4 E2 71 5E C2`. - tdpbusd, "tdpbusd", int8 + tdpbusd, + "tdpbusd", + int8 ); tdp3!( /// `TDPBUUD` — unsigned u8 × unsigned u8 → i32 (AMX-INT8). - tdpbuud, "tdpbuud", int8 + tdpbuud, + "tdpbuud", + int8 ); tdp3!( /// `TDPBF16PS` — bf16 × bf16 → f32 (AMX-BF16). [`tdpbf16ps::<0, 2, 1>`] is /// the validated `C4 E2 72 5C C2`. - tdpbf16ps, "tdpbf16ps", bf16 + tdpbf16ps, + "tdpbf16ps", + bf16 ); tdp3!( /// `TDPFP16PS` — fp16 × fp16 → f32 (AMX-FP16, Granite Rapids). /// Assembler-verified only. - tdpfp16ps, "tdpfp16ps", fp16 + tdpfp16ps, + "tdpfp16ps", + fp16 ); tdp3!( /// `TCMMIMFP16PS` — imaginary part of a complex fp16 matrix product → f32 /// (AMX-COMPLEX). Assembler-verified only. - tcmmimfp16ps, "tcmmimfp16ps", complex + tcmmimfp16ps, + "tcmmimfp16ps", + complex ); tdp3!( /// `TCMMRLFP16PS` — real part of a complex fp16 matrix product → f32 /// (AMX-COMPLEX). Assembler-verified only. - tcmmrlfp16ps, "tcmmrlfp16ps", complex + tcmmrlfp16ps, + "tcmmrlfp16ps", + complex ); tdp3!( /// `TDPBF8PS` — E5M2 × E5M2 → f32 (AMX-FP8, Diamond Rapids). /// Assembler-verified only. - tdpbf8ps, "tdpbf8ps", fp8 + tdpbf8ps, + "tdpbf8ps", + fp8 ); tdp3!( /// `TDPBHF8PS` — E5M2 (S1) × E4M3 (S2) → f32 (AMX-FP8). Assembler-verified only. - tdpbhf8ps, "tdpbhf8ps", fp8 + tdpbhf8ps, + "tdpbhf8ps", + fp8 ); tdp3!( /// `TDPHBF8PS` — E4M3 (S1) × E5M2 (S2) → f32 (AMX-FP8). Assembler-verified only. - tdphbf8ps, "tdphbf8ps", fp8 + tdphbf8ps, + "tdphbf8ps", + fp8 ); tdp3!( /// `TDPHF8PS` — E4M3 × E4M3 → f32 (AMX-FP8). Assembler-verified only. - tdphf8ps, "tdphf8ps", fp8 + tdphf8ps, + "tdphf8ps", + fp8 ); /// `TMMULTF32PS` — tf32 × tf32 → f32 (AMX-TF32). CLAIMED — no host has /// executed it. @@ -616,33 +640,51 @@ macro_rules! tile_row_to_zmm { tile_row_to_zmm!( /// `TCVTROWD2PS` — one tile row of 16 × i32 converted to 16 × f32. /// Assembler-verified only. - tcvtrowd2ps, tcvtrowd2ps_imm, "tcvtrowd2ps", core::arch::x86_64::__m512 + tcvtrowd2ps, + tcvtrowd2ps_imm, + "tcvtrowd2ps", + core::arch::x86_64::__m512 ); #[cfg(target_feature = "avx512f")] tile_row_to_zmm!( /// `TCVTROWPS2PHH` — tile row of f32 → fp16, high halves. Assembler-verified only. - tcvtrowps2phh, tcvtrowps2phh_imm, "tcvtrowps2phh", core::arch::x86_64::__m512i + tcvtrowps2phh, + tcvtrowps2phh_imm, + "tcvtrowps2phh", + core::arch::x86_64::__m512i ); #[cfg(target_feature = "avx512f")] tile_row_to_zmm!( /// `TCVTROWPS2PHL` — tile row of f32 → fp16, low halves. Assembler-verified only. - tcvtrowps2phl, tcvtrowps2phl_imm, "tcvtrowps2phl", core::arch::x86_64::__m512i + tcvtrowps2phl, + tcvtrowps2phl_imm, + "tcvtrowps2phl", + core::arch::x86_64::__m512i ); #[cfg(target_feature = "avx512f")] tile_row_to_zmm!( /// `TCVTROWPS2BF16H` — tile row of f32 → bf16, high halves. Assembler-verified only. - tcvtrowps2bf16h, tcvtrowps2bf16h_imm, "tcvtrowps2bf16h", core::arch::x86_64::__m512i + tcvtrowps2bf16h, + tcvtrowps2bf16h_imm, + "tcvtrowps2bf16h", + core::arch::x86_64::__m512i ); #[cfg(target_feature = "avx512f")] tile_row_to_zmm!( /// `TCVTROWPS2BF16L` — tile row of f32 → bf16, low halves. Assembler-verified only. - tcvtrowps2bf16l, tcvtrowps2bf16l_imm, "tcvtrowps2bf16l", core::arch::x86_64::__m512i + tcvtrowps2bf16l, + tcvtrowps2bf16l_imm, + "tcvtrowps2bf16l", + core::arch::x86_64::__m512i ); #[cfg(target_feature = "avx512f")] tile_row_to_zmm!( /// `TILEMOVROW` — one 64-byte tile row moved into a zmm unchanged. /// Assembler-verified only. - tilemovrow, tilemovrow_imm, "tilemovrow", core::arch::x86_64::__m512i + tilemovrow, + tilemovrow_imm, + "tilemovrow", + core::arch::x86_64::__m512i ); // ── Per-tier detection ────────────────────────────────────────────────────── diff --git a/src/linalg/impl_linalg.rs b/src/linalg/impl_linalg.rs index e0b52375d..8be0c2591 100644 --- a/src/linalg/impl_linalg.rs +++ b/src/linalg/impl_linalg.rs @@ -803,10 +803,7 @@ where return false; } let stride = a.strides()[0]; - if stride == 0 || stride > blas_index::MAX as isize || stride < blas_index::MIN as isize { - return false; - } - true + stride != 0 && (blas_index::MIN as isize..=blas_index::MAX as isize).contains(&stride) } #[cfg(feature = "blas")] diff --git a/src/simd_masking_ops.rs b/src/simd_masking_ops.rs index 61db24534..8ac4a9e09 100644 --- a/src/simd_masking_ops.rs +++ b/src/simd_masking_ops.rs @@ -6521,23 +6521,28 @@ pair_cmp_i32!( /// eq_i32_pair_to_mask(&[1, 2, 3], &[1, 0, 3], &mut w); /// assert_eq!(w[0], 0b101); /// ``` - eq_i32_pair_to_mask, |x, y| !(x.gt_bitmask(y) | y.gt_bitmask(x)) + eq_i32_pair_to_mask, + |x, y| !(x.gt_bitmask(y) | y.gt_bitmask(x)) ); pair_cmp_i32!( /// Packs `a[i] < b[i]` over `i32` (signed; ONNX `Less`). - lt_i32_pair_to_mask, |x, y| y.gt_bitmask(x) + lt_i32_pair_to_mask, + |x, y| y.gt_bitmask(x) ); pair_cmp_i32!( /// Packs `a[i] <= b[i]` over `i32` (signed; ONNX `LessOrEqual`). - le_i32_pair_to_mask, |x, y| !x.gt_bitmask(y) + le_i32_pair_to_mask, + |x, y| !x.gt_bitmask(y) ); pair_cmp_i32!( /// Packs `a[i] > b[i]` over `i32` (signed; ONNX `Greater`). - gt_i32_pair_to_mask, |x, y| x.gt_bitmask(y) + gt_i32_pair_to_mask, + |x, y| x.gt_bitmask(y) ); pair_cmp_i32!( /// Packs `a[i] >= b[i]` over `i32` (signed; ONNX `GreaterOrEqual`). - ge_i32_pair_to_mask, |x, y| !y.gt_bitmask(x) + ge_i32_pair_to_mask, + |x, y| !y.gt_bitmask(x) ); macro_rules! pair_cmp_i64 { @@ -6568,23 +6573,28 @@ pair_cmp_i64!( /// eq_i64_pair_to_mask(&[i64::MIN, 2, -3], &[i64::MIN, 0, -3], &mut w); /// assert_eq!(w[0], 0b101); /// ``` - eq_i64_pair_to_mask, |x, y| x.cmpeq_mask(y) + eq_i64_pair_to_mask, + |x, y| x.cmpeq_mask(y) ); pair_cmp_i64!( /// Packs `a[i] < b[i]` over `i64` (signed; ONNX `Less`). - lt_i64_pair_to_mask, |x, y| y.cmpgt_mask(x) + lt_i64_pair_to_mask, + |x, y| y.cmpgt_mask(x) ); pair_cmp_i64!( /// Packs `a[i] <= b[i]` over `i64` (signed; ONNX `LessOrEqual`). - le_i64_pair_to_mask, |x, y| !x.cmpgt_mask(y) + le_i64_pair_to_mask, + |x, y| !x.cmpgt_mask(y) ); pair_cmp_i64!( /// Packs `a[i] > b[i]` over `i64` (signed; ONNX `Greater`). - gt_i64_pair_to_mask, |x, y| x.cmpgt_mask(y) + gt_i64_pair_to_mask, + |x, y| x.cmpgt_mask(y) ); pair_cmp_i64!( /// Packs `a[i] >= b[i]` over `i64` (signed; ONNX `GreaterOrEqual`). - ge_i64_pair_to_mask, |x, y| !y.cmpgt_mask(x) + ge_i64_pair_to_mask, + |x, y| !y.cmpgt_mask(x) ); macro_rules! pair_cmp_f32 { @@ -6617,23 +6627,28 @@ pair_cmp_f32!( /// eq_f32_pair_to_mask(&[1.0, f32::NAN, -0.0], &[1.0, f32::NAN, 0.0], &mut w); /// assert_eq!(w[0], 0b101); /// ``` - eq_f32_pair_to_mask, simd_eq + eq_f32_pair_to_mask, + simd_eq ); pair_cmp_f32!( /// Packs `a[i] < b[i]` over `f32` (ONNX `Less`). - lt_f32_pair_to_mask, simd_lt + lt_f32_pair_to_mask, + simd_lt ); pair_cmp_f32!( /// Packs `a[i] <= b[i]` over `f32` (ONNX `LessOrEqual`). - le_f32_pair_to_mask, simd_le + le_f32_pair_to_mask, + simd_le ); pair_cmp_f32!( /// Packs `a[i] > b[i]` over `f32` (ONNX `Greater`). - gt_f32_pair_to_mask, simd_gt + gt_f32_pair_to_mask, + simd_gt ); pair_cmp_f32!( /// Packs `a[i] >= b[i]` over `f32` (ONNX `GreaterOrEqual`). - ge_f32_pair_to_mask, simd_ge + ge_f32_pair_to_mask, + simd_ge ); macro_rules! scalar_cmp_i64 { @@ -6663,27 +6678,33 @@ scalar_cmp_i64!( /// eq_i64_to_mask(&[-1, 5, -1, i64::MAX], -1, &mut w); /// assert_eq!(w[0], 0b0101); /// ``` - eq_i64_to_mask, |x, t| x.cmpeq_mask(t) + eq_i64_to_mask, + |x, t| x.cmpeq_mask(t) ); scalar_cmp_i64!( /// Packs `values[i] != threshold` over `i64`. - ne_i64_to_mask, |x, t| !x.cmpeq_mask(t) + ne_i64_to_mask, + |x, t| !x.cmpeq_mask(t) ); scalar_cmp_i64!( /// Packs `values[i] < threshold` over `i64` (signed). - lt_i64_to_mask, |x, t| t.cmpgt_mask(x) + lt_i64_to_mask, + |x, t| t.cmpgt_mask(x) ); scalar_cmp_i64!( /// Packs `values[i] <= threshold` over `i64` (signed). - le_i64_to_mask, |x, t| !x.cmpgt_mask(t) + le_i64_to_mask, + |x, t| !x.cmpgt_mask(t) ); scalar_cmp_i64!( /// Packs `values[i] > threshold` over `i64` (signed). - gt_i64_to_mask, |x, t| x.cmpgt_mask(t) + gt_i64_to_mask, + |x, t| x.cmpgt_mask(t) ); scalar_cmp_i64!( /// Packs `values[i] >= threshold` over `i64` (signed). - ge_i64_to_mask, |x, t| !t.cmpgt_mask(x) + ge_i64_to_mask, + |x, t| !t.cmpgt_mask(x) ); /// `dst[i] = if mask bit i { a[i] } else { b[i] }` — the conditional-select diff --git a/tools/safe_intrinsic_probe/Cargo.toml b/tools/safe_intrinsic_probe/Cargo.toml index a3d1f1dfd..123a9cbd2 100644 --- a/tools/safe_intrinsic_probe/Cargo.toml +++ b/tools/safe_intrinsic_probe/Cargo.toml @@ -3,9 +3,9 @@ # after a toolchain bump (the answer is a toolchain property, not a code one): # # cd tools/safe_intrinsic_probe -# RUSTFLAGS="--cfg probe_a" cargo check --target aarch64-unknown-linux-gnu # E0133 on 1.98.1 and 1.99.0 -# RUSTFLAGS="--cfg probe_c" cargo check --target aarch64-unknown-linux-gnu # E0133 on 1.98.1 and 1.99.0 -# RUSTFLAGS="--cfg probe_a3 -Ctarget-cpu=x86-64-v4" cargo check # E0133 on 1.98.1 and 1.99.0 +# RUSTFLAGS="--cfg probe_a" cargo check --target aarch64-unknown-linux-gnu # E0133 on 1.98.1, 1.99.0 and 1.100.1 +# RUSTFLAGS="--cfg probe_c" cargo check --target aarch64-unknown-linux-gnu # E0133 on 1.98.1, 1.99.0 and 1.100.1 +# RUSTFLAGS="--cfg probe_a3 -Ctarget-cpu=x86-64-v4" cargo check # E0133 on 1.98.1, 1.99.0 and 1.100.1 # RUSTFLAGS="--cfg probe_a -Ctarget-feature=+simd128" cargo check --target wasm32-unknown-unknown # OK # # Result matrix and the consequence for the backends: see