From 8c593ae0d9894d79295a8e739ac9a33a0e149d4c Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 30 May 2018 11:32:26 -0400 Subject: GroupMemoryBarrierWithGroupSync only works on groupshared memory - it 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) --- tests/compute/atomics-groupshared.slang | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/compute/atomics-groupshared.slang b/tests/compute/atomics-groupshared.slang index 7ac6809eb..4b86e1b9e 100644 --- a/tests/compute/atomics-groupshared.slang +++ b/tests/compute/atomics-groupshared.slang @@ -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)] -- cgit v1.2.3