Skip to content

Commit 761053c

Browse files
committed
Fix test_int64_index_overflow_without_annotation OOM
Signed-off-by: Qiqi Xiao <qiqix@nvidia.com>
1 parent 6fd6ccc commit 761053c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

test/test_array.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@ def test_int64_index_inc1():
9595

9696

9797
def test_int64_index_overflow_without_annotation():
98-
import pytest
99-
x = torch.randn(1, 25165824, 1, 128, device='cuda', dtype=torch.bfloat16)
100-
out = torch.zeros(1, 25165824, 1, 128, device='cuda', dtype=torch.bfloat16)
98+
# Stride > INT32_MAX triggers OverflowError without allocating 6 GiB.
99+
# dim-0 stride 2**32 exceeds INT32_MAX; dim-1 stride 0 keeps storage at 128 elements.
100+
base = torch.zeros(128, device='cuda', dtype=torch.bfloat16)
101+
x = torch.as_strided(base, (1, 25165824, 1, 128), (2**32, 0, 0, 1))
102+
out = torch.as_strided(base, (1, 25165824, 1, 128), (2**32, 0, 0, 1))
101103

102104
@ct.kernel
103105
def kernel(value, out_):

0 commit comments

Comments
 (0)