Skip to content

docs(onnx) S1–S2: semantic intake and minimal RelAlg polyfill plan - #1746

Merged
AdaWorldAPI merged 7 commits into
mainfrom
research/d-onnx-relalg-s1-s2-20261023
Oct 23, 2026
Merged

AdaWorldAPI merged 7 commits into
mainfrom
research/d-onnx-relalg-s1-s2-20261023

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

S1–S2: ONNX semantic intake and typed dispatch onto existing methods

Status: draft planning only; blocked on canonical S0 ownership (#1744/#1745/#1750) and existing OP-ONNX-1 numerical routing decision.

Corrected scope

Keep ModelProto/GraphProto as the ONNX graph, and retain lance-graph-relalg::Rel as a narrow Boolean/selection planning subset under D-RA-2. Do not create Rel::MatMul, Rel::Tanh, a second graph AST or a numerical interpreter. ONNX value semantics dispatch, when admitted, directly to existing numerical methods.

Source-backed assets: AdaWorldAPI/ndarray/src/hpc/vml.rs::vstanh already implements f32 SIMD tanh, reachable from Burn float_tanh. crates/burn/src/ops/matmul.rs already implements ordinary numeric MatMul fallback alongside CompiledAttention/CompiledLinear. crates/bgz-tensor, crates/helix and crates/bgz17 already provide palette/calibration and 256² table math. The missing step is semantic/intake binding, NOT redevelopment of these kernels.

Two modes, not a second proprietary runtime

  • STRICT_NATIVE: allow only a version-pinned supported model subset; whole-model typed refusal otherwise.
  • Delegated model (PROPOSED): explicitly authorized whole-model existing ONNX backend when native rejects; account transfers/safety. Mixed native/delegated graph partition is OPEN until an existing scheduler is proven, not silently built.

P0 identity and numerical admission

Import must preserve exact model/graph/operator/layer, weight/initializer digest, codebook/calibration generation, dtype/shape, state/effects and binding provenance. Shape or d_head alone does not establish safe substitution. The current Burn compiled palette paths are model-specific approximations, not automatically equivalent to ONNX MatMul. Admit them only with separate opt-in error/quality contracts.

Gates: official pinned ONNX schema/IR/opsets and typed refuses, secure external tensor data, differential Tanh and numeric MatMul oracle, same-shape model collision negatives, no new Rel value AST; quality/CI restrictions from EXO-137 and EXO-139. Source inventory in #1749.

Related: #1744, #1750, #1747, EXO-50. No implementation/merge authorized.


New offline-model preparation dependency: #1751

Optimum-ONNX already supplies main_export, model-specific configs, export validation and ORT calibration-data workflow. #1751 documents a separate out-of-tree offline BGZ sidecar frontend; S1 retains semantic import and typed native dispatch. An Optimum exporter success does NOT admit its output as a native or compiled numerical operator. Model, initializer, node/layer and codebook lineage must survive from Optimum export to #1749's identity-safe method binding. First candidate: operator-approved pinned compact BERT MatMul/Gemm layer. No Optimum Python dependency in Rust runtime; #1744/#1745/#1750 S0 conflict remains open.

⊘ Supersession — D-NFC (2026-10-23, operator-approved architecture correction)

Canonical dependency diagram and root assumptions: #1753 (d-native-first-dependency-correction-v1.md); shipped / lab / missing seams: d-native-repr-contract-v1.md there.

P0 invariants. (1) ONNX is an external mathematical compatibility specification; the existing R2IL polyfill is the native starting point; no ONNX graph, Tract runtime or Optimum dependency in the internal execution path. (2) Quack binding + DR64³ + Palette256³ is the intended native representation; existing R2IL, mask-risc, BGZ, Helix and ndarray primitives are reused; implemented components and unimplemented integration contracts are kept apart.

[1] R2IL router (once per ClassId; strategies SHIPPED, #1752) → [2] Quack binding (SHIPPED; store MISSING)
→ [3] DR64³ geometry (LAB; 3rd axis PROPOSED) → [4] Palette256³ (SHIPPED; DR binding MISSING)
→ [5] native execution: mask-risc + ndarray::simd (SHIPPED) → [6] egglog laws (LAB, Boolean only)
→ [7] ONNX conformance adapters (PROPOSED) → [8] Tract/ORT oracles, Optimum (OPTIONAL)

⊘ Layer [1] correction (2026-10-23, #1753 commit ace69d64c, #1752 plan §10). Layer [1] is the R2IL router, which resolves a route once per ClassId: DIRECT or COMPOSE onto ndarray::simd, LOWER to r2sleigh only for machine semantics, or REFUSE. lance-graph-r2il procedures + FoldDialect are one strategy beneath it, not the layer. No operation in this plan needs R2Sleigh.

For this PR:

  1. Native polyfill API first. The existing R2IL polyfill (lab(mpf): D-MPF-1 — the Stage 1 math polyfill already exists; one expression, oracle, refusals, cost split #1752) is native Stage 1 and has no ONNX prerequisite: no importer, no protobuf fork, no target model (root assumption A2).
  2. ONNX semantics are external mappings. This plan's S1/S2 become the ONNX conformance-adapter layer [7] of the canonical diagram: one operator's ONNX definition mapped onto a native call and checked against it. They do not define the native representation (A1).
  3. No internal ONNX graph. GraphProto and the operator schemas do not own the internal computational graph or numerical meaning; native typed operations and compiled R2IL procedures do (A1).
  4. Native fallback. The fallback is the exact native method on the uncompressed data. A whole-model delegated ONNX backend is at most an optional external comparison [8], never the canonical fallback (A4). Approximate methods name their error contract; a rank correlation is not an error bound.
  5. Identity. Internal identity is the native binding (Quack resolution under a sealed frame, plus codebook generation, D-NFR S5/S6/S15). ONNX model / node / initializer identity is external provenance carried by the adapter (A7).

Where this description or the plan says otherwise, it is superseded at the marked ⊘ points (plan commit d27d816a2). Nothing is merged, no ABI or execution contract changes, and the #1744 / #1745 / #1750 S0 dispute is unchanged.

@coderabbitai

coderabbitai Bot commented Oct 23, 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: 98be7e09-4b0a-42e6-95df-b6447d83a12a
  • 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.

Architecture correction approved by the operator on 2026-10-23. Adds one
marked supersession block under the title and inline markers on the
sentences that state a root assumption (A1-A7). Canonical text and the
representation seams are in #1753
(d-native-first-dependency-correction-v1.md, d-native-repr-contract-v1.md).
No other text in this plan changes; the #1744/#1745/#1750 S0 dispute is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 23, 2026 22:12
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T22:13:30.626598Z d27d816 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.

…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
@AdaWorldAPI
AdaWorldAPI merged commit f208540 into main Oct 23, 2026
4 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