summaryrefslogtreecommitdiffstats
path: root/tests/metal
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-04-02 12:34:58 -0500
committerGitHub <noreply@github.com>2025-04-02 10:34:58 -0700
commitc1f69ca1e29811919dbd2f08a6e2dd498b80aab2 (patch)
tree7e41262b8bd04ebd38d388cf84ba45553db44d4d /tests/metal
parente44479c88806a711f6d5f821a4acff030f9a558b (diff)
Metal remove void field (#6725)
* Reapply "Eliminate empty struct on metal target (#6603)" (#6711) This reverts commit bc9dc6557fc0cc3a4c0c2ff27e636940e361cf5d. * Remove argument in make_struct call corresponding to void field This is a follow-up of #6543, where we leave the VoidType field as it in make_struct call during legalization pass. So during cleaning_void IR pass, when we remove "VoidType" from struct, we will have to also clean up the argument corresponding to the "VoidType" field.
Diffstat (limited to 'tests/metal')
-rw-r--r--tests/metal/empty-struct-remove.slang33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/metal/empty-struct-remove.slang b/tests/metal/empty-struct-remove.slang
new file mode 100644
index 000000000..5ac1ccb69
--- /dev/null
+++ b/tests/metal/empty-struct-remove.slang
@@ -0,0 +1,33 @@
+
+//TEST:SIMPLE(filecheck=LIB):-target metallib -entry computeMain -stage compute
+//TEST:SIMPLE(filecheck=METAL):-target metal -entry computeMain -stage compute
+
+// METAL-NOT: struct emptyStruct
+struct emptyStruct
+{
+ void set(RWStructuredBuffer<int> buffer, int value) {buffer[0] = value;}
+}
+
+
+struct MyStruct
+{
+ RWStructuredBuffer<int> buffer;
+ int value;
+ void set()
+ {
+ e.set(buffer, value);
+ }
+ emptyStruct e;
+}
+
+ParameterBlock<MyStruct> param;
+
+// LIB: @computeMain
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void computeMain(
+ uint tid: SV_DispatchThreadID,
+)
+{
+ param.set();
+}