Skip to content

Commit f4a9d54

Browse files
[NFC] Limit the range of integers so that the sum does not overflow in reduce test case (#7470)
Our CI hit an overflow issue in reduce test case with Triton Interpreter. ``` FAILED language/test_core.py::test_reduce1d[4-1-1-sum-int32-32] - triton.runtime.errors.InterpreterError: InterpreterError("OverflowError('Python integer -4736833654 out of bounds for int32')") FAILED language/test_core.py::test_reduce1d[4-1-1-sum-int32-64] - triton.runtime.errors.InterpreterError: InterpreterError("OverflowError('Python integer -17340316748 out of bounds for int32')") FAILED language/test_core.py::test_reduce1d[4-1-1-sum-int32-128] - triton.runtime.errors.InterpreterError: InterpreterError("OverflowError('Python integer -15950412024 out of bounds for int32')") FAILED language/test_core.py::test_reduce1d[4-1-1-sum-int32-512] - triton.runtime.errors.InterpreterError: InterpreterError("OverflowError('Python integer 6080852592 out of bounds for int32')") ``` There is a comment in the test_reduce1d about limiting the range of Integers in case overflow but without actual code. Add the limitation as the comment. --------- Signed-off-by: Lu,Chengjun <[email protected]> Co-authored-by: Thomas Raoux <[email protected]>
1 parent 1748b81 commit f4a9d54

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

python/test/unit/language/test_core.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,12 @@ def kernel(X, Z, BLOCK: tl.constexpr):
25172517
# input
25182518
rs = RandomState(17)
25192519
# limit the range of integers so that the sum does not overflow
2520-
x = numpy_random((shape, ), dtype_str=dtype_str, rs=rs)
2520+
if dtype_str in integral_dtypes:
2521+
low = 0 if dtype_str in uint_dtypes else -100
2522+
high = 100
2523+
x = numpy_random((shape, ), dtype_str=dtype_str, rs=rs, low=low, high=high)
2524+
else:
2525+
x = numpy_random((shape, ), dtype_str=dtype_str, rs=rs)
25212526
numpy_op = {
25222527
'sum': np.sum,
25232528
'max': np.max,

0 commit comments

Comments
 (0)