Skip to content

Commit

Permalink
GroupMemoryBarrierWithGroupSync only works on groupshared memory - it…
Browse files Browse the repository at this point in the history
… doesn't block on global memory accesses. The fix is to copy the values to be processed by InterlockedAdd into shared array. The previous test ran successfully on Dx11, but broke on Dx12. (#586)
  • Loading branch information
jsmall-zzz authored May 30, 2018
1 parent 8b67c7b commit 8c593ae
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/compute/atomics-groupshared.slang
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ uint test(uint val)
{
uint originalValue;

outputBuffer[val] = 0;
shared[val] = 0;

GroupMemoryBarrierWithGroupSync();

InterlockedAdd(outputBuffer[val], val, originalValue);
InterlockedAdd(outputBuffer[val ^ 1], val*16, originalValue);
InterlockedAdd(outputBuffer[val ^ 2], val*16*16, originalValue);

InterlockedAdd(shared[val], val, originalValue);
InterlockedAdd(shared[val ^ 1], val*16, originalValue);
InterlockedAdd(shared[val ^ 2], val*16*16, originalValue);
GroupMemoryBarrierWithGroupSync();

return outputBuffer[val];
return shared[val];
}

[numthreads(4, 1, 1)]
Expand Down

0 comments on commit 8c593ae

Please sign in to comment.