mask-risc: keyed partial-sink merge — MERGE made real (fold-contract Step E) - #1332
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (8)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. 📝 WalkthroughWalkthroughGrouped sum and reduce terminals now support partial-extent execution. Fresh keyed sinks are merged using fold-specific laws, and edge masks are clipped to each extent. Tests cover merge results, refusal cases, and finalization order. Documentation records merge preconditions and related fold contracts. ChangesKeyed Partial-Sink Merge
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant execute_extent
participant GroupedTerminal
participant OutI64Sink
participant TerminalMergeGroupSink
execute_extent->>GroupedTerminal: Run over the extent-clipped mask
GroupedTerminal->>OutI64Sink: Write grouped raw state to a fresh sink
OutI64Sink->>TerminalMergeGroupSink: Provide partial sink
TerminalMergeGroupSink->>OutI64Sink: Merge slots using the fold law
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change is mergeable after normal checks, provided callers honor the documented keyed-sink merge preconditions. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
A rabbit counts each grouped sum, Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 3965ae0c-c499-45e6-aeef-5d145bdb8844) |
a246fef to
166ad06
Compare
…record
Admit GroupSumI32 / GroupSumViaI32 / GroupReduce {Count, MinI32, MaxI32,
SumSymI32} (Lane / Via / Pair keys) on partial extents. Each extent gets a
fresh, re-seeded Out::I64; edge words are clipped in a register, which the
three arms previously did not do (dormant while partial extents were
refused). Partials combine with Terminal::merge_group_sink, applying
GroupFold::merge -- the merge law lives on the IR type that knows the fold:
Count/Sum wrapping_add, Min/Max lattice, _sym SUM the pinned bottom-absorbing
law (never plain +). Every fold's existing overflow semantics is preserved.
All refusals stay preflight; execute_into's contract is unchanged.
tests/keyed_merge.rs: whole == merge of any partition (one / two / many
uneven / empty extents / word, tile and in-word cuts), four orders plus a
tree grouping, whole == row oracle, _sym can-fire cases, finalize-after-merge
vs merge-of-finalized, monoid laws, refusals. Disable runs red: _sym with +,
min as max, empty _sym as 0, unclipped GroupReduce / GroupSumI32 edges.
Board: fold-contract entry (four corrections, planning rules, ISA layering,
DO arm -- working models), TD-SYM-SUM-MERGE resolved with a resolution note,
new OPEN TD-KEYED-SINK-MERGE-IDENTITY-1 (equal length is not semantic
compatibility; to be closed by retained FoldState identity).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCEP2fZdHYdMCtcEVcTpS2
…say so Wording only. The refusal is LenMismatch on different sink lengths; it does not and cannot detect a different semantic destination universe (same length != same universe; TD-KEYED-SINK-MERGE-IDENTITY-1). Doc and test name now say exactly that: merge_refuses_unmergeable_terminals_and_mismatched_sink_lengths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCEP2fZdHYdMCtcEVcTpS2
…te index Wording only, after rebasing onto main (#1331, #1333): - entries/README.md regenerated from the rebased tree (218 rows). - Fold-contract OPEN splits the old "destination resolution" item into A. destination binding / coordinate resolution (frontend / binder; lowers to the existing Local / Via fold; not a missing ndarray primitive) and B. functional route composition beyond depth 2 (substrate / R2IL; chain vs precomposed lane unmeasured). - TD-KEYED-SINK-MERGE-IDENTITY-1 states exactly what merge_group_sink checks (supported keyed i64 terminal, equal length) and adds binding identity, contribution-population identity, and the working law that an ordinal has meaning only inside its destination-space / codebook identity. - merge_group_sink precondition 5 names the binding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCEP2fZdHYdMCtcEVcTpS2
166ad06 to
32226e4
Compare
The rebase resolved each prepend-ledger conflict by keeping both sides, which duplicated blocks that both sides carried. Rebuilt AGENT_LOG, INTEGRATION_PLANS, ISSUES, STATUS_BOARD and TECH_DEBT as main plus only this branch's own insertions, placed below main's newer entries: - TECH_DEBT: drop the stale "OPEN, dormant" TD-SYM-SUM-MERGE-IS-NOT-ADDITION-1 copy (main has it RESOLVED by #1332). - ISSUES: keep main's ISS-CE64-EMIT-INVERSE-BIT2-DISAGREE (harvested from #1303) and drop this branch's earlier copy. - entries/2026-09-30-three-reference-sets-are-not-ordinal-aligned.md: main's corrected version (4 aligned ordinals, not 3). Regenerated the entries index and SUPERSESSION-INDEX. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCEP2fZdHYdMCtcEVcTpS2
Step E makes MERGE real. RETAIN identity is the next contract boundary.
Two populations are folded separately: no source rows are materialised and the two never run as one pass. Their raw sinks are merged, and the result is finalized once. This is the first substrate implementation of the same-type RENDEZVOUS.
This PR is rebased onto
mainafter #1331 and #1333.What changed (mask-risc only)
GroupSumI32,GroupSumViaI32andGroupReduce { Count, MinI32, MaxI32, SumSymI32 }now run on a partial extent, withLane,ViaandPairkeys. Each extent gets a fresh, re-seededOut::I64.GroupFold::mergeholds the per-slot law. It lives on the IR type that already knows the fold kind.Terminal::merge_group_sinkapplies that law across a whole sink.What
merge_group_sinkchecks, exactlyIt checks two things, and on failure writes nothing:
i64terminal (otherwiseExtentUnsupported);LenMismatch).Equal K is not semantic compatibility. The merge does NOT prove:
All of these are explicit, unchecked caller preconditions in the method's docs. They are tracked under
TD-KEYED-SINK-MERGE-IDENTITY-1.Overflow algebra
Each fold keeps exactly its existing semantics.
wrapping_addwrapping_add(as the kernel)min/max(the seed is the lattice identity)⊥⊕x = x,x⊕⊥ = x,⊥⊕⊥ = ⊥, otherwisewrapping_add. Never plain+.GROUP_SUM_SYM_MAX_ROWSReport's
FoldState::mergeagrees with every row.Errors
precheck/validate), before the sink is seeded. None of them can fail during traversal.execute_into's contract is unchanged.Gates
All green on the rebased tree: the full mask-risc suite,
keyed_merge,clippy -D warnings,fmt, the board gates and the entries index (218 rows).tests/keyed_merge.rscovers:Whole equals merged partitions for 14 terminal × key combinations at two tile widths. Partitions:
Each split is merged in four orders plus a balanced tree.
Whole equals the row oracle.
Anti-vacuity: a group live in two partials, a group live in exactly one, an empty group, an empty extent, and a cut that splits a live word.
_symcan-fire cases:⊥⊕x,x⊕⊥,⊥⊕⊥, and a real zero ≠ ⊥.Finalize after merge is correct. Merging already-finalized slots is shown to be wrong.
Monoid laws on extremes. The
_symrow bound is shown to be load-bearing.merge_refuses_unmergeable_terminals_and_mismatched_sink_lengths.Disable runs were re-run on the rebased tree. Each mutation turned the suite red, and the suite was green again after restoring:
Board
entries/2026-10-05-fold-contract-and-keyed-sink-merge.md. It records the fold contract, the planning rules, the ISA layering and the DO arm. Everything except Step E is a working model and is not built. Its OPEN section, aligned with merged report: name the real gap (destination binding for Report); record why GroupAddr::Pair is not the pivot model #1331, separates:Local/Viakeyed fold. It is not a missing ndarray / fold primitive.TD-SYM-SUM-MERGE-IS-NOT-ADDITION-1is resolved. A resolution note marks its old body as historical rationale.TD-KEYED-SINK-MERGE-IDENTITY-1. It is to be closed by the retained FoldState identity contract, not by metadata bolted onto this merge.Note
citation_decay.pyexits 1 locally both with and without this PR's latest edits, with identical output, and the CIcitation-decaycheck is green. The earlierno_allocflake was fixed independently by #1333, which is now in the base.🤖 Generated with Claude Code
https://claude.ai/code/session_01DCEP2fZdHYdMCtcEVcTpS2