Skip to content

D-RPF-9: Fold-Join deforestation probe + three-stage plan update - #1414

Merged
AdaWorldAPI merged 5 commits into
mainfrom
ccr-b2e415d9-4jfvyk-fold-join
Oct 8, 2026
Merged

AdaWorldAPI merged 5 commits into
mainfrom
ccr-b2e415d9-4jfvyk-fold-join

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

This PR adds a probe and a plan update only. No production primitive changes. It asks when two address-aligned membership sources meet in one terminal, which shipped lowering already avoids the intermediate.

  • Probe: crates/lance-graph-quack/examples/fold_join_probe.rs. Every arm runs the shipped mask-risc executor, or quack's lowering into it, against a per-row oracle on 65,536 rows. Every count is asserted; timings are only printed.
  • Board: entries/2026-10-08-fold-join-deforestation-probe.md.
  • Plan: the three stages and D-RPF-9 are added to 2026-10-08-resident-projection-fold-mask-v1.md.

Inventory (read in code)

  • Resident ∧ resident → fold: shipped. fused_ternlog/tern2/tern3 handle up to six resident planes into Count/Any without a slot or bitmap.
  • A Pred in the chain: tiled. There is one 2 KB tile per slot and never a population mask (the tiled law).
  • Quack's two entry points: lower always gates conjuncts under the accumulator. lower_fused never gates.
  • Strided predicates: they have no _under kernel. A gated strided predicate runs in full and is then ANDed.
  • CSD: Quad8::fold_product, MergeMode, the rotated-XOR fingerprint and the f32 superposition are different operations from popcount(A ∧ B), so arm G was not run.

Measured (64K rows, one host, about ±10 % run to run)

case result
resident A ∧ B → Count ~0.4 µs, 0 B scratch (physical slots), no bitmap
Pred A, Pred B, And, Count ~18 µs, about the per-row scalar loop's speed; 0 allocations
B gated under A ~1.4× faster at a dead-word fraction ≥ 0.9, even near 0.5, ~1.4× slower with no dead words
CE64 strided, two predicates 2.1 ms, against 1.0 ms for one
two field predicates in one 16 B window, merged into one pattern 2.47 ms → 1.17 ms, same answer

Scratch is reported from the Scratch that Scratch::for_program actually carves (slots() * words() * 8), so the no-slot lowerings report 0 B.

The CE64 arm matches MaterializedEdges in place and equals the CausalEdge64 accessors:

  • A care shifted by one bit disagrees (227 vs 282).
  • Rewriting every non-care bit leaves the answer unchanged.
  • Disable run: putting edge 2's pattern in the wrong half made the probe answer 263 against the accessors' 282, and the run failed.

Both 16 B windows stay inside the 32 B tenant (row bytes 48..80, one 64 B line each).

Two cases are asserted as must-not-eliminate:

  • A demanded Keep bitmap is written in full and equals the oracle.
  • One intermediate reused by two folds gives |A∧B| + |A∧¬B| = |A|.

BlendI32 over a partial extent is refused.

Proposed rewrite contract (not implemented; each needs its own PR)

  • R2, strided pattern merge.
    • When: two MatchFacet16Strided predicates on the same lane under the same reading.
    • Rewrite: one pattern ((p1 & c1) | (p2 & c2), c1 | c2), but only when (p1 ^ p2) & c1 & c2 == 0. Otherwise the result is the empty mask.
    • Both conditions are load-bearing:
      • Conflicting cares give 0 rows, while a union without the check answered 8,273.
      • A pattern may carry bits outside its own care. With such junk bits, the two predicates answer 258, the masked merge 258, and an OR of unmasked patterns 275 (Codex review on this PR).
  • R3, gate selection. Choose gated or ungated from a known dead-word fraction. The ≈ 0.5 crossover is a pin for this host, not a constant.
  • Gaps for ndarray::simd (T1):
    • G1: strided _under kernel.
    • G2: two-window (32-byte) strided match.
    • G3: tile skip.

Boundaries

Checks

  • cargo clippy -p lance-graph-quack --examples -D warnings: clean.
  • fmt: clean.
  • The probe is green.
  • Disable runs, each red then restored:
    • Wrong-half pattern: 263 vs 282.
    • Unmasked merge: 275 vs 258.
  • causal-edge (zero-dep) is added as an example-only dev-dependency of quack.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R

Summary by CodeRabbit

  • New Features
    • Added a benchmark and correctness probe comparing mask-fold strategies, predicate gating, and pattern merging against reference results.
    • The probe checks edge cases, including conflicting cared bits and partial-extent operations.
  • Documentation
    • Added a report of measured performance, correctness boundaries, and proposed optimizations. These optimizations are documented as proposals, not implemented changes.

claude added 2 commits October 8, 2026 16:25
…intermediate

A probe, not a primitive. Every arm runs the shipped mask-risc executor or
quack's lowering into it, against a per-row oracle, over 64K rows:
resident masks folded directly, predicate chains (ungated and gated),
a resident mask gating a predicate, the Boolean variants, quack's
lower/lower_fused, and CE64 fields read in place from
ValueTenant::MaterializedEdges against the canonical CausalEdge64
accessors. Edge cases, a demanded bitmap, a reused intermediate and a
merge-law refusal are asserted; timings are printed only.

causal-edge becomes an example-only dev-dependency of quack, so the CE64
arm is diffed against the real accessors rather than a restated layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
Board entry for the fold_join_probe results and the capability inventory;
the resident-projection plan gains the three stages (projection, mask,
fold-join), the D-RPF-0 equality status, and D-RPF-9 with its proposed
rewrite contract (R2 strided pattern merge, R3 gate selection) and the
three named T1 gaps. Nothing is implemented beyond the probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Walkthrough

Walkthrough

Adds a benchmark and correctness probe for mask-fold lowering and CE64 strided predicates. It records measurements, tested constraints, and proposed rewrites that are not implemented.

Changes

Fold-Join probe

Layer / File(s) Summary
Probe harness and mask-fold comparisons
crates/lance-graph-quack/examples/fold_join_probe.rs
The probe measures allocations and execution across mask and quack lowering paths. It checks results against a scalar oracle and covers Boolean folds, edge cases, bitmap output, intermediate reuse, and partial-extent refusal.
CE64 strided predicate checks
crates/lance-graph-quack/Cargo.toml, crates/lance-graph-quack/examples/fold_join_probe.rs
The probe compares CE64 strided predicate results with canonical accessors. It checks same-window pattern merging, care-bit conditions, and timings.
Measured findings and rewrite boundaries
.claude/board/STATUS_BOARD.md, .claude/board/entries/*, .claude/plans/2026-10-08-resident-projection-fold-mask-v1.md
The report, plan, and board index record probe results, scope boundaries, and proposed rewrite constraints. R2, R3, and G1–G3 remain unimplemented.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Suggested reviewers: claude

Merge Risk: ⚪ Minimal · up to 91d97

The probe and plan update are mergeable after normal checks; no material issue is established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 1 files. (5 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main changes: the D-RPF-9 Fold-Join deforestation probe and the related three-stage plan update.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 1 files. (5 skipped: 5 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


I’m a rabbit with a test to run,
I count the masks beneath the sun.
Care bits stay within their place,
The oracle checks each measured case.
I hop through folds, then jot results.

Comment @coderabbitai help to get the list of available commands.

member-tests hit its 30-minute limit on main (run 37766947128) and on
#1410, both cut off in the hydrate step. The time went to one binary:
the crossword_real_words_probe example tests (D-PUZZLE-0, added
2026-10-07) ran 810 s at opt-level 0.

The shader-driver test step now passes
--config 'profile.dev.package.cognitive-shader-driver.opt-level=3'.
Only that package is optimized; debug info stays 0 from the manifest
and every other crate keeps the shared opt-level-0 cache. Measured
locally: 184 s for that binary, 4m17 for the whole step including the
compile, all green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R

Copy link
Copy Markdown
Owner Author

member-tests was cancelled at its 30-minute limit on f145f0b9. That is not this PR's failure: the same check times out on main, because the crossword_real_words_probe example tests take 810 s at opt-level 0. Every other check on this head is green.

The fix is #1412: it optimizes only the cognitive-shader-driver test step and leaves debug at 0. With that fix, member-tests passed on #1412 in 26 min.

I ported the same commit here as 7faefd78. Once #1412 merges, it becomes a no-op.


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Add Carrot credits or activate Agent usage billing to use Autopilot

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 8, 2026 17:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7faefd7806

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .claude/board/entries/2026-10-08-fold-join-deforestation-probe.md Outdated
Comment thread crates/lance-graph-quack/examples/fold_join_probe.rs Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T17:41:40.957855Z 7faefd7 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.

claude added 2 commits October 8, 2026 17:42
Conflicts only in the board: STATUS_BOARD's D-RPF-0 row takes main's
test-pinned status (#1413), and the generated entries index is
regenerated with entries_index.py. The plan's D-RPF-0 status note and
the fold-join entry now cite #1413's pinned threshold half instead of
calling it unexercised. The ported #1412 workflow change merged as a
no-op.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
…x P2 ×2)

The scratch column now reports what Scratch::for_program actually carved
(slots × words), so the no-slot lowering prints 0 B instead of the
program's logical slot count.

The R2 pattern-merge law is now (p1 & c1) | (p2 & c2) under the conflict
check: a pattern may carry bits outside its own care, which the matcher
ignores. New falsifier: with junk bits outside edge 1's care, the two
predicates and the masked merge both answer 258, an unmasked OR 275.
Board entry and plan updated to the masked form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔇 Additional comments (7)
crates/lance-graph-quack/examples/fold_join_probe.rs (2)

1-259: LGTM!

Also applies to: 263-1159


260-262: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Remove the stale doc comment on ArmA.

Lines 260-261 describe a function that returns a count and has ma/mb parameters. The doc comment is attached to the ArmA struct. Line 285 already documents run. Keep only line 262.

♻️ Proposed fix
-/// Arm A, all three steps: two `Keep`s into caller masks, then the fold.
-/// Returns the count; `ma`/`mb` are the materialised population masks.
 /// The three programs arm A runs, built once outside the timer.
crates/lance-graph-quack/Cargo.toml (1)

24-27: LGTM!

.claude/board/entries/2026-10-08-fold-join-deforestation-probe.md (1)

1-178: LGTM!

.claude/plans/2026-10-08-resident-projection-fold-mask-v1.md (1)

63-82: LGTM!

Also applies to: 114-119, 300-320

.claude/board/STATUS_BOARD.md (1)

16-16: LGTM!

.claude/board/entries/README.md (1)

28-28: LGTM!

Also applies to: 39-39


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: e98eff35-e78e-4e97-b288-6c0e53809bad
📥 Commits

Reviewing files that changed from the base of the PR and between c58683a and 91d9784.

📒 Files selected for processing (6)
  • .claude/board/STATUS_BOARD.md
  • .claude/board/entries/2026-10-08-fold-join-deforestation-probe.md
  • .claude/board/entries/README.md
  • .claude/plans/2026-10-08-resident-projection-fold-mask-v1.md
  • crates/lance-graph-quack/Cargo.toml
  • crates/lance-graph-quack/examples/fold_join_probe.rs

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 1 review per hour.

@AdaWorldAPI
AdaWorldAPI merged commit d127f7d into main Oct 8, 2026
12 checks passed
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