[TLE] Stabilize FP16 cumsum correctness test#844
Open
sunnycase wants to merge 4 commits into
Open
Conversation
sunnycase
marked this pull request as ready for review
July 24, 2026 07:43
sunnycase
dismissed stale reviews from i3wanna2, Galaxy1458, and zhzhcookie
via
July 24, 2026 08:36
09bf751
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.
Background
test_tle_cumsum_exclusive_and_totaluses random normal FP16 inputs and compares the result of Triton's parallel scan against a PyTorch reference with fixed tolerances. This made the test intermittently fail in local and CI runs even though repeated launches with the same input were deterministic.Root cause
Both
tl.cumsumandtle.cumsumkeep FP16 inputs in FP16 during accumulation. Their parallel scan tree can round differently from the PyTorch reference. Depending on the randomly generated input, the difference can slightly exceed the fixedatol=2e-2, rtol=2e-2threshold.A sweep over seeds 0 through 5000 reproduced the failure for 64 of 5001 inputs. For every failing seed,
tle.cumsumand nativetl.cumsumproduced bit-identical results, confirming that this was a test stability issue rather than a TLE-specific race or lowering error.Fix
Generate bounded integer-valued inputs for the FP16 correctness case and cast them to FP16. With values in
[-2, 2], every prefix sum in the tested block remains exactly representable in FP16. This preserves coverage of the FP16 lowering path while making the correctness assertion independent of parallel scan accumulation order.FP32 and BF16 cases continue to use random normal inputs.
Validation
python -m pytest -q python/test/tle/unit/test_tle_cumsum.py: 12 passed, 1 skipped