summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/metal/groupshared.slang31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/metal/groupshared.slang b/tests/metal/groupshared.slang
new file mode 100644
index 000000000..4d1f6ecac
--- /dev/null
+++ b/tests/metal/groupshared.slang
@@ -0,0 +1,31 @@
+//TEST:SIMPLE(filecheck=CHECK): -target metal
+//TEST:SIMPLE(filecheck=CHECK-ASM): -target metallib
+
+uniform RWStructuredBuffer<float> outputBuffer;
+
+struct MyBlock
+{
+ StructuredBuffer<float> b1;
+ StructuredBuffer<float> b2;
+}
+ParameterBlock<MyBlock> block;
+
+groupshared int myArr[16];
+
+void func(float v)
+{
+ outputBuffer[0] = myArr[0];
+}
+
+// CHECK: array<int, int(16)> threadgroup* myArr{{.*}};
+// CHECK: {{\[\[}}kernel{{\]\]}} void main_kernel
+// CHECK: threadgroup array<int, int(16)> myArr{{.*}};
+// CHECK: (&kernelContext{{.*}})->myArr{{.*}} = &myArr{{.*}};
+// CHECK-ASM: define void @main_kernel
+
+[numthreads(1,1,1)]
+void main_kernel(uint3 tid: SV_DispatchThreadID)
+{
+ myArr[tid.x] = tid.x;
+ func(3.0f);
+}