Skip to content

pm_stats: vertical byte accumulator probe arm - #440

Merged
AdaWorldAPI merged 2 commits into
masterfrom
ccr-85acaff0-oszq40-pm-vertical
Nov 25, 2026
Merged

AdaWorldAPI merged 2 commits into
masterfrom
ccr-85acaff0-oszq40-pm-vertical

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Follow-up to #439. Its findings note named a vertical byte-sum accumulator as the missing piece. This adds one as a probe arm, built only from existing ndarray::simd words. No new primitive, API or layout.

What. sum_abs_vertical widens each masked magnitude block into U16x32 partials and reduces horizontally once per 128 blocks. A tile of 128 is the bound: each block adds up to 2 × 255 to every u16 lane, so the worst case is 2 × 255 × 128 = 65_280.

Tests. One new oracle test (12/12 green) covers:

  • 1 block;
  • exactly one tile;
  • three tiles plus 5 blocks;
  • every lane at −255 for a tile plus one block.

Disable run: with a tile of 129 the bound case wraps and the test fails.

Measured for S and A together, 50% selection, in ns per 64 lanes. Two runs per tier on a shared host:

horizontal per block vertical per tile
AVX-512, L2-resident 2.97–3.56 2.15–2.73
AVX-512, 16M lanes 5.59–6.41 4.83–5.49
AVX2, L2-resident 7.6–9.6 8.0–10.9
AVX2, 16M lanes 7.7–11.0 9.7–16.6

On AVX-512 the vertical form is 20–27% faster. On AVX2 it is no better, and usually worse, because the U16x32 widen and add each run as two halves. A vertical accumulator is therefore a choice for each backend, not a rule for all of them.

Not built: a vpsadbw that returns its U64x8 partials, which would avoid the widening on both tiers. No such word exists today.

Findings are recorded in .claude/knowledge/pm-stats-probe.md.


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review November 25, 2026 16:39
@AdaWorldAPI
AdaWorldAPI merged commit 7370c70 into master Nov 25, 2026
21 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T16:40:32.515396Z 2098b0f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

AdaWorldAPI added a commit that referenced this pull request Nov 25, 2026
…ials

pm_stats: S/A over the existing masked SAD word; correct #440's "no such word"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants