I have a case where barrier() isn’t causing any synchronization unless there is a single access to shared memory regardless if that access is used or not.
So I have a number of blocks in my computer shader where I access global memory from SSBO both by atomic and non-atomic reads and writes. Each block is protected by a
pair. The code works perfectly if I place a write to a single dummy shared variable at the top of the shader that isn’t used anywhere else otherwise it fails because not all memory writes has finished before next block reads. I can’t see any other way than this is a compiler bug. Spir-v disassembly includes the same synchronization in both cases.
It’s a single workgroup with 1024 threads.
Geforce 1080 ti on 531.79