summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-01-09 20:49:25 -0800
committerGitHub <noreply@github.com>2025-01-09 20:49:25 -0800
commit55ff4686e5685c414d82f16b9c1a4a331bd4f853 (patch)
tree3ac28ec249ad345417b04247ea2d17d03adbd9b1 /tests
parentfce63c2c550b8715e347a44b1d874f48157543d3 (diff)
Support a storage class, NodePayloadAMDX, for SPIRV work-graphs (#6052)
In order to unblock experiments with SPIRV work-graphs, Slang needs to support the storage class, `NodePayloadAMDX`. Note that this commit is only to support a storage class, `NodePayloadAMDX`. There are many parts required for work-graphs hasn't been implemented yet. The implementation of `DispatchNodeInputRecord` is not required, but it is implemented mostly for a testing purpose. Closes #6049 Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/workgraphs/consumer.slang32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/workgraphs/consumer.slang b/tests/workgraphs/consumer.slang
new file mode 100644
index 000000000..5e211a2a1
--- /dev/null
+++ b/tests/workgraphs/consumer.slang
@@ -0,0 +1,32 @@
+//TEST:SIMPLE(filecheck=CHK): -target spirv-asm -stage compute -entry main -skip-spirv-validation
+struct RecordData
+{
+ int myData;
+};
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void main(uint3 dispatchThreadId : SV_GroupThreadID)
+{
+ spirv_asm
+ {
+ OpExecutionMode $main ShaderIndexAMDX $(0);
+ OpExecutionMode $main StaticNumWorkgroupsAMDX $(1) $(1) $(1);
+ };
+
+ DispatchNodeInputRecord<RecordData> inputData;
+
+ let recordData = inputData.Get();
+ int myData = recordData.myData;
+}
+
+//CHK: ; Types, variables and constants
+//CHK: [[MemberType:%[a-zA-Z_0-9]+]] = OpTypeInt 32 1
+//CHK: [[StructType:%[a-zA-Z_0-9]+]] = OpTypeStruct [[MemberType]]
+//CHK: [[PayloadType:%[a-zA-Z_0-9]+]] = OpTypeNodePayloadArrayAMDX [[StructType]]
+//CHK: [[PtrType:%[a-zA-Z_0-9]+]] = OpTypePointer NodePayloadAMDX [[PayloadType]]
+
+//CHK: ; Function
+//CHK: [[VarName:%[a-zA-Z_0-9]+]] = OpVariable [[PtrType]] NodePayloadAMDX
+//CHK: = OpAccessChain [[PtrType]] [[VarName]]
+