Skip to content

Commit f7b9ac7

Browse files
chengjunluThomasRaoux
authored andcommitted
[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]> (cherry picked from commit f4a9d54)
1 parent 717ac9e commit f7b9ac7

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
@@ -2447,7 +2447,12 @@ def kernel(X, Z, BLOCK: tl.constexpr):
24472447
# input
24482448
rs = RandomState(17)
24492449
# limit the range of integers so that the sum does not overflow
2450-
x = numpy_random((shape, ), dtype_str=dtype_str, rs=rs)
2450+
if dtype_str in integral_dtypes:
2451+
low = 0 if dtype_str in uint_dtypes else -100
2452+
high = 100
2453+
x = numpy_random((shape, ), dtype_str=dtype_str, rs=rs, low=low, high=high)
2454+
else:
2455+
x = numpy_random((shape, ), dtype_str=dtype_str, rs=rs)
24512456
numpy_op = {
24522457
'sum': np.sum,
24532458
'max': np.max,

0 commit comments

Comments
 (0)