diff options
Diffstat (limited to 'tests/spirv')
| -rw-r--r-- | tests/spirv/coherent-2.slang | 3 | ||||
| -rw-r--r-- | tests/spirv/coherent-texture.slang | 24 | ||||
| -rw-r--r-- | tests/spirv/coherent.slang | 2 |
3 files changed, 29 insertions, 0 deletions
diff --git a/tests/spirv/coherent-2.slang b/tests/spirv/coherent-2.slang index 425ca0fe1..d68b38ad0 100644 --- a/tests/spirv/coherent-2.slang +++ b/tests/spirv/coherent-2.slang @@ -1,6 +1,7 @@ // Test that globallycoherent works on arrays of uavs. //TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main -emit-spirv-directly +//TEST:SIMPLE(filecheck=VK_MEM_MODEL): -target spirv -stage compute -entry main -emit-spirv-directly -capability vk_mem_model globallycoherent RWByteAddressBuffer buffer[]; @@ -14,4 +15,6 @@ void main(int tid : SV_DispatchThreadID) // CHECK-DAG: OpDecorate %buffer Coherent // CHECK-DAG: OpDecorate %[[VAR1:[a-zA-Z0-9_]+]] NonUniform // CHECK: %[[VAR1]] = OpAccessChain %{{.*}} %buffer + + //VK_MEM_MODEL: OpLoad {{.*}} MakePointerVisible|NonPrivatePointer } diff --git a/tests/spirv/coherent-texture.slang b/tests/spirv/coherent-texture.slang new file mode 100644 index 000000000..ab1ce260f --- /dev/null +++ b/tests/spirv/coherent-texture.slang @@ -0,0 +1,24 @@ +//TEST:SIMPLE(filecheck=SPIRV): -target spirv-asm -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=VK_MEM_MODEL): -target spirv-asm -entry computeMain -stage compute -capability vk_mem_model + +//SPIRV: OpDecorate {{.*}} Coherent + +//VK_MEM_MODEL-NOT: OpDecorate {{.*}} Coherent +//VK_MEM_MODEL: OpImageRead %{{.*}} MakeTexelVisible|NonPrivateTexel % +//VK_MEM_MODEL: OpImageWrite %{{.*}} MakeTexelAvailable|NonPrivateTexel % +//VK_MEM_MODEL: OpImageRead %{{.*}} MakeTexelVisible|NonPrivateTexel % +//VK_MEM_MODEL: OpImageWrite %{{.*}} MakeTexelAvailable|NonPrivateTexel % + +globallycoherent +RWTexture2D<int4> outputTexture2D; + +[numthreads(1,1,1)] +void computeMain() +{ + // This line issues kIROp_ImageLoad/Store + outputTexture2D[0].xz = outputTexture2D[0].yw; + + // The current implementation uses spirv_asm for subscription, + // which goes through a different part of implementation in slang-emit-spirv.cpp. + outputTexture2D[uint2(0,0)] = outputTexture2D[uint2(1,1)]; +} diff --git a/tests/spirv/coherent.slang b/tests/spirv/coherent.slang index ba58b713b..33a559700 100644 --- a/tests/spirv/coherent.slang +++ b/tests/spirv/coherent.slang @@ -1,6 +1,7 @@ // Test that globallycoherent works. //TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main -emit-spirv-directly +//TEST:SIMPLE(filecheck=VK_MEM_MODEL): -target spirv -stage compute -entry main -emit-spirv-directly -capability vk_mem_model struct S { @@ -17,4 +18,5 @@ void main(int tid : SV_DispatchThreadID) output[tid] = buffer[0].member; // CHECK-DAG: OpMemberDecorate {{.*}} 0 Coherent // CHECK-DAG: OpDecorate %buffer Coherent + // VK_MEM_MODEL: OpLoad {{.*}} MakePointerVisible|NonPrivatePointer } |
