Support ONNX opset 20 and faithful tanh GELU lowering - #23
Open
matthargett wants to merge 2 commits into
Open
matthargett wants to merge 2 commits into
matthargett wants to merge 2 commits into
Conversation
matthargett
marked this pull request as ready for review
September 27, 2026 23:31
15 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support standard ONNX opsets 19/20 for implemented operators, including both GELU formulas. This replaces the initial fail-closed patch with tested tanh support.
noneGELU mapped to exact WebNNgelu; lowerapproximate="tanh"to the specifiedmul/add/tanhcomposition. Promote FP16 intermediates to FP32, then cast the result back. Reject malformed attributes and unsupported types.castsignature. Validate unsupported types before file/CLI constant folding.keepdims=0and empty-axis semantics. Unsupported operators and dynamic axes remain explicit errors; accepting opset 20 does not imply complete ONNX coverage.Validation:
9.54e-7, FP166.11e-5.ONNX CTS already defines both formulas; WebNN WPT does not import ONNX. These regressions cover the missing importer boundary. Separately, native exact FP16 GELU under the NPU hint fails upstream ULP limits on this M4/macOS beta; that existing CoreML/harness issue is not a failure of the tanh decomposition and remains tracked in #257.