Repository navigation
D-ONNX-NATIVE-0: lance-graph-onnx, ONNX names over existing native functions - #1754
Conversation
…NNX-NATIVE-0) The new crate depends on ndarray only. It contains no graph, interpreter, dispatcher, LazyLock/OnceLock or ClassId routing. Each ONNX operator maps to an existing native function in one of two ways. ALIAS (re-exported native symbols): - Abs, Sqrt: hpc::vml. - Greater / GreaterOrEqual / Less / LessOrEqual / Equal on int32 vs a scalar: ndarray::simd *_i32_to_mask. - And / Or / Xor / Not: mask_*. - Where (int32): blend_i32. INLINE (only the semantic work the native call lacks): - Add / Sub / Mul / Div (f32, f64): a shape-only ONNX broadcast check, then ndarray's &a op &b, which broadcasts the same way but panics on a mismatch. - Neg: element map -v. vml::vsneg is not ONNX Neg: its SIMD body returns +0 for +0. - ReduceSum (int32, rank 1): attributes validated once; exact i64 sum with an int32 range refusal. - ReduceSum(Where(Greater(X,T),X,0)): gt_i32_to_mask + masked_sum_i32 into caller scratch, with the same refusal. Conformance tests: - 11 tests, each against an independent per-element reference: special floats, every tail length, broadcasting shapes, refusals. - Alias identity via fn_addr_eq. - The composite cross-checked against mask-risc, the r2il fold reading and relalg. - A test pins the vsneg divergence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
Adds examples/alias_cost.rs: direct native vs ONNX name vs the #1752 wrapper (diagnostic), with a counting allocator and out-of-line probes for asm reading. Marks broadcastable, fit, sum_i32 and sum_where_greater_i32 #[inline], so the composite adapter inlines into the caller and the only extra instructions are the int32 range check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
Adds .claude/plans/d-onnx-native-v1.md: the source-backed ALIAS/INLINE/NATIVE/REFUSE crosswalk, the relalg + mask-risc + r2il cross-check, the direct-vs-onnx-vs-wrapper measurements, the asm reading and the dependency audit. Adds the crate's test and clippy steps to rust-test.yml, a STATUS_BOARD section, an INTEGRATION_PLANS entry and a board entry (index regenerated). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
The CI step added for lance-graph-onnx shifted that line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
[7] sat inside the vertical chain between egglog [6] and Tract [8]. It is a leaf: ONNX names map straight onto existing native functions and no native layer depends on it. lance-graph-onnx (#1754) implements it. The S0 ownership question in §6 stays open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…1754) Marked supersession: 'R2IL polyfill' reads as the R2IL router (D-MPF-4), and [7] is the lance-graph-onnx leaf facade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
…1754) Marked supersession: 'R2IL polyfill' reads as the R2IL router (D-MPF-4), and [7] is the lance-graph-onnx leaf facade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
…1754) Marked supersession: 'R2IL polyfill' reads as the R2IL router (D-MPF-4), and [7] is the lance-graph-onnx leaf facade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
…1754) Marked supersession: 'R2IL polyfill' reads as the R2IL router (D-MPF-4), and [7] is the lance-graph-onnx leaf facade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
…1754) Marked supersession: 'R2IL polyfill' reads as the R2IL router (D-MPF-4), and [7] is the lance-graph-onnx leaf facade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
…-20261023 # Conflicts: # .claude/board/STATUS_BOARD.md # .claude/board/entries/README.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
…-20261023 # Conflicts: # .claude/board/STATUS_BOARD.md # .claude/board/entries/README.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
ONNX is a vocabulary over our existing mathematics, not another execution system. This crate maps ONNX operator names directly onto native functions:
The crate contains:
LazyLock/OnceLock, ClassId routing or per-call backend choice;ndarrayowns the kernels.R2IL routing (D-MPF-4, #1752) is a separate architecture, and this crate does not import it. Plan and crosswalk:
.claude/plans/d-onnx-native-v1.md.What it maps
ALIAS (the native symbol re-exported, pinned by
fn_addr_eq):Abs,Sqrt(vml);Greater/GreaterOrEqual/Less/LessOrEqual/Equal(int32 vs a scalar);And/Or/Xor/Not(packedtensor(bool)masks);Where(int32).INLINE (only the semantic work native lacks):
Add/Sub/Mul/Div: a broadcast check turns ndarray's mismatch panic intoRefusal::Broadcast;Neg;ReduceSum: attributes validated once at construction;int32overflow is refused, not wrapped;ReduceSum(Where(Greater)): the lab(mpf): D-MPF-1 — the Stage 1 math polyfill already exists; one expression, oracle, refusals, cost split #1752 composite.REFUSE (plan §2): integer arithmetic (ONNX leaves overflow undefined), tensor-vs-tensor compares, MatMul, control flow, protobuf import, automatic Palette substitution.
NATIVE, not exported yet (D-ONNX-NATIVE-1): approximate transcendentals, float ReduceSum tolerance, empty-population min/max. Each row names the decision it is waiting on.
Evidence
Conformance: 11 tests and 1 doctest. They cover:
The composite is cross-checked against four independent paths: a plain oracle, a
lance-graph-mask-riscprogram,lance-graph-r2ilFoldDialect, andlance-graph-relalgrun.Disable runs: 4, each red on exactly its own test:
noop_with_empty_axesignored;Measurements (ns per call, AVX-512, median of 21; reported, not gated):
ALIAS and INLINE allocate exactly what direct does: zero, or one for an output array.
Assembly:
int32range check plus theResultwrite;Addadds only the inlined shape loop;Lazy,Once,cpuidor feature probe appears anywhere.Dependencies: the only normal dependency is
ndarray, on mask-risc's coordinate and unified by the root[patch]. Nothing depends on this crate (cargo tree -ishows only itself). mask-risc, r2il, relalg and ogar-loco are dev-dependencies only.Found along the way (for the ndarray owner, not fixed here)
vml::vsneg's 16-lane body computes0.0 - v, soNeg(+0) = +0for n ≥ 16. That is whyNegis INLINE and not an alias.vml::vsexpsaturates +inf to ~3.4e38.Not done
onnx_compatstays as the independent probe.Generated by Claude Code