Compute shader memory barrier fun

Started by
19 comments, last by MMONewbie 7 years, 8 months ago

Actually I have tried a few different variations of warp level spinlocks and they all crash the nvidia display driver :-(

This:

if(gl_SubGroupInvocationARB== 0) while(atomicCompSwap(lock, 0, 1) != 0);
Hacking around I got this not to crash but I am not convinced it works:
bool locked = false;
do
{
if(gl_SubGroupInvocationARB == 0) locked = (atomicCompSwap(lock, 0, 1) == 0);
barrier(); // Will crash without barrier
}
while(ballotARB(locked) == 0);

I tried some of the other GLSL spinlocks from google (non warp level) and they seem to freeze due to issues of warp lockstep and divergence.

Neither AMD or Nvidia tools let me step through shaders. Contemplating switching API and it seems that is an issue with Vulkan too on both AMD/Nvidia. The OpenCL debugger for AMD won't let you step through kernels with atomics right now. It seems only CUDA has working debugging tools at the moment :-/

It seems hopeless to debug something like this without using CUDA right now.

This topic is closed to new replies.

Advertisement