Skip to content

D-CMR-2b probe: no win on whole extents; short runs pay per-run executor cost - #1656

Merged
AdaWorldAPI merged 3 commits into
mainfrom
claude/eager-albattani-iufugq
Oct 21, 2026
Merged

AdaWorldAPI merged 3 commits into
mainfrom
claude/eager-albattani-iufugq

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

This is phase 1 of D-CMR-2b, a lab measurement only. ir.rs, exec.rs and the rest of the library are unchanged.

Background. fused_ternlog declines Pred, so a residual comparison runs on the tiled path through scratch. That scratch is already caller-owned and one tile wide (slots × 256 words), allocated once and never sized to the population. So the question was not heap memory. It was whether per-op tile write-back and the separate And and count passes cost anything measurable.

Probe: crates/lance-graph-benches/examples/pred_scratch_probe.rs. Run it with cargo run --release -p lance-graph-benches --example pred_scratch_probe. It lives in the benches crate, so mask-risc gains no ndarray dev-dependency.

  • Shapes, over i32 lanes:
    • Count(a)
    • Count(a∧b)
    • b gated under a
    • Count(a∧b∧plane)
  • Selectivity: about 1 %, 50 % and 99 %.
  • Workloads:
    • whole: one extent 0..n, with n = 16k, 1M or 4M.
    • runs: set_lower's shape. Over 1M rows, K runs of 200, 3,000 or 40,000 rows at odd starts, together about a quarter of the rows.
  • Arms:
    • A: execute_extent per extent, with reused scratch.
    • A+alloc: Scratch::for_program called once per call.
    • Ac: the program compiled once, then execute_compiled per extent.
    • B: compare into fresh chunks, then one mask_ternlog_popcount.
    • B′: the same fold over reused chunks.
  • Before any timing, each configuration's answer is checked against a bit-serial oracle. The arms are interleaved within each rep in a rotating order, and the reported figure is the median of 101 per-rep ratios. A null arm (A timed twice) measures the method's own noise.

Result, from 3 runs. Each range covers the three selectivities across all three runs.

workload null A+alloc/A Ac/A B′/A
whole 16k 0.989–0.999 1.026–1.090 0.979–1.005 1.06–1.46
whole 1M 0.957–1.012 0.971–1.027 0.971–1.033 0.95–1.20
whole 4M 0.984–1.014 0.989–1.023 0.987–1.011 0.970–1.028
1,310 runs × 200 0.952–1.033 0.981–1.023 0.821–0.948 0.236–0.524
87 runs × 3,000 0.971–0.997 0.989–1.023 0.905–1.027 0.67–1.06
6 runs × 40,000 0.971–0.999 0.985–1.029 0.993–1.029 1.00–1.45

Reading.

  • On whole extents and long runs the fold does not win; it is equal or slower. A Pred lowering arm for whole extents is not supported.
  • On 200-row runs, per-run execute_extent costs about 170–520 ns a run, and the fold is 2.5–4× faster. Compiling once cuts A by only 5–18 %.
  • One possible cause, from reading the code but not attributed by measurement: an unaligned extent runs as a head-edge word, a body and a tail-edge word, each running every op. Every call also validates.
  • The remedy is not decided and not built. The options are fewer edge-tile passes, a run-batched entry point, or a short-run fold.
  • Open: this version's fold is slower at full tiles than the first version of the probe (B′/A 1.06–1.46 against 0.95–1.05 at 16k). The cause isn't found. 64-byte chunk alignment was tested and is not it.

Board: entry entries/2026-10-21-d-cmr-2b-scratch-probe.md; D-CMR-2b rows in STATUS and in the plan; LATEST_STATE. Contract inventory is unchanged.

Coordination: claimed on EXO-50 as session_013z2e1YXkm6o6HNrDn5BPWA/023. Dependencies were confirmed there: ndarray at origin/master 37a3b59, and mask-risc's 47 tests pass against it.

🤖 Generated with Claude Code

https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA

Lab example only; ir.rs and exec.rs are unchanged. pred_scratch_probe
compares today's tiled execute_extent (scratch reused, and scratch
allocated per call) with a fold that compares into chunks and counts
them in one mask_ternlog_popcount, with fresh and with reused chunks.
Every configuration is checked against a bit-serial oracle and arm A
first; timing is interleaved per rep with a null arm.

Result: at most ~5% at one tile on the best shape, 0–4% from 1M rows,
inside the null's spread; slower where no pass is saved. Phase 2 (a
Pred lowering) is not supported.

Board: entry, STATUS and plan rows for D-CMR-2b, LATEST_STATE.

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

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aa2e5fb2-6bd4-4a65-bd3b-b47d461a997e
  • Autofix · 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.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 21, 2026 08:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

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-21T08:19:57.353071Z b39cbac 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.

@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: b39cbac1f7

ℹ️ 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 crates/lance-graph-mask-risc/examples/pred_scratch_probe.rs Outdated
Comment thread crates/lance-graph-mask-risc/examples/pred_scratch_probe.rs Outdated
…r's run-shaped workload

Codex review of #1656: benchmarks belong in lance-graph-benches (AGENTS.md),
and set_lower calls execute_extent once per run over short, unaligned
extents, which whole-extent timing does not cover. The probe now also
times K unaligned runs of 200, 3,000 and 40,000 rows.

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

Adds arm Ac (Program::compile once + execute_compiled per run) to separate
execute_extent's per-call recognition cost from the tile work, and fixes the
three clippy lints the moved example carried.

Measured over 3 runs: no win for the fold on whole extents or 40k-row runs;
on set_lower's 200-row runs per-run execute_extent is 2.5-4x slower than the
fold, and compiling once cuts it by only 5-18 %. Remedy not decided. Entry,
STATUS, plan and LATEST_STATE updated to the new path and result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013z2e1YXkm6o6HNrDn5BPWA
@AdaWorldAPI AdaWorldAPI changed the title D-CMR-2b probe: a scratch-free Pred fold does not pay D-CMR-2b probe: no win on whole extents; short runs pay per-run executor cost Oct 21, 2026
@AdaWorldAPI
AdaWorldAPI merged commit 68cc399 into main Oct 21, 2026
13 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