Repository navigation
relax CUDASIM test fp16 intrinsic comparison tolerance. - #10822
Merged
Merged
Conversation
esc
approved these changes
Sep 8, 2026
esc
left a comment
Member
There was a problem hiding this comment.
1e-3 is fine.
The test at:
https://github.com/numba/numba/actions/runs/33952384424/job/101269798444)
shows the following for the log10 usecase:
Mismatched elements: 1 / 32 (3.12%)
Max absolute difference among violations: 0.003906
Max relative difference among violations: 0.0008197
ACTUAL: array([4.797, 4.52 , 4.086, 3.715, 4.51 , 4.7 , 4.64 , 3.893, 4.715,
4.332, 4.516, 4.312, 4.69 , 3.889, 4.64 , 4.496, 4.56 , 4.504,
4.77 , 4.74 , 4.336, 4.656, 4.555, 4.715, 4.81 , 3.926, 4.3 ,
4.574, 4.758, 4.36 , 4.695, 4.434], dtype=float16)
DESIRED: array([4.797, 4.52 , 4.086, 3.715, 4.51 , 4.7 , 4.64 , 3.893, 4.715,
4.332, 4.516, 4.312, 4.69 , 3.889, 4.64 , 4.496, 4.56 , 4.504,
4.766, 4.74 , 4.336, 4.656, 4.555, 4.715, 4.81 , 3.926, 4.3 ,
4.574, 4.758, 4.36 , 4.695, 4.434], dtype=float16)
If you put that in a Python program:
import numpy as np
# ACTUAL vs DESIRED from the failing CI job (fn=log10), numba#10807
actual = np.array([4.797, 4.52, 4.086, 3.715, 4.51, 4.7, 4.64, 3.893, 4.715,
4.332, 4.516, 4.312, 4.69, 3.889, 4.64, 4.496, 4.56, 4.504,
4.77, 4.74, 4.336, 4.656, 4.555, 4.715, 4.81, 3.926, 4.3,
4.574, 4.758, 4.36, 4.695, 4.434], dtype=np.float16)
desired = np.array([4.797, 4.52, 4.086, 3.715, 4.51, 4.7, 4.64, 3.893, 4.715,
4.332, 4.516, 4.312, 4.69, 3.889, 4.64, 4.496, 4.56, 4.504,
4.766, 4.74, 4.336, 4.656, 4.555, 4.715, 4.81, 3.926, 4.3,
4.574, 4.758, 4.36, 4.695, 4.434], dtype=np.float16)
for rtol in (1e-7, 1e-3):
try:
np.testing.assert_allclose(actual, desired, rtol=rtol)
print(f"rtol={rtol}: PASS")
except AssertionError:
print(f"rtol={rtol}: FAIL")
Output (NumPy 2.3.5):
rtol=1e-07: FAIL
rtol=0.001: PASS
So yes, 1e-3 is fine.
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.
Closes #10807