From 55ff4686e5685c414d82f16b9c1a4a331bd4f853 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:49:25 -0800 Subject: 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 --- tests/workgraphs/consumer.slang | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/workgraphs/consumer.slang (limited to 'tests/workgraphs') 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 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]] + -- cgit v1.2.3