Repository navigation
D-PM-STATS: probe what P×M makes cheaper (statistics, comparison, products) - #439
Conversation
…itioned products Research probe, composed from existing ndarray::simd words: no new kernel, API or layout. Oracles: every 512x512 codeword pair for comparison, selection and products; random and boundary blocks for N, S, Q, A. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
The fold reads the register shape a source lends (u8 magnitude slab plus u64 polarity plane) and shares its block function with the tested path. The bench compares against masked_sum_i32, an I16x32 compare and i16 loops, on AVX-512 and AVX2. Findings are in .claude/knowledge/pm-stats-probe.md: the statistical fold is the strong result on AVX-512; signed compare and dot product are not cheaper in ALU work, and the dot product loses badly on AVX2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
|
Warning Review limit reachedYour organization has reached its usage spending cap. Adjust your spending cap in the billing tab. Next included review available in 35 minutes. View limit details
|
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
This is a research probe. It adds no kernel, API or layout: everything is composed from existing
ndarray::simdwords andabakus::pm. It asks which operations get cheaper when polarity and magnitude can be accessed independently. Findings are in.claude/knowledge/pm-stats-probe.md.The idea the results rest on: an untouched lane has
M = 0, so it adds nothing toΣx,Σ|x|,Σx²orΣxy. Only the countNneedstouched. None of these folds needs a validity prefilter, andx²and|x|don't need polarity at all.N,S,QandAcome from one demand-driven fold. Variance is returned as the exact rational(N·Q − S², N²). Two ways of computingSare compared: summing positive and negative magnitudes separately, andΣM − 2ΣM⁻.lt,leandeqare three-valued: each returns the lanes where it holds and a separate mask of undecidable lanes.lt_consthandles a comparison against a constant, andminandmaxare built onlt.Σxyis computed partitioned by product polarity, in two forms.Tests
tests/pm_stats.rshas 11 tests, green on AVX-512 and on the v3 (AVX2) tier. NEON and wasm were not run.The oracles:
lt_constis checked for every constant from −255 to 255;+0, full cancellation, and a nearly constant population with variance 63/4096.Each disable run turns the suite red:
ltignores polarityltwithout the known maskNfrom P aloneSignores polarityprod_sumdrops its high bytex < 0without the touched checkMeasured
Times are ns per 64 lanes, best of 7, from two runs on a shared host. Some cells move 2–3× between runs, so the table gives ranges.
S, 64K lanesmasked_sum_i321.7 at ≤1%, 12 at ≥50%masked_sum_i321.7–4 sparse, 9–20 denseΣM − 2ΣM⁻vs splitN, S, Q, A, 50% selecteda < bI16x323.1–4.2x < 0What this shows:
x < 0is genuinely cheaper.Not captured: the instruction sequences (the arms inlined, so there was no symbol to disassemble), latency as opposed to throughput, other ISA tiers, wider widths, and folding across DR tiles.
Generated by Claude Code