(status: T.Tensor((num_tiles,), T.int32), out: T.Tensor((1,), T.int32))
| 11 | def 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…