Skip to content

Commit

Permalink
fix: test according the meaning of __uni_sync()
Browse files Browse the repository at this point in the history
  • Loading branch information
0xzhang committed May 8, 2022
1 parent 137f111 commit e02f89b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tests/python/test_simt.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_unique():
b = ti.field(dtype=ti.u32, shape=32)

@ti.kernel
def foo():
def check():
ti.loop_config(block_dim=32)
for i in range(32):
a[i] = ti.simt.warp.unique(ti.u32(0xFFFFFFFF), b[i])
Expand All @@ -77,18 +77,26 @@ def foo():
b[i] = 0
a[i] = -1

foo()
check()

for i in range(32):
assert a[i] == 0
assert a[i] == 1

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

foo()
check()

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

b[np.random.randint(0, 32)] = 0

check()

for i in range(32):
assert a[i] == 0


@test_utils.test(arch=ti.cuda)
def test_ballot():
Expand Down

0 comments on commit e02f89b

Please sign in to comment.