From e02f89bf24b8244346846f599d59481674e9a9cb Mon Sep 17 00:00:00 2001 From: 0xzhang <33616362+0xzhang@users.noreply.github.com> Date: Mon, 9 May 2022 01:42:55 +0800 Subject: [PATCH] fix: test according the meaning of __uni_sync() --- tests/python/test_simt.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/python/test_simt.py b/tests/python/test_simt.py index deed884e43d92..a29221d3735d6 100644 --- a/tests/python/test_simt.py +++ b/tests/python/test_simt.py @@ -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]) @@ -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():