Repository navigation
[ET-VK][test] Allow FP16 underflow in SwiGLU comparisons - #23719
Closed
pytorchbot wants to merge 1 commit into
Closed
pytorchbot wants to merge 1 commit into
pytorchbot wants to merge 1 commit into
Conversation
Pull Request resolved: #23716 ## Ulterior Motive Keep `VulkanSwiGLUTest` correctness checks usable on Vulkan devices that flush FP16 subnormal values to zero. ## Rationale **What**: Increase the absolute error allowances in `MatchesUnfusedAcrossResizes` to account for FP16 underflow. **Why**: On stable, all 28 FP16 configurations fail on Adreno 750 while FP32 passes. The first expected output is `5.30033e-6`, below FP16's minimum normal value, but the shader returns zero. The unfused path can also flush subnormal inputs and intermediate tensors before later multiplications amplify the difference. ## Details - Fused versus CPU reference: - **Before**: Absolute allowance `1e-7`. - **After**: Absolute allowance `2^-14`, FP16's minimum normal value; relative allowance remains `1e-3`. - Fused versus unfused graph: - **Before**: Absolute allowance `6e-8 * (abs(x*y) + abs(y) + 1)` assumes subnormal preservation. - **After**: Keep the original rounding allowance and add `(1 + 1e-3) * abs(reference)` only when an FP16 input is subnormal or a computed intermediate/output can round below the minimum normal value. Use the existing `3e-3` relative tolerance as the rounding margin at that boundary. - If the unfused result flushes to zero, its relative tolerance vanishes. `abs(reference)` covers the lost output, and the extra `1e-3` covers the fused result's relative error. - Cases without underflow keep the small original absolute allowance: `x=20, y=2` gives `2.58e-6`; the original tiny-output case gives about `6.63e-6`. - FP32 uses its existing assertions. Both FP16 comparisons keep `ASSERT_NEAR`. Differential Revision: [D124833698](https://our.internmc.facebook.com/intern/diff/D124833698/) ghstack-source-id: 446951678
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23719
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
This branch was successfully 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.
This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #23716 by @SS-JIA
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/669/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/669/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/669/orig
Differential Revision: D124833698
@diff-train-skip-merge