Skip to content

lance-graph-onnx: Tanh and Exp as ULP-bounded aliases (onnx::bounded) - #1758

Merged
AdaWorldAPI merged 2 commits into
mainfrom
feat/onnx-tanh-alias-20261024
Oct 24, 2026
Merged

AdaWorldAPI merged 2 commits into
mainfrom
feat/onnx-tanh-alias-20261024

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

  • onnx::bounded::tanh_f32 re-exports ndarray::hpc::vml::vstanh, and onnx::bounded::exp_f32 re-exports vml::vsexp. Both are aliases: the symbols are the native functions (pinned by aliases_are_the_native_symbols).
  • They live in a named bounded module, not at the crate root. The root stays exact-only, so a caller cannot pick up a bounded operator by accident. That is the separation the plan's crosswalk asked for.
  • The crate doc's "Exact versus approximate" note now describes this split and names Log and Sigmoid as still unexported.
  • d-onnx-native-v1.md gets a dated note under the crosswalk.

This PR carries the vsneg tripwire fix from #1757 (c5d8ef216), because main is red on that test since ndarray #368. It becomes a no-op once #1757 merges.

Why it is safe now

AdaWorldAPI/ndarray#368 and #369 have merged. Measured against f64 evaluated and rounded once:

  • vstanh is within 1 ULP on all 2³² inputs, odd and monotone, and keeps ±0.
  • vsexp is within 1 ULP on [−104, 89], subnormal results included; ±inf and overflow are exact.

Tests

The conformance tests add:

  • special values over every tail length 0..70: exact bits where the result is a zero, an infinity or NaN; within 2 ULP elsewhere;
  • a log-spaced tanh sweep from 1e-44 to 1e4, both signs, checking oddness and the [−1, 1] bound;
  • an exp sweep over [−104, 90].

Results:

Not done here: graph fusion, and an ONNX Runtime comparison (offline; manifest item D5 in #1757).


Generated by Claude Code

…xed it

vml_vsneg_is_not_onnx_neg_on_positive_zero pinned vsneg(+0) == +0 so it
would fail once ndarray fixed the sign of zero. ndarray #368 did, and
the test fails on main (Rust Tests run 40047762268). The replacement
pins that vsneg and Neg both give -0.0 for +0.0 in the SIMD body and the
tail. Neg stays inline: vsneg is f32-only and writes into a view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
ndarray #368 and #369 bring vml::vsexp and vml::vstanh within 1 ULP of
the correctly rounded result with exact special values. They are
re-exported under onnx::bounded, not at the crate root, so the root
stays exact-only and a caller cannot pick up a bounded operator by
accident. The crate doc's exact-versus-approximate note now says that,
and names Log and Sigmoid as still unexported.

Conformance adds: alias identity for both, special values and every
tail length 0..70 (bit-exact where the result is a zero, infinity or
NaN, else <= 2 ULP of f64 rounded once), a log-spaced tanh sweep from
1e-44 to 1e4 with oddness and the [-1, 1] bound, and exp across
[-104, 90] including subnormal results and overflow.

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

coderabbitai Bot commented Oct 24, 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: a1e95997-58a6-4892-84a1-8ae08aec94c5
  • 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.

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 24, 2026 12:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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-24T12:04:19.655415Z 4b3685e 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 0dcaf8b into main Oct 24, 2026
12 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Oct 24, 2026
…marked shipped

- PR_ARC_INVENTORY: compact entries for #1742–#1758, recorded from each
  merge commit and its changed-file list.
- LATEST_STATE: "main after #1758" section.
- STATUS_BOARD: D-ONNX-NATIVE-0 (#1754), D-DRF-1 (#1756), D-NFR-6 (#1755),
  D-MPF-1 (#1752) and D-ONNX-0 (#1744) were still "In PR" / "this branch";
  now point at their merge commits.
- INTEGRATION_PLANS: index row for six plans merged without one
  (#1745–#1749, #1751).
- d-onnx-relalg-cap-v1 (#1744's S0): owner supersession note adopting
  D-NFC §1/§2 by reference (D-NFC §6 step 1); OP-ONNX-1 marked answered
  by D-NFC §4 + lance-graph-onnx. Which S0 draft carries the adapter
  layer stays open for the three owners.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VncKoyG6JkpsoqhqTGTv3f
AdaWorldAPI added a commit that referenced this pull request Oct 24, 2026
board: catch-up #1742–#1758; #1744 S0 adopts D-NFC; stale In-PR rows marked shipped
This was referenced Oct 24, 2026
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