summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-05-30 11:32:26 -0400
committerGitHub <noreply@github.com>2018-05-30 11:32:26 -0400
commit8c593ae0d9894d79295a8e739ac9a33a0e149d4c (patch)
tree043bc0ee6538ab0f6d0ab517abd94eb8f8af7c6a
parent8b67c7b3fc163156a02a40430f7038ab2f199924 (diff)
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)
-rw-r--r--tests/compute/atomics-groupshared.slang12
1 files 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)]