Skip to content

Teleport probe (D-TELEPORT-0) + W2: IntOr, fused Boolean mode, first procedures (D-SQLP-2) - #1484

Merged
AdaWorldAPI merged 5 commits into
mainfrom
ccr-b576712f-pexwof
Oct 11, 2026
Merged

AdaWorldAPI merged 5 commits into
mainfrom
ccr-b576712f-pexwof

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Two pieces on one branch, in separate commits.

1. Teleport probe (D-TELEPORT-0)

crates/lance-graph-quack/examples/teleport_probe.rs adds no library code. For R(s,o) = K(s,o) AND B(o) it asks whether reading only the rows that can survive actually skips work, or does the same work faster. To tell the two apart, every arm reports work counts taken from the masks themselves, next to its time. Every count is checked against a row-by-row reference.

Arms

  • A scans, joins, then filters.
  • B gathers only the rows that pass K (the existing gated semijoin).
  • C runs on sorted edges only. A binary search (partition_point) finds where K ends, then the gather runs over rows 0..hi. The search is included in C's time, as in S4.
sel_K A B C (incl. search)
0.5 ~1.8 ms ~1.1 ms ~0.8 ms
0.01 ~1.7 ms ~0.19 ms ~14.5 µs
0.0001 ~1.8 ms ~0.17 ms ~0.48 µs
  • B skips foreign reads but still reads every source row.
  • C also skips source reads: the words it visits and the foreign reads it makes both scale with |K|.
  • Shuffled layout (control): K is not a contiguous run of rows, so C cannot be applied.

Intersection. Two row ranges ANDed are lowered today as Range, Range, And: 3 passes and 3 slots. Computing [max lo, min hi) before execution leaves one Range. For COUNT that single range is answered from its two boundaries (hi − lo) and visits no row. That is the ~28 ns figure.

That closed form applies only to COUNT and ANY. A fold that needs the rows (SUM, GROUP_SUM, KEEP, a gated gather) still visits every row of the intersected range; there the rewrite saves two passes and two slots, not the work over the range. No rewrite does this in quack today. The point is that a three-pass computation becomes a property of two boundaries; the speed ratio is secondary.

Sorted compares. A compare on a sorted lane (s < t) takes ~150–190 µs to scan, versus ~0.1 µs for a binary search plus one range. The probe knows the lane is sorted only because it built the fixture that way. A lowering would need the sorted order proven by an order witness, which today exists only for facet lanes.

Timings come from a shared 4-vCPU host and vary by up to ~1.5× between runs. perf is unavailable, so there are no cache-miss numbers.

2. W2 (D-SQLP-2)

  • IntOr: wired. On masks it lowers to MaskOp::Or; on scalars it is a bitwise or.
  • IntAnd of two resident planes: now accepted in the default (in-place) mode as one And, matching the fused mode.
  • BoolMode::Fused: IntAnd/IntOr/IntNot on masks build one BoolExpr. The first consumer lowers it through mask-risc fuse into ternlogs. InPlace remains the default and is unchanged, survivor gating included. The two correspond to quack's lower and lower_fused.
  • procs: filter_lt, select_lt, sum, group_sum and margin, written as Rust functions that emit R2IL calls through Dialect::call. No new opcode.
  • Plan: W2 now names this inlined form. §4 records the decision, and records as OPEN the missing OGAR piece: an executable PROC_DEF/PROC_CALL contract.

Tests: 8 in tests/procs.rs, each checked against a row-by-row reference with 4 groups and empty, partial and full selections. Each of these sabotages turns a test red:

  • KEEP dropped from filter_lt;
  • margin's two sums swapped;
  • IntOr lowered as And (both modes);
  • the fused mode ignored;
  • the plane-AND-plane arm disabled.

Board

  • New entry and regenerated index for D-TELEPORT-0.
  • STATUS_BOARD: D-SQLP-0 and D-SQLP-1 marked Shipped, D-SQLP-2 marked In PR, D-TELEPORT-0 added.

Test plan

  • Probe: every arm matches the row-by-row reference on both layouts; clippy and fmt clean
  • lance-graph-r2il: all tests (7 + 8) pass; clippy --all-targets -D warnings and cargo doc clean
  • r2il-mask-abi-probe suite unchanged
  • CI

🤖 Generated with Claude Code

https://claude.ai/code/session_015JH7YkXs5us6g3tG8NiFfP

…ly reduces it

D-TELEPORT-0. One probe example, no new op or lowering. For
K(s,o) AND B(o) over 1M edges it compares scan/join/filter (A), the
gated-gather semijoin (B) and an extent found by binary search on a
sorted source (C), on clustered and scattered layouts, with work
counters taken from the masks. C's visited words and foreign reads
track |K|; B still reads every source row. The scattered layout is the
control: there C does not exist.

The intersection section measures two row ranges ANDed (three passes,
~10 us) against the precomputed intersection (one fused Range, ~28 ns),
and a sorted-lane compare scanned against its crossing point found by
partition_point. Neither rewrite exists in a lowering today.

Board: entry, index, STATUS_BOARD (D-SQLP-0/1 shipped, D-TELEPORT-0).

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

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 64 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 48e95427-9165-4f38-84b4-a0437b1477e3

📥 Commits

Reviewing files that changed from the base of the PR and between ac3c8fb and 9f23893.


📒 Files selected for processing (9)
  • .claude/board/STATUS_BOARD.md
  • .claude/board/entries/2026-10-11-teleport-probe-source-restriction.md
  • .claude/board/entries/README.md
  • .claude/plans/sql-polyfill-r2il-v1.md
  • crates/lance-graph-quack/examples/teleport_probe.rs
  • crates/lance-graph-r2il/src/lib.rs
  • crates/lance-graph-r2il/src/procs.rs
  • crates/lance-graph-r2il/tests/dialect.rs
  • crates/lance-graph-r2il/tests/procs.rs

  • 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.


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

D-SQLP-2.

- IntOr is wired onto MaskOp::Or for mask operands (slot or resident
  plane) and onto bitwise or for scalars. It is no longer refused.
- BoolMode::Fused collects IntAnd/IntOr/IntNot on masks into one
  BoolExpr; the first consumer lowers it through mask-risc fuse into
  ternlogs. BoolMode::InPlace (default) is unchanged: one op per call,
  with survivor gating. The two mirror quack's lower and lower_fused.
- procs: filter_lt, select_lt, sum, group_sum and margin as Rust
  functions that emit R2IL calls through Dialect::call. No new opcode.
  margin re-emits its selection per SUM, because a fold ends the epoch
  of every earlier slot.

Plan: W2 now names the inlined form, and section 4 records the decision
and the OPEN OGAR item (an executable PROC_DEF/PROC_CALL contract).

Tests (tests/procs.rs): every answer against a row-by-row reference with
four groups and empty, partial and full selections. Disable runs, each
red: KEEP dropped from filter_lt; margin's sums swapped; IntOr lowered
as And in-place; IntOr lowered as And in the fused mode; the fused mode
ignored. r2il-mask-abi-probe's suite is unchanged (6/24/2/8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015JH7YkXs5us6g3tG8NiFfP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015JH7YkXs5us6g3tG8NiFfP
@AdaWorldAPI AdaWorldAPI changed the title quack: teleport probe — does restricting at the source skip work? (D-TELEPORT-0) Teleport probe (D-TELEPORT-0) + W2: IntOr, fused Boolean mode, first procedures (D-SQLP-2) Oct 11, 2026
@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 11, 2026 11:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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-11T11:14:02.307874Z 0ca7cfb 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.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026

Copy link
Copy Markdown

Add Carrot credits or activate Agent usage billing to use Autofix

@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: 0ca7cfb757

ℹ️ 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-r2il/src/lib.rs
Comment thread crates/lance-graph-quack/examples/teleport_probe.rs
… search

- FoldDialect: IntAnd of two resident planes emits one in-place And.
  It was accepted only in the fused mode; now both modes take the same
  mask expressions. Test plane_and_plane_is_accepted_in_both_modes
  (red with the arm disabled).
- teleport_probe: arm C times its partition_point per repetition and
  adds it, as S4 already did. At 0.01% selectivity C goes from ~0.29 us
  to ~0.48 us; the board entry is updated (~370x over B, not ~600x).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015JH7YkXs5us6g3tG8NiFfP
@AdaWorldAPI
AdaWorldAPI merged commit d3064df into main Oct 11, 2026
14 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Oct 11, 2026
D-TELEPORT-1. fold_ranges runs at the top of lower_with, so lower,
lower_fused and lower_group_by all see it. Inside each AND, the direct
children Cmp(col, Range{lo, hi}) sharing a col become one range
[max(lo), max(max(lo), min(hi))), kept at the first one's position.

- Empty intersections stay valid empty ranges (lo == hi), never lo > hi.
- Row-order identity: only ranges on the same col merge; col is the only
  order identity a Filter carries.
- Siblings of one AND only; never across OR or NOT; nested ANDs are not
  flattened.
- A range with lo > hi is not merged, so mask-risc still refuses it. A
  bound past n_rows on the side the intersection drops cannot be seen
  here; the producers that bound ranges never emit one. Documented.

Under COUNT/ANY the single range takes mask-risc's closed form (hi - lo,
no row visited). Under other terminals the survivors are still visited,
minus two passes and two slots.

Tests (range_fold_tests): one op and Lowering::Range for an overlapping
pair; an empty range for a disjoint pair; different columns, OR and NOT
left alone; an inverted range not merged; 400 seeded conjunctions with
planes and lane compares equal to a row-by-row oracle under both
lowerings. Disable runs, each red: hook removed; merge across columns;
min instead of max; no empty clamp; inverted merged; OR merged.
quack full suite and lance-graph-cypher-quack green.

Board: D-TELEPORT-1 row; D-TELEPORT-0 and D-SQLP-2 marked shipped (#1484).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015JH7YkXs5us6g3tG8NiFfP
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