Repository navigation
add_pm probe: sub_pm as addition of the polarity-negated operand (P2) - #432
Merged
Merged
Conversation
neg_pm flips P on lanes with a magnitude (P_neg = P xor (M != 0)), so the never-touched code and +0 are fixed points and -0 is never produced; sub_pm is add_pm(a, neg_pm(b)) with the same carry contract. Tests: negation of all 512 codewords, all 512 x 512 differences against the i32 oracle with the exact carry count, sub_pm == negate-then-add, the four mandatory cases, and a difference fold with the carry escape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
… record P2 scripts/add-pm-backends.sh builds tests/add_pm.rs for one tier and runs it natively or under qemu, failing when zero tests execute; the SIMD matrix rows for avx2, avx, v2 and neon call it. The knowledge note records sub_pm, its tests and disable controls, the seven tiers it passed on, and the Abakus extraction as the next open item. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
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 15, 2026 10:56
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.
Adds P2, subtraction, to the Codec9
P × Madd probe (examples/add_pm). This is still lab code: no library orcodec9change.The operation
neg_pm(b)flips the polarity bit on every lane that has a magnitude:P_¬b = P_b ⊕ (M_b ≠ 0).+0are therefore fixed points, and−0is never produced.sub_pm(a, b) = add_pm(a, neg_pm(b)). There is no separate subtractor, and the carry contract is the same oneadd_pmhas.Tests (
tests/add_pm.rs, 11 tests, 5 new)i32oracle. The carry count is exact: 65,280, the opposite-polarity pairs with |a| + |b| > 255.sub_pmis bit-identical to negate-then-add on every pair.i64result, and it does carry, so the escape path is exercised.Disable controls (committed first, each red):
Backends
The 11 tests pass on seven tiers:
config-v3config-avx, qemu SandyBridgeconfig-v2, qemu Nehalemtests/add_pm.rsonly in the native nextest job.scripts/add-pm-backends.shbuilds the test binary for one tier and runs it, natively or under qemu.std. A disable run confirmed this guard exits 1.criteriondev-dependency does not build forwasm32-wasip1. They were run once by hand, from a copy of the test file in a crate without dev-dependencies. The first attempt ran 0 tests because thestdgate was missing, and was redone.Cost
Measured in nanoseconds per 64 lanes, best of 50, on the same host.
sub_pmadd_pmi32→ encodeThe AVX2 gap is still the array-backed
U8x64(P3).Next
add_pm/neg_pm/sub_pminto an experimentalndarray::hpc::abakus::pmmodule. Codec9 keeps the representation.xlog-relcomp-probe..claude/knowledge/add-pm-probe.mdis updated with the above.Generated by Claude Code