Repository navigation
simd: power sums and extrema of a u8 lane from per-code counts (neighbour-addition chain) - #428
Merged
Merged
Conversation
…ddition Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNPpoyKDKuAgEnu6HU
masked_code_counts_u8 counts selected rows per code. code_power_sums_u8 turns the 256 counts into n, sum x .. sum x^4, min and max with a chain of five accumulators that each add their neighbour; no value is multiplied per row and no lane wider than the u8 codes is read. masked_first_row_of_code_u8 gives the lowest selected row of a code. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNPpoyKDKuAgEnu6HU
…registration Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNPpoyKDKuAgEnu6HU
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
November 14, 2026 23:07
Codex Review Summary: ✅ CompletedThis 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. |
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.
What
Three functions in
src/simd_masking_ops.rs, re-exported fromndarray::simd:masked_code_counts_u8(values, mask_words, &mut [u64; 256]): for every selected row,counts[code] += 1. Accumulates, so tiles and segments add.code_power_sums_u8(&[u64; 256]) -> Option<CodePowerSums>:n,Σx,Σx²,Σx³,Σx⁴, min and max from the 256 counts.masked_first_row_of_code_u8(values, mask_words, code) -> Option<usize>: the lowest selected row holding a code; with the min or max code this is the row of that extreme.No value is multiplied per row and no lane wider than the
u8codes is read.How the sums are obtained
Walk the bins from 255 down to 1 with five accumulators, each adding its neighbour:
At the end
t2 ..= t5areB_k = Σ_u C(u + k − 1, k) · c[u], andAccumulators are
u128; the largest stays below2^92for anyu64counts. Min and max are the first and last non-empty bin.Validation
The predictions and kill conditions were committed to
.claude/blackboard.mdbefore any code (5def8df); the results entry is above it.Σ counts[u]·u^kmasked_group_bounded_power_sums_u8+widen_bounded_power_sums(n,Σx,Σx²)The map from counts to sums is linear, so exactness on every single-bin table implies exactness on every table (no overflow is possible). That is why the first row is the load-bearing one.
tests/code_power_sums_u8.rs: 10 tests.crates/simd-masking-parity: rows0x8d0,0x8e0,0x8f0. Arms green: native (AVX-512), v3 (AVX2), avx-qemu, v2-qemu, neon-qemu, wasm, wasm-scalar, nightly.Σx³coefficient; theΣx⁴coefficient; bin 0 included in the chain; the tail bound; the dense path reading the wrong byte; flush overwriting; max taken from the front; the row finder without the mask; the row finder without the padding clip.cargo clippy --lib --tests -- -D warnings,cargo fmt --checkand the facet-stride guard are clean.Measured
Unit: microseconds (µs) for one fold over 65,536 rows, one group, unless a cell says ns. Intel Xeon 2.10 GHz, AVX-512, release,
target-cpu=native, minimum of 7 rounds of 200 calls, range over three runs.u8register fold (µs)i32fold (µs)How to read this:
Σx³,Σx⁴, min and max, which the register fold does not produce.Not done
lance-graph-mask-riscorjc.Σxyis not covered.Generated by Claude Code