Skip to content

D-TRACT-HARVEST-0: the ONNX graph as a DR#3 graph through the DT64 ON×WHEN×DO registry (lab probe) - #1850

Merged
AdaWorldAPI merged 9 commits into
mainfrom
ccr-0161f442-un1mrc
Oct 30, 2026
Merged

AdaWorldAPI merged 9 commits into
mainfrom
ccr-0161f442-un1mrc

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Lab probe crates/tract-harvest-probe (its own workspace, excluded; no native crate depends on it). It reads an ONNX graph as a graph and resolves each node through the DT64 ON × WHEN × DO schema. Tract is used only as a cold typing frontend.

  • Graph. Every ONNX node is an Identity position and every value a Property position, on one 64×64 DR#3 tile. on and do_ are Rows relations, and dep = do_ ∘ read_by is computed with dr_math_binding_probe::relcomp::compose. Ordered arguments are kept beside the relations, because ONNX operands are positional.
  • Registry. Each op signature (domain, op_type, dtype, attribute rules, opsets) maps to one immutable lab classid (0x0F01..0x0F51).
    • WHEN is a three-valued (K3) guard over Tract's facts and the constant operands; UNKNOWN never counts as TRUE.
    • DO is an existing lance-graph-onnx / ndarray function; no new kernels.
    • An unregistered signature is refused.
  • Plan. The plan resolves once, schedules from dep, and is sealed in a FrameStore frame (source digest, registry version, coordinates). run checks the frame and then routes each node to its DO.

This replaces the fixed admission recipes from the first version of this PR (admit.rs removed), following the correction "We want the graph … resolve to polyfill and predicate methods in DT64 'on when do'". Plan §0 has the full design.

Results (against ORT with ORT_DISABLE_ALL, the literal semantics)

  • Tiny fixture: bit-exact, including the 256-input div3 sweep. Where(c, X, 1) now runs and returns 17: there is no rewrite to refuse, because Where and ReduceSum are separate methods.
  • Jina v5 small, layer-0 input RMSNorm (13 nodes through the graph): 9,259 of 10,240 outputs exact, max 4 ULP. ReduceMean is the only Bounded method. Every row whose mean is bit-exact is bit-exact on all of its outputs.
  • Full model coverage (7,620 nodes): 3,751 resolve with WHEN TRUE, including all 113 RMSNorms. 169 are registered but WHEN is not TRUE: Tract's typed stage labels only 2,546 of the 7,620 outputs, so those facts are UNKNOWN and refused. 3,700 have no registration; the largest groups are Unsqueeze, Shape, Gather, Concat and MatMul.
  • Refusals, each with its own test:
    • impossible broadcast → When { False }
    • Erf and com.example:Abs → Unregistered (the domain is part of the signature)
    • Pow exponent other than 2 → When { False }
    • f16 or f64 cast → Unregistered
    • shapes removed → When { Unknown }
    • new source or registry generation → Frame(SourceChanged / MapChanged)
    • int32 overflow → refused at run time
  • Disable runs: 7, each red on exactly the named test. They cover the broadcast guard, the Pow guard, attribute rules, the domain key, the frame check, UNKNOWN-as-TRUE, and schedule from source order.
  • Cost (reported, not gated): resolve 7–12 µs. The hot plan takes 3.4 µs on the tiny graph (Tract 3.6 µs) and 14.9 µs on the Jina slice (Tract 113 µs).

Open

  • Graphs with more than 64 positions need several tiles.
  • Facts for the values Tract leaves unlabelled.
  • Registrations for the shape-plumbing ops and f32 MatMul.
  • Constants are cloned on every run.
  • The classids are lab-local; minting them in OGAR is a separate decision.

Test plan

  • cargo fmt, cargo clippy --release --all-targets -D warnings
  • cargo test --release --no-fail-fast -- --include-ignored: 20 passed (Jina tests need python3 tools/fetch_jina_slice.py; CC-BY-NC weights are never committed)
  • 7 disable runs, each red on the named test
  • examples/stages (full-model coverage) and examples/cost

🤖 Generated with Claude Code

https://claude.ai/code/session_01XAqKMMjKnig6MXTd41Lf2v

…e methods

New lab crate crates/tract-harvest-probe (own workspace, excluded from the
lance-graph workspace; no native crate depends on it). Tract parses and types
an ONNX graph; admission matches a fixed pattern on the typed graph, takes
domain/opset/initializer identity from the raw protobuf, and prepares a
concrete recipe that calls only lance-graph-onnx and ndarray. ORT, with its
graph optimizer off, is the independent oracle.

Fixture A (tiny, committed): bit-exact with ORT; negatives for shape,
unsupported op, foreign domain, invalid rewrite, stale weight generation and
int32 overflow. Fixture B: layer 0's input RMSNorm of the Jina v5 small
retrieval export, fetched by SHA-pinned byte ranges (CC-BY-NC weights are
never committed); native output bit-exact except the one row whose mean
differs by 1 ulp.

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

Tract types an impossible broadcast symbolically and fails only at run time;
the shape test now asserts that and the native Broadcast refusal. A Cast
widened to f64 keeps the op pattern intact, so only the dtype check can
refuse it; the half-precision control could not show that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMMjKnig6MXTd41Lf2v
…, ledger, next PRs)

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

coderabbitai Bot commented Oct 30, 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: 619033d5-0716-4c94-81aa-f6919eb641b7
  • 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

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

…stry

Replaces the fixed admission recipes. Every ONNX node is an Identity
position, every value a Property position; ON/DO are 64x64 relations and
the schedule is read from dep = do_ ∘ read_by. Each node binds by op
signature (domain, op_type, dtype, attributes) to one immutable lab
classid whose WHEN is a K3 guard over Tract's facts and whose DO is an
existing lance-graph-onnx / ndarray function. Plans are sealed in a
FrameStore frame (source digest, registry version, coordinates).

Tiny fixture bit-exact vs ORT literal incl. the 256-input div3 sweep;
Where(c, X, 1) now runs (17). Jina layer-0 RMSNorm through the graph:
9259/10240 exact, max 4 ulp, the mean the only Bounded method. Full
model coverage: 3751 WHEN-true, 169 WHEN-not-true, 3700 unregistered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMMjKnig6MXTd41Lf2v
…s source-known)

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

Plan §0 (design, results, refusals, disable table, cost, OPEN), board
entry, STATUS_BOARD row, INTEGRATION_PLANS status; entries index and
supersession index regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMMjKnig6MXTd41Lf2v
@AdaWorldAPI AdaWorldAPI changed the title D-TRACT-HARVEST-0: Tract as a cold ONNX frontend, admitted onto native methods (lab) D-TRACT-HARVEST-0: the ONNX graph as a DR#3 graph through the DT64 ON×WHEN×DO registry (lab probe) Oct 30, 2026
# Conflicts:
#	.claude/board/entries/README.md
@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 30, 2026 07:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-30T07:28:24.775070Z 5da7678 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: 5da7678ce8

ℹ️ 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/tract-harvest-probe/src/plan.rs Resolved
@AdaWorldAPI
AdaWorldAPI merged commit a011e8b into main Oct 30, 2026
13 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Oct 30, 2026
…onent must not grow the base

Codex P2 (#1850): run() bound caller inputs without checking the facts
the WHEN guards held on, so X as [2,3] reached the rank-1 ReduceSum DO
and was summed flat. Inputs are now refused unless they are graph inputs
with the resolved dtype, rank and known dims.

Codex P2: guard_pow2 checked only the exponent's values; do_pow2
ignores the exponent, so a broadcasting exponent ([1] ^ [2]) gave the
wrong output shape. WHEN now also requires broadcasting e against x to
leave x's shape unchanged (FALSE, or UNKNOWN for a symbolic base dim).

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