Repository navigation
D-U9-E5: the U9 power-of-two anchor through vertical masked byte sums (probe) - #393
Merged
Merged
Conversation
E5 keeps E's split |b| = low7 + 128 * bit7 and the two masked low7 byte-dots, and forms the anchor term with U64x8::sum8_u8_add_masked (#390) into two persistent accumulators reduced only at flush. E3, E4, Esum and B are unchanged. Tests: all 511 x 511 pairs, mixed full blocks, all-255 runs past three flush bounds, touched zero, never-touched refusal, scan mode, and one reduction per flush. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMMjKnig6MXTd41Lf2v
bench_e gains E5 rows (end-to-end, arithmetic only, scan), a per-flush cost table for B, E3 and E5, and out-of-line arithmetic loops for B, E3 and E5 so the disassembly shows the steady state. Each loop is checked against the oracle before timing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMMjKnig6MXTd41Lf2v
E5 wins on AVX-512 without VNNI (about 9 % in L1 end to end, repeatable over 8 runs), loses on VNNI because B's fourth byte-dot shares the sign's masked copy while E5 pays a separate mask, SAD and add per sign, and loses on AVX2 to the per-call mask construction. Report with tables, loop disassembly, flush costs, bounds and disable runs; blackboard entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMMjKnig6MXTd41Lf2v
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
AdaWorldAPI
marked this pull request as ready for review
October 29, 2026 23:05
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
# Conflicts: # .claude/blackboard.md
AdaWorldAPI
pushed a commit
that referenced
this pull request
Oct 29, 2026
…1848 Adds section R2. Rows moved: H1 partly closed by #385 (first U16x32 parity found two AVX-512 bugs); H3 reframed (count_ones lowers to the same vpshufb nibble table on AVX2, so a rewrite would only hide it); AVX2 mask_blend set as R2 burn-down item #1 by measurement. New dots N10-N15: the two 9-bit contracts agree across repos; recall and cost were measured on different layouts; the AVX2 masked dot hides compiler-emitted shuffles the source guard cannot see; W4's ndarray half shipped in #386; the u8->i8 view and R3 are one ruling; NEON and wasm lib tests are not in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMPh2Seh2WLccCksAdY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This probe checks #390's facade word in a real consumer. It adds one new candidate,
AccE5, toexamples/u9_abacus/anchor.rs. E5 keeps E's split|b| = low7 + 128·bit7and the two maskedlow7byte-dots, and computes the anchor term in two persistentU64x8::sum8_u8_add_maskedaccumulators, one per sign. These accumulators are reduced only at flush, once everyB_FLUSH_BLOCKS= 16,384 blocks. E3, E4, Esum and B are unchanged. Nothing changes in the facade, the backends, the codecs or the storage format.Answer to the final question: the vertical accumulator makes the anchor cheaper than B's fourth byte-dot only where the byte-dot is not a single instruction.
Overall verdict: DEFER as a general replacement for B. E5 is the best of the four E variants on every tier, and the first E variant that beats B anywhere.
Why
These are the steady-state loop bodies, taken from out-of-line copies of the loops:
a, so the fourth dot costs onevpdpbusd.sign AND bit7, which differs from thelow7mask, so it needs its own zero-masked move, avpsadbwand avpaddqper sign.vpshufband 16vpmuludqper block. E5's loop is 185 instructions, B's is 154. Both spill, because the AVX2 types are array-backed.vpsubqfollowed by one horizontal reduction. Amortized over the flush interval, every candidate's flush costs under 0.003 ns per 64 values.Bounds
low7lane gains at most 129,540 per block, which totals 2,122,383,360 per flush, belowi32::MAX.<< 7stay at most 3.4e10, insidei64.Correctness
5 new tests in
tests/u9_abacus.rs, against #388'si64oracle and against B:AccE5::reductions;The tests pass on native, v4, v3, AVX (qemu), v2 (qemu), aarch64 (qemu) and nightly-simd.
scripts/wasm-parity.shandscripts/neon-parity.shpass. Clippy with-D warningsand rustfmt are clean, and the facet-stride guard reports nothing on the added lines.Six disable runs, each red:
<< 6;X6 is caught only by the reduction counter. An early reduction is a cost defect, not a wrong result, so every exactness test stays green.
Full tables, including E3, E4 and Esum, the streamed and scan rows, and the disassembly, are in
.claude/knowledge/u9-e5-probe.md. This closes fruit U1 from #392.Not in this PR
Generated by Claude Code