Commit 167cf98 1 parent 2fad6e2 commit 167cf98 Copy full SHA for 167cf98
File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ def test_unique():
68
68
b = ti .field (dtype = ti .u32 , shape = 32 )
69
69
70
70
@ti .kernel
71
- def foo ():
71
+ def check ():
72
72
ti .loop_config (block_dim = 32 )
73
73
for i in range (32 ):
74
74
a [i ] = ti .simt .warp .unique (ti .u32 (0xFFFFFFFF ), b [i ])
@@ -77,18 +77,26 @@ def foo():
77
77
b [i ] = 0
78
78
a [i ] = - 1
79
79
80
- foo ()
80
+ check ()
81
81
82
82
for i in range (32 ):
83
- assert a [i ] == 0
83
+ assert a [i ] == 1
84
84
85
- b [np .random .randint (0 , 32 )] = 666
85
+ for i in range (32 ):
86
+ b [i ] = i + 100
86
87
87
- foo ()
88
+ check ()
88
89
89
90
for i in range (32 ):
90
91
assert a [i ] == 1
91
92
93
+ b [np .random .randint (0 , 32 )] = 0
94
+
95
+ check ()
96
+
97
+ for i in range (32 ):
98
+ assert a [i ] == 0
99
+
92
100
93
101
@test_utils .test (arch = ti .cuda )
94
102
def test_ballot ():
You can’t perform that action at this time.
0 commit comments