Skip to content

Commit 167cf98

Browse files
committed
fix: according the meaning of __uni_sync()
1 parent 2fad6e2 commit 167cf98

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

tests/python/test_simt.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_unique():
6868
b = ti.field(dtype=ti.u32, shape=32)
6969

7070
@ti.kernel
71-
def foo():
71+
def check():
7272
ti.loop_config(block_dim=32)
7373
for i in range(32):
7474
a[i] = ti.simt.warp.unique(ti.u32(0xFFFFFFFF), b[i])
@@ -77,18 +77,26 @@ def foo():
7777
b[i] = 0
7878
a[i] = -1
7979

80-
foo()
80+
check()
8181

8282
for i in range(32):
83-
assert a[i] == 0
83+
assert a[i] == 1
8484

85-
b[np.random.randint(0, 32)] = 666
85+
for i in range(32):
86+
b[i] = i + 100
8687

87-
foo()
88+
check()
8889

8990
for i in range(32):
9091
assert a[i] == 1
9192

93+
b[np.random.randint(0, 32)] = 0
94+
95+
check()
96+
97+
for i in range(32):
98+
assert a[i] == 0
99+
92100

93101
@test_utils.test(arch=ti.cuda)
94102
def test_ballot():

0 commit comments

Comments
 (0)