Commit bc34dfe
committed
Give workgroup barriers their memory-fence flags
`barrier(0)` lowers to an `OpControlBarrier` with `SequentiallyConsistent`
semantics but no storage-class bit, which the SPIR-V spec treats as
ordering no memory. So shared-local (and global) writes are not
guaranteed visible to other work-items after the barrier, which can
silently drop updates (e.g. a workgroup local-atomic accumulation losing
counts).
Pass the appropriate fence flags so the barrier actually orders memory:
`LOCAL_MEM_FENCE | GLOBAL_MEM_FENCE` for KA `@synchronize` (matching CUDA
`__syncthreads`), and `LOCAL_MEM_FENCE` for the mapreduce reduce_group
shared-memory tree.1 parent 8d49d4a commit bc34dfe
2 files changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
218 | 224 | | |
219 | 225 | | |
220 | 226 | | |
| |||
0 commit comments