summaryrefslogtreecommitdiff
path: root/tests/spirv/coherent.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-01-24 15:36:49 -0800
committerGitHub <noreply@github.com>2024-01-24 15:36:49 -0800
commite7b6de334f320429462a0257e2191ccf3cbc9a0d (patch)
tree7e2f6802a2f6fa5217903948efbd994b51e103b7 /tests/spirv/coherent.slang
parentdd57306d951dbcaf6471659fcd1d2c37738f36d0 (diff)
[SPIRV] Support `globallycoherent` and `[vk::index()]`. (#3488)
* [SPIRV] Support `globallycoherent` modifier. * Fix. * Disable executable cooperative vector tests. * Update expected failure. * [SPIRV] Emit varying output index decoration. * Add test. * Update tests. * Fix test. * Emit `SpvExecutionModeEarlyFragmentTests`. * Lower `StructuredBuffer<bool>`. * Support globallycoherent on ByteAddressBuffer. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/spirv/coherent.slang')
-rw-r--r--tests/spirv/coherent.slang20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/spirv/coherent.slang b/tests/spirv/coherent.slang
new file mode 100644
index 000000000..ba58b713b
--- /dev/null
+++ b/tests/spirv/coherent.slang
@@ -0,0 +1,20 @@
+// Test that globallycoherent works.
+
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main -emit-spirv-directly
+
+struct S
+{
+ globallycoherent int member;
+}
+globallycoherent RWStructuredBuffer<S> buffer;
+
+RWStructuredBuffer<float> output;
+[numthreads(4,1,1)]
+void main(int tid : SV_DispatchThreadID)
+{
+ InterlockedAdd(buffer[0].member, 1);
+ AllMemoryBarrier();
+ output[tid] = buffer[0].member;
+ // CHECK-DAG: OpMemberDecorate {{.*}} 0 Coherent
+ // CHECK-DAG: OpDecorate %buffer Coherent
+}