Loosen fp16 atol in ONNX export tests for onnxruntime 1.29 CPU numerics - #3409
Merged
Conversation
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Contributor
Greptile SummaryThe PR makes ONNX-export numerical validation precision-aware to accommodate ONNX Runtime 1.29 CPU fp16 differences while preserving the existing fp32 tolerance.
Confidence Score: 5/5The PR appears safe to merge because the changed tolerance is limited to fp16 comparisons in the identified ONNX tests while fp32 remains unchanged. The helper receives canonical torch dtype parameters, selects the intended fp16 tolerance at every changed call site, and preserves the previous tolerance for fp32; no concrete blocking or non-blocking defect remains. Important Files Changed
Reviews (1): Last reviewed commit: "Loosen fp16 atol in ONNX export tests fo..." | Re-trigger Greptile |
fheinecke
approved these changes
Aug 20, 2026
vthumbe1503
approved these changes
Aug 20, 2026
Collaborator
|
/te-ci L1 pytorch |
Collaborator
|
The CI failures are unrelated to this changeset and should be fixed in #3384 |
fheinecke
pushed a commit
to fheinecke/TransformerEngine
that referenced
this pull request
Aug 20, 2026
…cs (NVIDIA#3409) Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> (cherry picked from commit 17c351c)
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.
Description
L1_pytorch_onnx_unittestfails in nightly CI since 2026-08-18 on the fp16 (precision1) variants oftest_export_linear_recipe,test_export_layernorm_linear_recipeandtest_export_layernorm_mlp. The trigger is the onnxruntime 1.28.0 → 1.29.0 bump in the unpinned CI image: ORT executes the exported graph on the CPU EP, and 1.29 changed fp16 CPU numerics, so the ORT-vs-TE mismatch now reaches up to ~9e-3 (2–9 fp16 ULPs) against the hardcodedatol=1e-3. Verified by A/B on the same TE/torch: ORT 1.28 passes, ORT 1.29 fails; no TE commit is involved.Since the comparison is half-precision GPU (TE) vs half-precision CPU (ORT), differences of a few ULPs from accumulation order are expected and do not indicate an incorrect ONNX representation. This PR makes the tolerance precision-aware:
atol=2e-2for fp16 (the value already used for FP8 CurrentScaling and FP8 MLP in the same file), keeping1e-3for fp32.Type of change
Changes
get_atol(precision)helper intests/pytorch/test_onnx_export.pyreturning2e-2for fp16 and the default1e-3otherwise._test_export_linear,_test_export_layernorm_linear,_test_export_layernorm_mlpand in the DelayedScaling branch of_test_export_layernorm_linear.Checklist:
🤖 Generated with Claude Code