Repository navigation
test(conv): silence the expected fp16 overflow in the cast kernel test - #16
Merged
Merged
Conversation
test_matches_clip_and_astype scales its inputs by 3e4 so some exceed fp16's 65504; the backward cast leaves inputs unclipped, so they must overflow to inf like forward's astype. The NumPy reference cast hit that overflow on the host and printed "RuntimeWarning: overflow encountered in cast" on every GPU run. The reference cast now runs under np.errstate(over="ignore"), scoped to that one line so the clipped dvalues path still warns if it ever overflows. A new assert checks the inputs really exceed the fp16 range, as the existing one does for dvalues, so the overflow half of the test can't silently become an in-range check.
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.
Context
Every GPU run of the suite printed
RuntimeWarning: overflow encountered in castfromtests/ops/test_conv_cast_kernel.py:55, on both the RTX 3050 and the RX 9070 XT. The overflow is intentional, and the warning came from the test's NumPy reference, not from aether. One commit,94d765d, test-only.Behavior changes
None
Testing
python3 -m unittest discover tests: 1142 tests pass on NumPy and CuPy (65 skipped). The overflow warning no longer appears.python3 -W error::RuntimeWarning -m unittest tests.ops.test_conv_cast_kernelpasses, so the cast test doesn't raise the warning anymore.test_matches_clip_and_astypenow asserts that some inputs exceed 65504, so the overflow half of the test can't quietly turn into an in-range check. The reference cast runs undernp.errstate(over="ignore"), scoped to that one line, so the clippeddvaluespath would still warn if it ever overflowed.