MCPcopy Create free account
hub / github.com/tile-ai/tilelang / kernel

Function kernel

testing/python/issue/test_tilelang_issue_2123.py:13–31  ·  view source on GitHub ↗
(status: T.Tensor((num_tiles,), T.int32), out: T.Tensor((1,), T.int32))

Source from the content-addressed store, hash-verified

11def issue_2123_atomic_load_repro(num_tiles, threads=32):
12 @T.prim_func
13 def kernel(status: T.Tensor((num_tiles,), T.int32), out: T.Tensor((1,), T.int32)):
14 with T.Kernel(num_tiles, threads=threads) as tile:
15 look = T.alloc_var(T.int32)
16 state = T.alloc_var(T.int32)
17 done = T.alloc_var(T.bool)
18 tx = T.get_thread_binding()
19 if tx == 0:
20 look = tile - 1
21 done = look < 0
22 state = 0
23 while not done:
24 state = T.atomic_load(status[look], memory_order="acquire")
25 if state != 0:
26 done = True
27 else:
28 look -= 1
29 done = look < 0
30 if tile == num_tiles - 1:
31 out[0] = state
32
33 return kernel
34

Callers

nothing calls this directly

Calls 1

get_thread_bindingMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…