perf(evolution): ⚡ carry cross-rank queries as a width-adaptive record - #263
Open
diagonal-hamiltonian wants to merge 1 commit into
Open
perf(evolution): ⚡ carry cross-rank queries as a width-adaptive record#263diagonal-hamiltonian wants to merge 1 commit into
diagonal-hamiltonian wants to merge 1 commit into
Conversation
diagonal-hamiltonian
requested review from
fpietra,
ludmilaasb and
robertodr
as code owners
August 20, 2026 20:32
diagonal-hamiltonian
force-pushed
the
pr/query-wire-v3
branch
from
August 20, 2026 20:35
1a7bb1e to
407a6a2
Compare
|
Docs preview: https://pr-263.monoprop-docs.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## perf/epoch-stamp-noshrink-v2 #263 +/- ##
===============================================================
Coverage ? 97.70%
===============================================================
Files ? 14
Lines ? 742
Branches ? 98
===============================================================
Hits ? 725
Misses ? 12
Partials ? 5
Flags with carried forward coverage won't be shown. Click here to find out more. |
diagonal-hamiltonian
marked this pull request as draft
August 21, 2026 07:17
diagonal-hamiltonian
force-pushed
the
pr/query-wire-v3
branch
from
August 21, 2026 08:10
407a6a2 to
dce15d1
Compare
diagonal-hamiltonian
marked this pull request as ready for review
August 21, 2026 08:13
diagonal-hamiltonian
force-pushed
the
pr/query-wire-v3
branch
from
August 21, 2026 08:22
dce15d1 to
d05733a
Compare
Five changes to the layer-build query path, squashed because the middle three share one data structure and the first is not measurable without them. The structural cutoff is decided from a (k, d) digest carried inline rather than from the wider comparison it replaced. Cross-rank queries then travel as a width-adaptive record, dropping the fixed stride the older CompactQuery design assumed. Queries whose owner is this rank resolve from positions instead of going through the cross-rank path at all. Two further changes ride with them and are named here because a reviewer cannot revert along a mechanism the message does not mention. Sink::kStride becomes incoming_layout()/querier_layout(): ContractSink's stride was the fused width while on_response_block was called with the plain buffer and took query_phase's plain-stride default, so the two agreed only by accident, and a wrong layout reads a neighbouring record's phase -- a coefficient sign flip, not a crash. And bulk_insert gains a group-prefetched hashed path, shared by the cross-rank and self inserts. Tests cover the paths that can disagree: a dense reference implementation the sparse path is differentially compared against, the digest's tie cases, the spill boundary where a row exceeds the inline width, and the prefetched insert. OperatorIndex gains a public overflow_size() so a test can assert the dense and positional insert paths spill identically -- the claim this change rests on, and otherwise unreachable from outside the class. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
diagonal-hamiltonian
force-pushed
the
pr/query-wire-v3
branch
from
August 21, 2026 08:25
d05733a to
249aee8
Compare
|
This was referenced Aug 21, 2026
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.



Carry cross-rank queries as a width-adaptive record
pr/query-wire-v3249aee8, on PR 7 (#259)8dbe2a5. One commit, 18 files, +2569/−285.The layer-build query path carried one dense word per 64 modes per query, at a fixed stride. This replaces it with a per-term-minimal record and stops the two paths that never needed the wire from using it.
What changes
monoprop_DIGEST_CUTOFFknob.CompactQuerydesign assumed is gone.Sink::kStridebecomesincoming_layout()/querier_layout(), fixing a latent inconsistency:ContractSink::kStridewas the fused width whileon_response_blockgot the plain buffer and used the plain-stride default — correct only by accident. A wrong layout reads a neighbouring record's phase, which is a coefficient sign flip, not a crash.bulk_insertgains a group-prefetched hashed path, shared by the cross-rank and self inserts.They ship together because 2 and 3 share the
OperatorIndexposition store, and 1 is not measurable without them.Timings
Arms:
main48cadcbvs this branch, bothENABLE_PROFILE=OFF. Stacked, so this is PR 7 + PR 5 — PR 7's own timing was a null in both its campaigns (0 and 1 of 24, all inside 0.98–1.01x), and memory includes its 2 B/term.port/main, so every row below 1.00 is this branch faster. 10 interleaved reps per cell in one allocation, order flipped per (rep, cell); ratios divided per rep then median, never a ratio of medians.rungislower_atol(with Trotter steps where they differ) and separates cells that are different model sizes. No multiplicity correction — one branch against main is not a family — so everypis a raw two-sided sign test.Single thread (1 rank x 1 partition)
build_graph[hubbard]propagate[hubbard]build_graph[pauli]energy[pauli]gradient[pauli]propagate[pauli]Layouts A (1x128) and B (8x16)
build_graph[hubbard]propagate[hubbard]build_graph[pauli]energy[pauli]gradient[pauli]propagate[pauli]build_graph[hubbard]propagate[hubbard]build_graph[pauli]energy[pauli]gradient[pauli]propagate[pauli]build_graph[hubbard]propagate[hubbard]build_graph[pauli]energy[pauli]gradient[pauli]propagate[pauli]build_graph[hubbard]propagate[hubbard]build_graph[pauli]energy[pauli]gradient[pauli]propagate[pauli]Peak RSS (node sum)
hubbard-freshhubbard-freshpauli-freshpauli-graphhubbard-freshhubbard-freshpauli-freshpauli-graphhubbard-freshhubbard-freshpauli-freshpauli-graphhubbard-freshhubbard-freshpauli-freshpauli-graphhubbard-freshhubbard-freshpauli-freshpauli-graphWhat the grid shows, and where it does not
Nothing regresses at any production layout. Across P = 128 and P = 256, both models, all four operations, every resolved cell is a win (0.63–0.99x) and the rest are flat.
build_graphneeds more than one rank — and it is ranks, not partitions, since layouts A and B share the same flat world P. Both models are flat at 1 rank (1.005 7/10, 1.002 6/10) and win from 2 up, but the magnitude diverges: hubbard grows monotonically (1.22x / 1.42x / 1.59x at 2 / 8 / 16), pauli jumps once and saturates (0.938 / 0.949 / 0.947).propagatewins a flat 1.13–1.17x at every rank count from 1 to 16, all four cells resolved, so that share is not the exchange.energyandgradientare a null control inside the same cells. Neither touches the query wire; across the nine cells running them they land in 0.971–1.018, same binary, same allocation, same reps as the rows that moved.The scope limit: the record's fixed per-query cost needs something to amortise against, and at one partition there is nothing. Three of the four single-thread operations regress 1.21–1.54x, 10 of 10 reps each. This is not a narrow-system effect — pauli is the narrow model and it wins 0.92–0.95x once the problem is large (91.3M terms), so the axis is amortisation, not width. The one P = 1 gain,
build_graph[hubbard]at 1.11x, is the digest becoming visible where emit is ~67% of the layer instead of ~12%.The digest itself cannot be confirmed at 128 partitions, where it is ~0.8% of
build_graphwall — below its paired noise floor. Its independent evidence is retired instructions: 0.9128x aroundbuild_graph, 4 of 4 reps, −23.4 per emitted term — a different instrument on an earlier form of this branch, not this campaign.Bit-identity
Determinism holds only at fixed (ranks, partitions) — across partition counts the contract is tolerance-equality — so the geometry is part of the claim. 7 of 7 cells bit-identical at (R × S) in {1x1, 2x1, 2x8, 4x8} across build_graph, propagate and pauli, job
1825793, compared per rank, unmerged, byte for byte. Witnessed on the pre-re-cut form of these commits; it cannot be re-run on this base, because the gate needs each arm to supplybenches/_builders.pyfrom its own checkout and #227 moved those modules into a separate package.Gates and reproducibility
ctest -L unit249/249,-L serial248/248, and the Python MPI suite 592 passed at each of 1x1, 1x16, 2x8 and 8x16.strings -afinds noLAYERPROF/COMMPROF, confirming no profiling instrument is linked, and findsmatched_scratch_bytes, confirming PR 7 is in the base.Not reproducible from this diff. Deucalion, 2x AMD EPYC 7742 / 128 cores / SMT off / NPS4 / 242 GiB per node; a private harness that never ships; two prebuilt venvs, extension md5s
1250a27e(main) andb4e76812(this branch).