Skip to content

Commit 3378e35

Browse files
committed
review follow-up: scalar U64x8 IMM guard; avx512 verification measured, not claimed
Codex P2 pair on the record PR, both accepted: - src/simd_scalar.rs: U64x8::ternlog was missing the inline const IMM guard the record marked complete (U32x16 had it) - ternlog::<256> compiled and silently truncated. Guard added, doc paragraph aligned with the every-backend wording. - .claude/blackboard.md: the claim that the avx512 doc examples execute in the doc-test run is retired (default v3 facade resolves the examples to the avx2 types - default-facade coverage, not backend verification). Replaced with a measurement: this host carries avx512f and all five w1a9 facade tests pass under CARGO_BUILD_RUSTFLAGS=-Ctarget-cpu=x86-64-v4 - hardware-executed avx512 runtime verification, recorded as such. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KCGhDYoQBXs3poaR7sFuqp
1 parent e03fbd9 commit 3378e35

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

.claude/blackboard.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,21 @@ named immediates live on the always-compiled facade as
1616
`crate::simd::ternlog` (their first home in the scalar backend was compiled
1717
out on x86 — three bots caught it independently), and every portable arm
1818
carries the avx512-equivalent compile-time IMM domain guard. Doc examples
19-
on all twelve method sites; the avx512 ones execute in this environment's
20-
doc-test run. Declined finding, reasons on the PR thread: extending the
19+
on all twelve method sites.
20+
21+
> **⊘ Correction (2026-08-31, codex P2 pair on the record PR — both
22+
> accepted):** (a) the sentence that stood here claimed the avx512 doc
23+
> examples "execute in this environment's doc-test run" — under the
24+
> default v3 config the examples import the FACADE types, so what runs is
25+
> default-facade coverage, not the avx512 backend; the claim is retired.
26+
> The honest replacement is a MEASUREMENT: this host carries avx512f
27+
> (cpuinfo), and all five w1a9 facade tests pass under
28+
> `CARGO_BUILD_RUSTFLAGS='-Ctarget-cpu=x86-64-v4'` — that run IS the
29+
> avx512 backend's runtime verification, hardware-executed, not inferred.
30+
> (b) the scalar U64x8 ternlog was missing the IMM const guard the entry
31+
> recorded as complete (U32x16 had it; U64x8 did not — `ternlog::<256>`
32+
> compiled and silently truncated). Guard added with the same message as
33+
> every other arm. Declined finding, reasons on the PR thread: extending the
2134
pre-existing off-by-default nightly arm is REQUIRED (not extending it is
2235
the E0599 hole), and the stable-only rule governs the default build graph,
2336
which is untouched. Loose end, deliberate: whole-crate wasm compile-check

src/simd_scalar.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,9 +2071,10 @@ impl U64x8 {
20712071
/// Per bit position: `index = (self << 2) | (b << 1) | c`, result bit =
20722072
/// `(IMM >> index) & 1` — Intel's VPTERNLOG convention, matched exactly by
20732073
/// every backend. `IMM` is `i32` to mirror the intrinsic's signature; only
2074-
/// `0..=255` is legal, enforced at compile time on the AVX-512 backend by
2075-
/// the intrinsic's own static assert. Within that domain: total function,
2076-
/// no lane interaction.
2074+
/// `0..=255` is legal, enforced at compile time on EVERY backend (here by
2075+
/// an inline const assert, on AVX-512 by the intrinsic's own static
2076+
/// assert). Named immediates live in `crate::simd::ternlog`. Within that
2077+
/// domain: total function, no lane interaction.
20772078
///
20782079
/// # Examples
20792080
///
@@ -2085,6 +2086,7 @@ impl U64x8 {
20852086
/// ```
20862087
#[inline(always)]
20872088
pub fn ternlog<const IMM: i32>(self, b: Self, c: Self) -> Self {
2089+
const { assert!(IMM >= 0 && IMM <= 255, "ternlog IMM is an 8-bit truth table") }
20882090
let (a, z) = (self, Self::splat(0));
20892091
let mut r = z;
20902092
if IMM & 0x01 != 0 {

0 commit comments

Comments
 (0)