Skip to content

dr-isa-stream-lab: resolve the virtual object through LaneBinding::borrow_all - #1989

Merged
AdaWorldAPI merged 1 commit into
mainfrom
ccr-8062bcc7-l7lkz9-lab-borrow-all
Nov 10, 2026
Merged

AdaWorldAPI merged 1 commit into
mainfrom
ccr-8062bcc7-l7lkz9-lab-borrow-all

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Follow-up to #1987 and #1988. VirtualObject::resolve now checks the binding once and borrows every bound lane through LaneBinding::borrow_all, then places each lane in the view's row order. Contract: .claude/knowledge/dr-dt64-locality-execution-contract.md (decision EXO-220), added in this PR.

Not for automatic merge.

Why

The old resolve called LaneBinding::addr once per field. addr is a linear scan, so resolving N fields cost N² lookups. That made main slower than #1987 as first measured: the provenance fix added the scan.

Results (one AMX VM, three runs each, median of 41 warm calls)

Resolve 64 fields 256 fields
#1987 as first measured 1.5–1.8 µs 13.8–13.9 µs
main before this PR 3.9–4.2 µs 26–28 µs
borrow_all (this PR) 0.97–1.2 µs 1.6–2.0 µs
lane() per field (baseline only) — 119–170 µs

The ~14 µs check-once figure is preserved, and beaten by about 7×. Raw output: crates/dr-isa-stream-lab/results/shape-2026-11-10-{main-before-borrow-all,borrow-all}-run{1,2,3}.txt. The run-to-run variation on this VM is up to about 35%.

The benchmarks were taken on this code on top of the #1988 branch. After rebasing onto main (which now contains #1988) the code is identical, and the 36 tests pass.

What is kept

  • Field order: lanes are placed in the view's row order, not the binding's field order. Test: resolve_keeps_the_view_row_order.
  • Zero copy: lanes are the source's own slices.
  • No hot-path allocation: lanes go into a fixed [Option<SlabLane>; 256].
  • Refusals: every refusal from borrow_all propagates, Vanished included, so no GEMM arm runs on a partially resolved object. Test: vanished-lane refusal.
  • Existing refusals still hold: stale frame, scope, mapping, basis, coordinate space, foreign lanes, out-of-range selection.
  • Baseline only: resolve_per_field stays, as a benchmark baseline.
  • No API change: no new binding abstraction, no Gather, no copy, and no change to a production API.

Governing question

What does this implementation recompute or reconstruct per operation that it could lawfully resolve once per binding?

Before: the field-to-address lookup, repeated per field. After: one check, one walk over the binding's own address list.

Gates

  • cargo fmt --check: clean.
  • cargo clippy --release --all-targets -D warnings: clean.
  • cargo test --release: 36 passed.
  • Disable runs, each failing as expected:
    • drop the resolve check;
    • swallow the refusals;
    • break the view order.
  • Board entry: .claude/board/entries/2026-11-10-lab-resolve-borrow-all.md.

The INT8 / FACET STRIDE audit follows as a draft stacked on this branch.


Generated by Claude Code

…rrow_all

VirtualObject::resolve now checks the binding once and borrows every bound
lane through LaneBinding::borrow_all (#1988), then places the lanes in the
view's row order. The old resolve called LaneBinding::addr, a linear scan,
once per field, so it was O(N^2) in the field count.

Measured on one AMX VM, three runs each, median of 41 warm calls:
- 256 fields: 1.6-2.0 us, against 26-28 us on main and 13.8-13.9 us in
  #1987 as first measured; lane() per field (kept as a baseline) is
  119-170 us.
- 64 fields: 0.97-1.2 us, against 3.9-4.2 us on main.

Every refusal propagates, a vanished lane included, and nothing reaches a
GEMM arm from a partially resolved object. Field order, zero-copy borrows
and the zero-allocation hot path are kept.

Also adds the DR x DT64 Locality and Execution Contract knowledge doc
(EXO-220), indexed from CLAUDE.md.

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

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

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

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6ac3c582-843a-4c5a-acfe-7d1ba77eb9aa
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T17:12:41.772490Z 7a27ba7 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.

@AdaWorldAPI
AdaWorldAPI merged commit 2b555e4 into main Nov 10, 2026
11 of 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