diff --git a/include/dxc/DXIL/DxilMetadataHelper.h b/include/dxc/DXIL/DxilMetadataHelper.h index 0cf3f52269..fa13f6d766 100644 --- a/include/dxc/DXIL/DxilMetadataHelper.h +++ b/include/dxc/DXIL/DxilMetadataHelper.h @@ -332,6 +332,7 @@ class DxilMDHelper { // Node Record Type static const unsigned kDxilNodeRecordSizeTag = 0; static const unsigned kDxilNodeSVDispatchGridTag = 1; + static const unsigned kDxilNodeRecordAlignmentTag = 2; // GSState. static const unsigned kDxilGSStateNumFields = 5; @@ -624,6 +625,7 @@ class DxilMDHelper { unsigned &payloadSizeInBytes); llvm::MDTuple *EmitDxilNodeIOState(const NodeIOProperties &Node); + llvm::MDTuple *EmitDxilNodeRecordType(const NodeRecordType &RecordType); hlsl::NodeIOProperties LoadDxilNodeIOState(const llvm::MDOperand &MDO); hlsl::NodeRecordType LoadDxilNodeRecordType(const llvm::MDOperand &MDO); diff --git a/include/dxc/DXIL/DxilNodeProps.h b/include/dxc/DXIL/DxilNodeProps.h index f7e46a288b..6a15c85662 100644 --- a/include/dxc/DXIL/DxilNodeProps.h +++ b/include/dxc/DXIL/DxilNodeProps.h @@ -45,6 +45,7 @@ struct SVDispatchGrid { // struct NodeRecordType { unsigned size; + unsigned alignment; SVDispatchGrid SV_DispatchGrid; }; diff --git a/include/dxc/DxilContainer/RDAT_LibraryTypes.inl b/include/dxc/DxilContainer/RDAT_LibraryTypes.inl index 4cb50062cb..b1d4e39c37 100644 --- a/include/dxc/DxilContainer/RDAT_LibraryTypes.inl +++ b/include/dxc/DxilContainer/RDAT_LibraryTypes.inl @@ -277,6 +277,7 @@ RDAT_ENUM_START(NodeAttribKind, uint32_t) RDAT_ENUM_VALUE(RecordDispatchGrid, 5) RDAT_ENUM_VALUE(OutputArraySize, 6) RDAT_ENUM_VALUE(AllowSparseNodes, 7) + RDAT_ENUM_VALUE(RecordAlignmentInBytes, 8) RDAT_ENUM_VALUE_NODEF(LastValue) RDAT_ENUM_END() @@ -407,6 +408,10 @@ RDAT_STRUCT_TABLE(NodeShaderIOAttrib, NodeShaderIOAttribTable) getAttribKind() == hlsl::RDAT::NodeAttribKind::AllowSparseNodes) RDAT_VALUE(uint32_t, AllowSparseNodes) + RDAT_UNION_ELIF(RecordAlignmentInBytes, + getAttribKind() == + hlsl::RDAT::NodeAttribKind::RecordAlignmentInBytes) + RDAT_VALUE(uint32_t, RecordAlignmentInBytes) RDAT_UNION_ENDIF() RDAT_UNION_END() RDAT_STRUCT_END() diff --git a/lib/DXIL/DxilMetadataHelper.cpp b/lib/DXIL/DxilMetadataHelper.cpp index cf51a7e6cf..fdd6d6b946 100644 --- a/lib/DXIL/DxilMetadataHelper.cpp +++ b/lib/DXIL/DxilMetadataHelper.cpp @@ -1967,6 +1967,7 @@ void DxilMDHelper::SerializeNodeProps(SmallVectorImpl &MDVals, nodeinput.RecordType.SV_DispatchGrid.ComponentType))); MDVals.push_back( Uint32ToConstMD(nodeinput.RecordType.SV_DispatchGrid.NumComponents)); + MDVals.push_back(Uint32ToConstMD(nodeinput.RecordType.alignment)); } for (auto &nodeoutput : props->OutputNodes) { MDVals.push_back(Uint32ToConstMD(nodeoutput.Flags)); @@ -1983,6 +1984,7 @@ void DxilMDHelper::SerializeNodeProps(SmallVectorImpl &MDVals, MDVals.push_back(Int32ToConstMD(nodeoutput.MaxRecordsSharedWith)); MDVals.push_back(Uint32ToConstMD(nodeoutput.OutputArraySize)); MDVals.push_back(BoolToConstMD(nodeoutput.AllowSparseNodes)); + MDVals.push_back(Uint32ToConstMD(nodeoutput.RecordType.alignment)); } } @@ -2019,6 +2021,10 @@ void DxilMDHelper::DeserializeNodeProps(const MDTuple *pProps, unsigned &idx, ConstMDToUint32(pProps->getOperand(idx++))); nodeinput.RecordType.SV_DispatchGrid.NumComponents = ConstMDToUint32(pProps->getOperand(idx++)); + if (pProps->getNumOperands() > idx) { + nodeinput.RecordType.alignment = + ConstMDToUint32(pProps->getOperand(idx++)); + } } for (auto &nodeoutput : props->OutputNodes) { @@ -2037,6 +2043,10 @@ void DxilMDHelper::DeserializeNodeProps(const MDTuple *pProps, unsigned &idx, nodeoutput.MaxRecordsSharedWith = ConstMDToInt32(pProps->getOperand(idx++)); nodeoutput.OutputArraySize = ConstMDToUint32(pProps->getOperand(idx++)); nodeoutput.AllowSparseNodes = ConstMDToBool(pProps->getOperand(idx++)); + if (pProps->getNumOperands() > idx) { + nodeoutput.RecordType.alignment = + ConstMDToUint32(pProps->getOperand(idx++)); + } } } @@ -2755,6 +2765,32 @@ void DxilMDHelper::EmitDxilNodeState(std::vector &MDVals, } } +llvm::MDTuple * +DxilMDHelper::EmitDxilNodeRecordType(const NodeRecordType &RecordType) { + vector MDVals; + MDVals.emplace_back(Uint32ToConstMD(DxilMDHelper::kDxilNodeRecordSizeTag)); + MDVals.emplace_back(Uint32ToConstMD(RecordType.size)); + + if (RecordType.SV_DispatchGrid.NumComponents) { + MDVals.emplace_back( + Uint32ToConstMD(DxilMDHelper::kDxilNodeSVDispatchGridTag)); + vector SVDispatchGridVals; + SVDispatchGridVals.emplace_back( + Uint32ToConstMD(RecordType.SV_DispatchGrid.ByteOffset)); + SVDispatchGridVals.emplace_back(Uint32ToConstMD( + static_cast(RecordType.SV_DispatchGrid.ComponentType))); + SVDispatchGridVals.emplace_back( + Uint32ToConstMD(RecordType.SV_DispatchGrid.NumComponents)); + MDVals.emplace_back(MDNode::get(m_Ctx, SVDispatchGridVals)); + } + if (RecordType.alignment) { + MDVals.emplace_back( + Uint32ToConstMD(DxilMDHelper::kDxilNodeRecordAlignmentTag)); + MDVals.emplace_back(Uint32ToConstMD(RecordType.alignment)); + } + return MDNode::get(m_Ctx, MDVals); +} + llvm::MDTuple * DxilMDHelper::EmitDxilNodeIOState(const hlsl::NodeIOProperties &Node) { vector MDVals; @@ -2763,24 +2799,7 @@ DxilMDHelper::EmitDxilNodeIOState(const hlsl::NodeIOProperties &Node) { if (Node.RecordType.size) { MDVals.emplace_back(Uint32ToConstMD(DxilMDHelper::kDxilNodeRecordTypeTag)); - vector NodeRecordTypeVals; - NodeRecordTypeVals.emplace_back( - Uint32ToConstMD(DxilMDHelper::kDxilNodeRecordSizeTag)); - NodeRecordTypeVals.emplace_back(Uint32ToConstMD(Node.RecordType.size)); - // If the record has a SV_DispatchGrid field - if (Node.RecordType.SV_DispatchGrid.NumComponents) { - NodeRecordTypeVals.emplace_back( - Uint32ToConstMD(DxilMDHelper::kDxilNodeSVDispatchGridTag)); - vector SVDispatchGridVals; - SVDispatchGridVals.emplace_back( - Uint32ToConstMD(Node.RecordType.SV_DispatchGrid.ByteOffset)); - SVDispatchGridVals.emplace_back(Uint32ToConstMD(static_cast( - Node.RecordType.SV_DispatchGrid.ComponentType))); - SVDispatchGridVals.emplace_back( - Uint32ToConstMD(Node.RecordType.SV_DispatchGrid.NumComponents)); - NodeRecordTypeVals.emplace_back(MDNode::get(m_Ctx, SVDispatchGridVals)); - } - MDVals.emplace_back(MDNode::get(m_Ctx, NodeRecordTypeVals)); + MDVals.emplace_back(EmitDxilNodeRecordType(Node.RecordType)); } if (Node.Flags.IsOutputNode()) { @@ -2856,6 +2875,9 @@ DxilMDHelper::LoadDxilNodeRecordType(const llvm::MDOperand &MDO) { Record.SV_DispatchGrid.NumComponents = ConstMDToUint32(pSVDTupleMD->getOperand(2)); } break; + case DxilMDHelper::kDxilNodeRecordAlignmentTag: { + Record.alignment = ConstMDToUint32(MDO); + } break; default: m_bExtraMetadata = true; break; diff --git a/lib/DxilContainer/DxilContainerAssembler.cpp b/lib/DxilContainer/DxilContainerAssembler.cpp index f80388a398..df357d7f6d 100644 --- a/lib/DxilContainer/DxilContainerAssembler.cpp +++ b/lib/DxilContainer/DxilContainerAssembler.cpp @@ -1438,6 +1438,13 @@ class DxilRDATWriter : public DxilPartWriter { N.RecordType.SV_DispatchGrid.NumComponents); nodeAttribs.push_back(Builder.InsertRecord(nAttrib)); } + + if (N.RecordType.alignment) { + nAttrib = {}; + nAttrib.AttribKind = (uint32_t)NodeAttribKind::RecordAlignmentInBytes; + nAttrib.RecordAlignmentInBytes = N.RecordType.alignment; + nodeAttribs.push_back(Builder.InsertRecord(nAttrib)); + } } ioNode.Attribs = diff --git a/tools/clang/lib/CodeGen/CGHLSLMS.cpp b/tools/clang/lib/CodeGen/CGHLSLMS.cpp index c54d779887..108bdea40a 100644 --- a/tools/clang/lib/CodeGen/CGHLSLMS.cpp +++ b/tools/clang/lib/CodeGen/CGHLSLMS.cpp @@ -2620,8 +2620,10 @@ void CGMSHLSLRuntime::AddHLSLNodeRecordTypeInfo( } // Ex: For DispatchNodeInputRecord, set size = - // size(MY_RECORD) + // size(MY_RECORD), alignment = alignof(MY_RECORD) node.RecordType.size = CGM.getDataLayout().getTypeAllocSize(Type); + node.RecordType.alignment = + CGM.getDataLayout().getABITypeAlignment(Type); // Iterate over fields of the MY_RECORD(example) struct for (auto fieldDecl : RD->fields()) { // Check if any of the fields have a semantic annotation = diff --git a/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/array-in-workgraphrecord-1.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/array-in-workgraphrecord-1.hlsl index e5672f2025..111bf39587 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/array-in-workgraphrecord-1.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/array-in-workgraphrecord-1.hlsl @@ -8,7 +8,7 @@ // CHECK: ![[NodeDispatchGrid]] = !{i32 1, i32 1, i32 1} // CHECK: ![[NodeInputs]] = !{![[Input0:[0-9]+]]} // CHECK: ![[Input0]] = !{i32 1, i32 97, i32 2, ![[NodeRecordType:[0-9]+]]} -// CHECK: ![[NodeRecordType]] = !{i32 0, i32 68} +// CHECK: ![[NodeRecordType]] = !{i32 0, i32 68, i32 2, i32 4} // CHECK: ![[NumThreads]] = !{i32 32, i32 1, i32 1} // CHECK: ![[AutoBindingSpace]] = !{i32 0} diff --git a/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/array-in-workgraphrecord-2.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/array-in-workgraphrecord-2.hlsl index 3683f360a2..a933f4f189 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/array-in-workgraphrecord-2.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/array-in-workgraphrecord-2.hlsl @@ -8,7 +8,7 @@ // CHECK: ![[NodeDispatchGrid]] = !{i32 1, i32 1, i32 1} // CHECK: ![[NodeInputs]] = !{![[Input0:[0-9]+]]} // CHECK: ![[Input0]] = !{i32 1, i32 97, i32 2, ![[NodeRecordType:[0-9]+]]} -// CHECK: ![[NodeRecordType]] = !{i32 0, i32 68} +// CHECK: ![[NodeRecordType]] = !{i32 0, i32 68, i32 2, i32 4} // CHECK: ![[NumThreads]] = !{i32 32, i32 1, i32 1} // CHECK: ![[AutoBindingSpace]] = !{i32 0} diff --git a/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/node-objects-metdata.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/node-objects-metdata.hlsl index ce15a83471..5c5eadc9a5 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/node-objects-metdata.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/objects/NodeObjects/node-objects-metdata.hlsl @@ -57,13 +57,13 @@ struct RECORD1 // DispatchNodeInputRecord -// FCGLMD-DAG: !{void (%"struct.DispatchNodeInputRecord"*)* @node_DispatchNodeInputRecord, i32 15, i32 1024, i32 1, i32 1, i32 1, i1 false, !"node_DispatchNodeInputRecord", i32 0, !"", i32 0, i32 -1, i32 64, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 97, i32 0, i32 16, i32 0, i32 0, i32 0} +// FCGLMD-DAG: !{void (%"struct.DispatchNodeInputRecord"*)* @node_DispatchNodeInputRecord, i32 15, i32 1024, i32 1, i32 1, i32 1, i1 false, !"node_DispatchNodeInputRecord", i32 0, !"", i32 0, i32 -1, i32 64, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 97, i32 0, i32 16, i32 0, i32 0, i32 0, i32 4} // MD: !{void ()* @node_DispatchNodeInputRecord, !"node_DispatchNodeInputRecord", null, null, ![[DispatchNodeInput:[0-9]+]]} // MD: ![[DispatchNodeInput]] = !{i32 8, i32 15, i32 13, i32 1, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 18, !{{[0-9]+}}, i32 20, ![[EntryInputs:[0-9]+]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} // MD: ![[EntryInputs]] = !{![[EntryInputs0:[0-9]+]]} // MD: ![[EntryInputs0]] = !{i32 1, i32 97, i32 2, ![[EntryInputs0Record:[0-9]+]]} -// MD: ![[EntryInputs0Record]] = !{i32 0, i32 16} +// MD: ![[EntryInputs0Record]] = !{i32 0, i32 16, i32 2, i32 4} [Shader("node")] [NumThreads(1024,1,1)] @@ -76,7 +76,7 @@ void node_DispatchNodeInputRecord(DispatchNodeInputRecord input) // EmptyNodeInput -// FCGLMD-DAG: !{void (%struct.EmptyNodeInput*)* @node_EmptyNodeInput, i32 15, i32 2, i32 1, i32 1, i32 2, i1 true, !"node_EmptyNodeInput", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 9, i32 0, i32 0, i32 0, i32 0, i32 0} +// FCGLMD-DAG: !{void (%struct.EmptyNodeInput*)* @node_EmptyNodeInput, i32 15, i32 2, i32 1, i32 1, i32 2, i1 true, !"node_EmptyNodeInput", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 9, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0} // MD: !{void ()* @node_EmptyNodeInput, !"node_EmptyNodeInput", null, null, ![[EmptyNodeInput:[0-9]+]]} // MD: ![[EmptyNodeInput]] = !{i32 8, i32 15, i32 13, i32 2, i32 14, i1 true, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 20, ![[EntryInputs:[0-9]+]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} @@ -95,7 +95,7 @@ void node_EmptyNodeInput(EmptyNodeInput input) // EmptyNodeOutput -// FCGLMD-DAG: !{void (%struct.EmptyNodeOutput*)* @node_EmptyNodeOutput, i32 15, i32 1, i32 1, i32 1, i32 1, i1 false, !"node_EmptyNodeOutput", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 10, i32 0, i32 0, i32 0, i32 0, !"loadStressChild", i32 0, i32 0, i32 -1, i32 0, i1 false} +// FCGLMD-DAG: !{void (%struct.EmptyNodeOutput*)* @node_EmptyNodeOutput, i32 15, i32 1, i32 1, i32 1, i32 1, i1 false, !"node_EmptyNodeOutput", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 10, i32 0, i32 0, i32 0, i32 0, !"loadStressChild", i32 0, i32 0, i32 -1, i32 0, i1 false, i32 0} // MD: !{void ()* @node_EmptyNodeOutput, !"node_EmptyNodeOutput", null, null, ![[EmptyNodeOutput:[0-9]+]]} // MD: ![[EmptyNodeOutput]] = !{i32 8, i32 15, i32 13, i32 1, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 18, !{{[0-9]+}}, i32 21, ![[EntryOutputs:[0-9]+]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} @@ -121,7 +121,7 @@ void node_EmptyNodeOutput( // EmptyNodeOutputArray -// FCGLMD-DAG: !{void (%struct.EmptyNodeOutputArray*)* @node_EmptyNodeOutputArray, i32 15, i32 128, i32 1, i32 1, i32 1, i1 false, !"node_EmptyNodeOutputArray", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 26, i32 0, i32 0, i32 0, i32 0, !"EmptyOutputArray", i32 0, i32 64, i32 -1, i32 128, i1 false} +// FCGLMD-DAG: !{void (%struct.EmptyNodeOutputArray*)* @node_EmptyNodeOutputArray, i32 15, i32 128, i32 1, i32 1, i32 1, i1 false, !"node_EmptyNodeOutputArray", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 26, i32 0, i32 0, i32 0, i32 0, !"EmptyOutputArray", i32 0, i32 64, i32 -1, i32 128, i1 false, i32 0} // MD: !{void ()* @node_EmptyNodeOutputArray, !"node_EmptyNodeOutputArray", null, null, ![[EmptyNodeOutputArray:[0-9]+]]} // MD: ![[EmptyNodeOutputArray]] = !{i32 8, i32 15, i32 13, i32 1, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 18, !{{[0-9]+}}, i32 21, ![[EntryOutputs:[0-9]+]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} @@ -145,7 +145,7 @@ void node_EmptyNodeOutputArray( // GroupNodeInputRecords -// FCGLMD-DAG: !{void (%"struct.GroupNodeInputRecords"*)* @node_GroupNodeInputRecords, i32 15, i32 1024, i32 1, i32 1, i32 2, i1 true, !"node_GroupNodeInputRecords", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 65, i32 256, i32 16, i32 0, i32 0, i32 0} +// FCGLMD-DAG: !{void (%"struct.GroupNodeInputRecords"*)* @node_GroupNodeInputRecords, i32 15, i32 1024, i32 1, i32 1, i32 2, i1 true, !"node_GroupNodeInputRecords", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 65, i32 256, i32 16, i32 0, i32 0, i32 0, i32 4} // MD: !{void ()* @node_GroupNodeInputRecords, !"node_GroupNodeInputRecords", null, null, ![[GroupNodeInputRecords:[0-9]+]]} @@ -166,13 +166,13 @@ void node_GroupNodeInputRecords([MaxRecords(256)] GroupNodeInputRecords // GroupNodeOutputRecords -// FCGLMD-DAG: !{void (%"struct.NodeOutputArray"*)* @node_GroupNodeOutputRecords, i32 15, i32 128, i32 1, i32 1, i32 1, i1 false, !"node_GroupNodeOutputRecords", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 22, i32 8, i32 0, i32 0, i32 0, !"OutputArray", i32 0, i32 64, i32 -1, i32 128, i1 false} +// FCGLMD-DAG: !{void (%"struct.NodeOutputArray"*)* @node_GroupNodeOutputRecords, i32 15, i32 128, i32 1, i32 1, i32 1, i1 false, !"node_GroupNodeOutputRecords", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 22, i32 8, i32 0, i32 0, i32 0, !"OutputArray", i32 0, i32 64, i32 -1, i32 128, i1 false, i32 4} // MD: !{void ()* @node_GroupNodeOutputRecords, !"node_GroupNodeOutputRecords", null, null, ![[GroupNodeOutputRecords:[0-9]+]]} // MD: ![[GroupNodeOutputRecords]] = !{i32 8, i32 15, i32 13, i32 1, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 18, !{{[0-9]+}}, i32 21, ![[EntryOutputs:[0-9]+]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} // MD: ![[EntryOutputs]] = !{![[EntryOutputs0:[0-9]+]]} // MD: ![[EntryOutputs0]] = !{i32 1, i32 22, i32 2, ![[RecordType1:[0-9]+]], i32 3, i32 64, i32 5, i32 128, i32 0, ![[EntryOutputs0MaxRecords:[0-9]+]]} -// MD: ![[RecordType1]] = !{i32 0, i32 8} +// MD: ![[RecordType1]] = !{i32 0, i32 8, i32 2, i32 4} // MD: ![[EntryOutputs0MaxRecords]] = !{!"OutputArray", i32 0} [Shader("node")] @@ -193,7 +193,7 @@ void node_GroupNodeOutputRecords( // NodeOutput -// FCGLMD-DAG: !{void (%"struct.NodeOutput"*)* @node_NodeOutput, i32 15, i32 1024, i32 1, i32 1, i32 1, i1 false, !"node_NodeOutput", i32 0, !"", i32 0, i32 -1, i32 32, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 6, i32 16, i32 0, i32 0, i32 0, !"output3", i32 0, i32 0, i32 -1, i32 0, i1 false} +// FCGLMD-DAG: !{void (%"struct.NodeOutput"*)* @node_NodeOutput, i32 15, i32 1024, i32 1, i32 1, i32 1, i1 false, !"node_NodeOutput", i32 0, !"", i32 0, i32 -1, i32 32, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 6, i32 16, i32 0, i32 0, i32 0, !"output3", i32 0, i32 0, i32 -1, i32 0, i1 false, i32 4} // MD: !{void ()* @node_NodeOutput, !"node_NodeOutput", null, null, ![[NodeOutput:[0-9]+]]} // MD: ![[NodeOutput]] = !{i32 8, i32 15, i32 13, i32 1, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 18, !{{[0-9]+}}, i32 21, ![[EntryOutputs:[0-9]+]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} @@ -217,7 +217,7 @@ void node_NodeOutput(NodeOutput output3) // NodeOutputArray -// FCGLMD-DAG: !{void (%"struct.NodeOutputArray"*)* @node_NodeOutputArray, i32 15, i32 1, i32 1, i32 1, i32 1, i1 false, !"node_NodeOutputArray", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 22, i32 8, i32 0, i32 0, i32 0, !"OutputArray_1_0", i32 0, i32 31, i32 -1, i32 129, i1 true} +// FCGLMD-DAG: !{void (%"struct.NodeOutputArray"*)* @node_NodeOutputArray, i32 15, i32 1, i32 1, i32 1, i32 1, i1 false, !"node_NodeOutputArray", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 22, i32 8, i32 0, i32 0, i32 0, !"OutputArray_1_0", i32 0, i32 31, i32 -1, i32 129, i1 true, i32 4} // MD: !{void ()* @node_NodeOutputArray, !"node_NodeOutputArray", null, null, ![[NodeOutputArray:[0-9]+]]} @@ -240,7 +240,7 @@ void node_NodeOutputArray( // RWDispatchNodeInputRecord -// FCGLMD-DAG: !{void (%"struct.RWDispatchNodeInputRecord"*)* @node_RWDispatchNodeInputRecord, i32 15, i32 1024, i32 1, i32 1, i32 1, i1 false, !"node_RWDispatchNodeInputRecord", i32 0, !"", i32 0, i32 -1, i32 16, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 101, i32 0, i32 16, i32 0, i32 0, i32 0} +// FCGLMD-DAG: !{void (%"struct.RWDispatchNodeInputRecord"*)* @node_RWDispatchNodeInputRecord, i32 15, i32 1024, i32 1, i32 1, i32 1, i1 false, !"node_RWDispatchNodeInputRecord", i32 0, !"", i32 0, i32 -1, i32 16, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 101, i32 0, i32 16, i32 0, i32 0, i32 0, i32 4} // MD: !{void ()* @node_RWDispatchNodeInputRecord, !"node_RWDispatchNodeInputRecord", null, null, ![[RWDispatchNodeInputRecord:[0-9]+]]} @@ -261,14 +261,14 @@ void node_RWDispatchNodeInputRecord(RWDispatchNodeInputRecord input) // RWGroupNodeInputRecords -// FCGLMD-DAG: !{void (%"struct.RWGroupNodeInputRecords"*)* @node_RWGroupNodeInputRecords, i32 15, i32 1, i32 1, i32 1, i32 2, i1 false, !"node_RWGroupNodeInputRecords", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 69, i32 4, i32 48, i32 0, i32 0, i32 0} +// FCGLMD-DAG: !{void (%"struct.RWGroupNodeInputRecords"*)* @node_RWGroupNodeInputRecords, i32 15, i32 1, i32 1, i32 1, i32 2, i1 false, !"node_RWGroupNodeInputRecords", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 69, i32 4, i32 48, i32 0, i32 0, i32 0, i32 4} // MD: !{void ()* @node_RWGroupNodeInputRecords, !"node_RWGroupNodeInputRecords", null, null, ![[RWGroupNodeInputRecords:[0-9]+]]} // MD: ![[RWGroupNodeInputRecords]] = !{i32 8, i32 15, i32 13, i32 2, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 20, ![[EntryInputs:[0-9]+]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} // MD: ![[EntryInputs]] = !{![[EntryInputs0:[0-9]+]]} // MD: ![[EntryInputs0]] = !{i32 1, i32 69, i32 2, ![[RecordType2:[0-9]+]], i32 3, i32 4} -// MD: ![[RecordType2]] = !{i32 0, i32 48} +// MD: ![[RecordType2]] = !{i32 0, i32 48, i32 2, i32 4} struct RECORD2 { @@ -290,7 +290,7 @@ void node_RWGroupNodeInputRecords([MaxRecords(4)] RWGroupNodeInputRecords"*)* @node_RWThreadNodeInputRecord, i32 15, i32 1, i32 1, i32 1, i32 3, i1 false, !"node_RWThreadNodeInputRecord", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 37, i32 0, i32 16, i32 0, i32 0, i32 0} +// FCGLMD-DAG: !{void (%"struct.RWThreadNodeInputRecord"*)* @node_RWThreadNodeInputRecord, i32 15, i32 1, i32 1, i32 1, i32 3, i1 false, !"node_RWThreadNodeInputRecord", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 37, i32 0, i32 16, i32 0, i32 0, i32 0, i32 4} // MD: !{void ()* @node_RWThreadNodeInputRecord, !"node_RWThreadNodeInputRecord", null, null, ![[RWThreadNodeInputRecord:[0-9]+]]} // MD: ![[RWThreadNodeInputRecord]] = !{i32 8, i32 15, i32 13, i32 3, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 20, ![[EntryInputs:[0-9]+]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} @@ -306,7 +306,7 @@ void node_RWThreadNodeInputRecord(RWThreadNodeInputRecord input) // ThreadNodeInputRecord -// FCGLMD-DAG: !{void (%"struct.ThreadNodeInputRecord"*)* @node_ThreadNodeInputRecord, i32 15, i32 1, i32 1, i32 1, i32 3, i1 false, !"node_ThreadNodeInputRecord", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 33, i32 0, i32 16, i32 0, i32 0, i32 0} +// FCGLMD-DAG: !{void (%"struct.ThreadNodeInputRecord"*)* @node_ThreadNodeInputRecord, i32 15, i32 1, i32 1, i32 1, i32 3, i1 false, !"node_ThreadNodeInputRecord", i32 0, !"", i32 0, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 33, i32 0, i32 16, i32 0, i32 0, i32 0, i32 4} // MD: !{void ()* @node_ThreadNodeInputRecord, !"node_ThreadNodeInputRecord", null, null, ![[ThreadNodeInputRecord:[0-9]+]]} // MD: ![[ThreadNodeInputRecord]] = !{i32 8, i32 15, i32 13, i32 3, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 20, ![[EntryInputs:[0-9]+]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} @@ -323,7 +323,7 @@ void node_ThreadNodeInputRecord(ThreadNodeInputRecord input) // ThreadNodeOutputRecords -// FCGLMD-DAG: !{void (%"struct.NodeOutputArray"*)* @node_ThreadNodeOutputRecords, i32 15, i32 1, i32 1, i32 1, i32 1, i1 false, !"node_ThreadNodeOutputRecords", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 22, i32 8, i32 0, i32 0, i32 0, !"OutputArray_1_0", i32 0, i32 31, i32 -1, i32 129, i1 true} +// FCGLMD-DAG: !{void (%"struct.NodeOutputArray"*)* @node_ThreadNodeOutputRecords, i32 15, i32 1, i32 1, i32 1, i32 1, i1 false, !"node_ThreadNodeOutputRecords", i32 0, !"", i32 0, i32 -1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 22, i32 8, i32 0, i32 0, i32 0, !"OutputArray_1_0", i32 0, i32 31, i32 -1, i32 129, i1 true, i32 4} // MD: !{void ()* @node_ThreadNodeOutputRecords, !"node_ThreadNodeOutputRecords", null, null, ![[ThreadNodeOutputRecords:[0-9]+]]} // MD: ![[ThreadNodeOutputRecords]] = !{i32 8, i32 15, i32 13, i32 1, i32 15, !{{[0-9]+}}, i32 16, i32 -1, i32 18, !{{[0-9]+}}, i32 21, ![[NodeOutputArrayEntryOutputs]], i32 4, !{{[0-9]+}}, i32 5, !{{[0-9]+}}} diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl index 4a49cc7150..5889e69281 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_broadcasting_nodes.hlsl @@ -40,50 +40,55 @@ // CHECK: DispatchGrid: <4:array[3]> = { 2, 8, 10 } // CHECK: } // CHECK: } -// CHECK: Outputs: <21:RecordArrayRef[1]> = { +// CHECK: Outputs: <{{[0-9]+}}:RecordArrayRef[1]> = { // CHECK: [0]: <1:IONode> = { // CHECK: IOFlagsAndKind: 22 -// CHECK: Attribs: <14:RecordArrayRef[6]> = { -// CHECK: [0]: <1:NodeShaderIOAttrib> = { +// CHECK: Attribs: <{{[0-9]+}}:RecordArrayRef[7]> = { +// CHECK: [0]: <2:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <1:NodeID> = { // CHECK: Name: "OutputyMcOutputFace" // CHECK: Index: 0 // CHECK: } // CHECK: } -// CHECK: [1]: <2:NodeShaderIOAttrib> = { +// CHECK: [1]: <3:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputArraySize // CHECK: OutputArraySize: 2 // CHECK: } -// CHECK: [2]: <3:NodeShaderIOAttrib> = { +// CHECK: [2]: <4:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecords // CHECK: MaxRecords: 47 // CHECK: } -// CHECK: [3]: <4:NodeShaderIOAttrib> = { +// CHECK: [3]: <5:NodeShaderIOAttrib> = { // CHECK: AttribKind: AllowSparseNodes // CHECK: AllowSparseNodes: 1 // CHECK: } -// CHECK: [4]: <5:NodeShaderIOAttrib> = { +// CHECK: [4]: <6:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 20 // CHECK: } -// CHECK: [5]: <6:NodeShaderIOAttrib> = { +// CHECK: [5]: <7:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordDispatchGrid // CHECK: RecordDispatchGrid: // CHECK: ByteOffset: 8 // CHECK: ComponentNumAndType: 23 // CHECK: } +// CHECK: [6]: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } // CHECK: } // CHECK: } // CHECK: } -// CHECK: Inputs: <12:RecordArrayRef[1]> = { +// CHECK: Inputs: <{{[0-9]+}}:RecordArrayRef[1]> = { // CHECK: [0]: <0:IONode> = { // CHECK: IOFlagsAndKind: 97 -// CHECK: Attribs: <12:RecordArrayRef[1]> = { +// CHECK: Attribs: <12:RecordArrayRef[2]> = { // CHECK: [0]: <0:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } +// CHECK: [1]: <1:NodeShaderIOAttrib> // CHECK: } // CHECK: } // CHECK: } @@ -117,35 +122,39 @@ // CHECK: DispatchGrid: <4:array[3]> = { 2, 8, 10 } // CHECK: } // CHECK: } -// CHECK: RecordTable (stride = {{[0-9]+}} bytes) NodeShaderIOAttribTable[7] = { +// CHECK: RecordTable (stride = {{[0-9]+}} bytes) NodeShaderIOAttribTable[8] = { // CHECK: <0:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } // CHECK: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } +// CHECK: <2:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <1:NodeID> = { // CHECK: Name: "OutputyMcOutputFace" // CHECK: Index: 0 // CHECK: } // CHECK: } -// CHECK: <2:NodeShaderIOAttrib> = { +// CHECK: <3:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputArraySize // CHECK: OutputArraySize: 2 // CHECK: } -// CHECK: <3:NodeShaderIOAttrib> = { +// CHECK: <4:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecords // CHECK: MaxRecords: 47 // CHECK: } -// CHECK: <4:NodeShaderIOAttrib> = { +// CHECK: <5:NodeShaderIOAttrib> = { // CHECK: AttribKind: AllowSparseNodes // CHECK: AllowSparseNodes: 1 // CHECK: } -// CHECK: <5:NodeShaderIOAttrib> = { +// CHECK: <6:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 20 // CHECK: } -// CHECK: <6:NodeShaderIOAttrib> = { +// CHECK: <7:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordDispatchGrid // CHECK: RecordDispatchGrid: // CHECK: ByteOffset: 8 @@ -155,45 +164,53 @@ // CHECK: RecordTable (stride = {{[0-9]+}} bytes) IONodeTable[2] = { // CHECK: <0:IONode> = { // CHECK: IOFlagsAndKind: 97 -// CHECK: Attribs: <12:RecordArrayRef[1]> = { +// CHECK: Attribs: <12:RecordArrayRef[2]> = { // CHECK: [0]: <0:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } +// CHECK: [1]: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } // CHECK: } // CHECK: } // CHECK: <1:IONode> = { // CHECK: IOFlagsAndKind: 22 -// CHECK: Attribs: <14:RecordArrayRef[6]> = { -// CHECK: [0]: <1:NodeShaderIOAttrib> = { +// CHECK: Attribs: <{{[0-9]+}}:RecordArrayRef[7]> = { +// CHECK: [0]: <2:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <1:NodeID> = { // CHECK: Name: "OutputyMcOutputFace" // CHECK: Index: 0 // CHECK: } // CHECK: } -// CHECK: [1]: <2:NodeShaderIOAttrib> = { +// CHECK: [1]: <3:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputArraySize // CHECK: OutputArraySize: 2 // CHECK: } -// CHECK: [2]: <3:NodeShaderIOAttrib> = { +// CHECK: [2]: <4:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecords // CHECK: MaxRecords: 47 // CHECK: } -// CHECK: [3]: <4:NodeShaderIOAttrib> = { +// CHECK: [3]: <5:NodeShaderIOAttrib> = { // CHECK: AttribKind: AllowSparseNodes // CHECK: AllowSparseNodes: 1 // CHECK: } -// CHECK: [4]: <5:NodeShaderIOAttrib> = { +// CHECK: [4]: <6:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 20 // CHECK: } -// CHECK: [5]: <6:NodeShaderIOAttrib> = { +// CHECK: [5]: <7:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordDispatchGrid // CHECK: RecordDispatchGrid: // CHECK: ByteOffset: 8 // CHECK: ComponentNumAndType: 23 // CHECK: } +// CHECK: [6]: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } // CHECK: } // CHECK: } // CHECK: } @@ -218,50 +235,55 @@ // CHECK: DispatchGrid: <4:array[3]> = { 2, 8, 10 } // CHECK: } // CHECK: } -// CHECK: Outputs: <21:RecordArrayRef[1]> = { +// CHECK: Outputs: <{{[0-9]+}}:RecordArrayRef[1]> = { // CHECK: [0]: <1:IONode> = { // CHECK: IOFlagsAndKind: 22 -// CHECK: Attribs: <14:RecordArrayRef[6]> = { -// CHECK: [0]: <1:NodeShaderIOAttrib> = { +// CHECK: Attribs: <{{[0-9]+}}:RecordArrayRef[7]> = { +// CHECK: [0]: <2:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <1:NodeID> = { // CHECK: Name: "OutputyMcOutputFace" // CHECK: Index: 0 // CHECK: } // CHECK: } -// CHECK: [1]: <2:NodeShaderIOAttrib> = { +// CHECK: [1]: <3:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputArraySize // CHECK: OutputArraySize: 2 // CHECK: } -// CHECK: [2]: <3:NodeShaderIOAttrib> = { +// CHECK: [2]: <4:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecords // CHECK: MaxRecords: 47 // CHECK: } -// CHECK: [3]: <4:NodeShaderIOAttrib> = { +// CHECK: [3]: <5:NodeShaderIOAttrib> = { // CHECK: AttribKind: AllowSparseNodes // CHECK: AllowSparseNodes: 1 // CHECK: } -// CHECK: [4]: <5:NodeShaderIOAttrib> = { +// CHECK: [4]: <6:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 20 // CHECK: } -// CHECK: [5]: <6:NodeShaderIOAttrib> = { +// CHECK: [5]: <7:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordDispatchGrid // CHECK: RecordDispatchGrid: // CHECK: ByteOffset: 8 // CHECK: ComponentNumAndType: 23 // CHECK: } +// CHECK: [6]: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } // CHECK: } // CHECK: } // CHECK: } -// CHECK: Inputs: <12:RecordArrayRef[1]> = { +// CHECK: Inputs: <{{[0-9]+}}:RecordArrayRef[1]> = { // CHECK: [0]: <0:IONode> = { // CHECK: IOFlagsAndKind: 97 -// CHECK: Attribs: <12:RecordArrayRef[1]> = { +// CHECK: Attribs: <12:RecordArrayRef[2]> = { // CHECK: [0]: <0:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } +// CHECK: [1]: <1:NodeShaderIOAttrib> // CHECK: } // CHECK: } // CHECK: } diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl index f8930c3cf1..00ce9f2f55 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/empty_thread_nodes.hlsl @@ -41,22 +41,22 @@ // CHECK: LocalRootArgumentsTableIndex: 2 // CHECK: } // CHECK: } -// CHECK: Outputs: <20:RecordArrayRef[2]> = { +// CHECK: Outputs: <25:RecordArrayRef[2]> = { // CHECK: [0]: <1:IONode> = { // CHECK: IOFlagsAndKind: 262 -// CHECK: Attribs: <10:RecordArrayRef[4]> = { -// CHECK: [0]: <1:NodeShaderIOAttrib> = { +// CHECK: Attribs: <{{[0-9]+}}:RecordArrayRef[5]> = { +// CHECK: [0]: <2:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <1:NodeID> = { // CHECK: Name: "Output1" // CHECK: Index: 0 // CHECK: } // CHECK: } -// CHECK: [1]: <2:NodeShaderIOAttrib> = { +// CHECK: [1]: <3:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputArraySize // CHECK: OutputArraySize: 0 // CHECK: } -// CHECK: [2]: <3:NodeShaderIOAttrib> = { +// CHECK: [2]: <4:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecordsSharedWith // CHECK: MaxRecordsSharedWith: 1 // CHECK: } @@ -64,32 +64,38 @@ // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } +// CHECK: [4]: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } // CHECK: } // CHECK: } // CHECK: [1]: <2:IONode> = { // CHECK: IOFlagsAndKind: 6 -// CHECK: Attribs: <15:RecordArrayRef[4]> = { -// CHECK: [0]: <4:NodeShaderIOAttrib> = { +// CHECK: Attribs: <{{[0-9]+}}:RecordArrayRef[5]> = { +// CHECK: [0]: <5:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <2:NodeID> = { // CHECK: Name: "Output2ID" // CHECK: Index: 1 // CHECK: } // CHECK: } -// CHECK: [1]: <2:NodeShaderIOAttrib> -// CHECK: [2]: <5:NodeShaderIOAttrib> = { +// CHECK: [1]: <3:NodeShaderIOAttrib> +// CHECK: [2]: <6:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecords // CHECK: MaxRecords: 5 // CHECK: } // CHECK: [3]: <0:NodeShaderIOAttrib> +// CHECK: [4]: <1:NodeShaderIOAttrib> // CHECK: } // CHECK: } // CHECK: } -// CHECK: Inputs: <8:RecordArrayRef[1]> = { +// CHECK: Inputs: <{{[0-9]+}}:RecordArrayRef[1]> = { // CHECK: [0]: <0:IONode> = { // CHECK: IOFlagsAndKind: 37 -// CHECK: Attribs: <8:RecordArrayRef[1]> = { +// CHECK: Attribs: <{{[0-9]+}}:RecordArrayRef[2]> = { // CHECK: [0]: <0:NodeShaderIOAttrib> +// CHECK: [1]: <1:NodeShaderIOAttrib> // CHECK: } // CHECK: } // CHECK: } @@ -127,34 +133,38 @@ // CHECK: LocalRootArgumentsTableIndex: 2 // CHECK: } // CHECK: } -// CHECK: RecordTable (stride = {{[0-9]+}} bytes) NodeShaderIOAttribTable[6] = { +// CHECK: RecordTable (stride = {{[0-9]+}} bytes) NodeShaderIOAttribTable[7] = { // CHECK: <0:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } // CHECK: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } +// CHECK: <2:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <1:NodeID> = { // CHECK: Name: "Output1" // CHECK: Index: 0 // CHECK: } // CHECK: } -// CHECK: <2:NodeShaderIOAttrib> = { +// CHECK: <3:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputArraySize // CHECK: OutputArraySize: 0 // CHECK: } -// CHECK: <3:NodeShaderIOAttrib> = { +// CHECK: <4:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecordsSharedWith // CHECK: MaxRecordsSharedWith: 1 // CHECK: } -// CHECK: <4:NodeShaderIOAttrib> = { +// CHECK: <5:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <2:NodeID> = { // CHECK: Name: "Output2ID" // CHECK: Index: 1 // CHECK: } // CHECK: } -// CHECK: <5:NodeShaderIOAttrib> = { +// CHECK: <6:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecords // CHECK: MaxRecords: 5 // CHECK: } @@ -162,28 +172,32 @@ // CHECK: RecordTable (stride = {{[0-9]+}} bytes) IONodeTable[3] = { // CHECK: <0:IONode> = { // CHECK: IOFlagsAndKind: 37 -// CHECK: Attribs: <8:RecordArrayRef[1]> = { +// CHECK: Attribs: <8:RecordArrayRef[2]> = { // CHECK: [0]: <0:NodeShaderIOAttrib> = { // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } +// CHECK: [1]: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } // CHECK: } // CHECK: } // CHECK: <1:IONode> = { // CHECK: IOFlagsAndKind: 262 -// CHECK: Attribs: <10:RecordArrayRef[4]> = { -// CHECK: [0]: <1:NodeShaderIOAttrib> = { +// CHECK: Attribs: <13:RecordArrayRef[5]> = { +// CHECK: [0]: <2:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <1:NodeID> = { // CHECK: Name: "Output1" // CHECK: Index: 0 // CHECK: } // CHECK: } -// CHECK: [1]: <2:NodeShaderIOAttrib> = { +// CHECK: [1]: <3:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputArraySize // CHECK: OutputArraySize: 0 // CHECK: } -// CHECK: [2]: <3:NodeShaderIOAttrib> = { +// CHECK: [2]: <4:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecordsSharedWith // CHECK: MaxRecordsSharedWith: 1 // CHECK: } @@ -191,23 +205,27 @@ // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } +// CHECK: [4]: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } // CHECK: } // CHECK: } // CHECK: <2:IONode> = { // CHECK: IOFlagsAndKind: 6 -// CHECK: Attribs: <15:RecordArrayRef[4]> = { -// CHECK: [0]: <4:NodeShaderIOAttrib> = { +// CHECK: Attribs: <19:RecordArrayRef[5]> = { +// CHECK: [0]: <5:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <2:NodeID> = { // CHECK: Name: "Output2ID" // CHECK: Index: 1 // CHECK: } // CHECK: } -// CHECK: [1]: <2:NodeShaderIOAttrib> = { +// CHECK: [1]: <3:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputArraySize // CHECK: OutputArraySize: 0 // CHECK: } -// CHECK: [2]: <5:NodeShaderIOAttrib> = { +// CHECK: [2]: <6:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecords // CHECK: MaxRecords: 5 // CHECK: } @@ -215,6 +233,10 @@ // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } +// CHECK: [4]: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } // CHECK: } // CHECK: } // CHECK: } @@ -239,22 +261,22 @@ // CHECK: LocalRootArgumentsTableIndex: 2 // CHECK: } // CHECK: } -// CHECK: Outputs: <20:RecordArrayRef[2]> = { +// CHECK: Outputs: <25:RecordArrayRef[2]> = { // CHECK: [0]: <1:IONode> = { // CHECK: IOFlagsAndKind: 262 -// CHECK: Attribs: <10:RecordArrayRef[4]> = { -// CHECK: [0]: <1:NodeShaderIOAttrib> = { +// CHECK: Attribs: <13:RecordArrayRef[5]> = { +// CHECK: [0]: <2:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <1:NodeID> = { // CHECK: Name: "Output1" // CHECK: Index: 0 // CHECK: } // CHECK: } -// CHECK: [1]: <2:NodeShaderIOAttrib> = { +// CHECK: [1]: <3:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputArraySize // CHECK: OutputArraySize: 0 // CHECK: } -// CHECK: [2]: <3:NodeShaderIOAttrib> = { +// CHECK: [2]: <4:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecordsSharedWith // CHECK: MaxRecordsSharedWith: 1 // CHECK: } @@ -262,32 +284,38 @@ // CHECK: AttribKind: RecordSizeInBytes // CHECK: RecordSizeInBytes: 8 // CHECK: } +// CHECK: [4]: <1:NodeShaderIOAttrib> = { +// CHECK: AttribKind: RecordAlignmentInBytes +// CHECK: RecordAlignmentInBytes: 4 +// CHECK: } // CHECK: } // CHECK: } // CHECK: [1]: <2:IONode> = { // CHECK: IOFlagsAndKind: 6 -// CHECK: Attribs: <15:RecordArrayRef[4]> = { -// CHECK: [0]: <4:NodeShaderIOAttrib> = { +// CHECK: Attribs: <19:RecordArrayRef[5]> = { +// CHECK: [0]: <5:NodeShaderIOAttrib> = { // CHECK: AttribKind: OutputID // CHECK: OutputID: <2:NodeID> = { // CHECK: Name: "Output2ID" // CHECK: Index: 1 // CHECK: } // CHECK: } -// CHECK: [1]: <2:NodeShaderIOAttrib> -// CHECK: [2]: <5:NodeShaderIOAttrib> = { +// CHECK: [1]: <3:NodeShaderIOAttrib> +// CHECK: [2]: <6:NodeShaderIOAttrib> = { // CHECK: AttribKind: MaxRecords // CHECK: MaxRecords: 5 // CHECK: } // CHECK: [3]: <0:NodeShaderIOAttrib> +// CHECK: [4]: <1:NodeShaderIOAttrib> // CHECK: } // CHECK: } // CHECK: } -// CHECK: Inputs: <8:RecordArrayRef[1]> = { +// CHECK: Inputs: <11:RecordArrayRef[1]> = { // CHECK: [0]: <0:IONode> = { // CHECK: IOFlagsAndKind: 37 -// CHECK: Attribs: <8:RecordArrayRef[1]> = { +// CHECK: Attribs: <8:RecordArrayRef[2]> = { // CHECK: [0]: <0:NodeShaderIOAttrib> +// CHECK: [1]: <1:NodeShaderIOAttrib> // CHECK: } // CHECK: } // CHECK: } diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment-16bit.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment-16bit.hlsl new file mode 100644 index 0000000000..dc092c8d2c --- /dev/null +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment-16bit.hlsl @@ -0,0 +1,44 @@ +// RUN: %dxilver 1.8 | %dxc -T lib_6_8 -enable-16bit-types %s | %D3DReflect %s | %FileCheck %s -check-prefixes=RDAT + +// Ensure alignment field set correctly in RDAT for various node records + +RWByteAddressBuffer BAB : register(u1, space0); + +#define GLUE2(x, y) x##y +#define GLUE(x, y) GLUE2(x, y) + +#define TEST_TYPE(EntryName, CompType) \ + struct GLUE(EntryName, _record) { \ + vector x; \ + }; \ + [shader("node")] \ + [NodeLaunch("broadcasting")] \ + [NodeDispatchGrid(1, 1, 1)] \ + [NumThreads(1,1,1)] \ + void EntryName(DispatchNodeInputRecord Input) { \ + BAB.Store(0, Input.Get().x.x); \ + } + +// RDAT: FunctionTable[{{.*}}] = { + +// RDAT-LABEL: UnmangledName: "node_half" +// RDAT: RecordAlignmentInBytes: 2 +TEST_TYPE(node_half, half) + +// RDAT-LABEL: UnmangledName: "node_float16" +// RDAT: RecordAlignmentInBytes: 2 +TEST_TYPE(node_float16, float16_t) + +// RDAT-LABEL: UnmangledName: "node_int16" +// RDAT: RecordAlignmentInBytes: 2 +TEST_TYPE(node_int16, int16_t) + +// min16 types are converted to native 16-bit types. + +// RDAT-LABEL: UnmangledName: "node_min16float" +// RDAT: RecordAlignmentInBytes: 2 +TEST_TYPE(node_min16float, min16float) + +// RDAT-LABEL: UnmangledName: "node_min16int" +// RDAT: RecordAlignmentInBytes: 2 +TEST_TYPE(node_min16int, min16int) diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment.hlsl new file mode 100644 index 0000000000..fac04a239d --- /dev/null +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/node-record-alignment.hlsl @@ -0,0 +1,82 @@ +// RUN: %dxilver 1.8 | %dxc -T lib_6_8 %s | %D3DReflect %s | %FileCheck %s -check-prefixes=RDAT + +// Ensure alignment field set correctly in RDAT for various node records + +RWByteAddressBuffer BAB : register(u1, space0); + +#define GLUE2(x, y) x##y +#define GLUE(x, y) GLUE2(x, y) + +#define TEST_TYPE(EntryName, CompType) \ + struct GLUE(EntryName, _record) { \ + vector x; \ + }; \ + [shader("node")] \ + [NodeLaunch("broadcasting")] \ + [NodeDispatchGrid(1, 1, 1)] \ + [NumThreads(1,1,1)] \ + void EntryName(DispatchNodeInputRecord Input) { \ + BAB.Store(0, (uint)Input.Get().x.x); \ + } + +// RDAT: FunctionTable[{{.*}}] = { + +// RDAT-LABEL: UnmangledName: "node_half" +// RDAT: RecordAlignmentInBytes: 4 +TEST_TYPE(node_half, half) + +// RDAT-LABEL: UnmangledName: "node_float" +// RDAT: RecordAlignmentInBytes: 4 +TEST_TYPE(node_float, float) + +// RDAT-LABEL: UnmangledName: "node_double" +// RDAT: RecordAlignmentInBytes: 8 +TEST_TYPE(node_double, double) + +// RDAT-LABEL: UnmangledName: "node_int" +// RDAT: RecordAlignmentInBytes: 4 +TEST_TYPE(node_int, int) + +// RDAT-LABEL: UnmangledName: "node_uint64" +// RDAT: RecordAlignmentInBytes: 8 +TEST_TYPE(node_uint64, uint64_t) + +// Min-precision types are still 4 bytes in storage. + +// RDAT-LABEL: UnmangledName: "node_min16float" +// RDAT: RecordAlignmentInBytes: 4 +TEST_TYPE(node_min16float, min16float) + +// RDAT-LABEL: UnmangledName: "node_min16int" +// RDAT: RecordAlignmentInBytes: 4 +TEST_TYPE(node_min16int, min16int) + +// Test alignment preserved for unused input record: +// RDAT-LABEL: UnmangledName: "node_input_unused_double" +// RDAT: RecordAlignmentInBytes: 8 +struct UnusedDoubleInputRecord { + vector x; +}; +[shader("node")] +[NodeLaunch("broadcasting")] +[NodeDispatchGrid(1, 1, 1)] +[NumThreads(1,1,1)] +void node_input_unused_double( + DispatchNodeInputRecord Input) { + BAB.Store(0, 0); +} + +// Test alignment preserved for unused output record: +// RDAT-LABEL: UnmangledName: "node_output_unused_double" +// RDAT: RecordAlignmentInBytes: 8 +struct UnusedDoubleOutputRecord { + vector x; +}; +[shader("node")] +[NodeLaunch("broadcasting")] +[NodeDispatchGrid(1, 1, 1)] +[NumThreads(1,1,1)] +void node_output_unused_double( + NodeOutput Output) { + BAB.Store(0, 0); +} diff --git a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case001_dispatchgrid_shader.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case001_dispatchgrid_shader.hlsl index ad97caf946..6fa860331c 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case001_dispatchgrid_shader.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case001_dispatchgrid_shader.hlsl @@ -75,7 +75,7 @@ void node001_dispatchgrid_shader(DispatchNodeInputRecord input) // Arg #1: Size Tag (0) // Arg #2: 4 bytes // ------------------------------------------------------------------ -// CHECK-DAG: [[INPUT_NOGRID]] = !{i32 0, i32 4} +// CHECK-DAG: [[INPUT_NOGRID]] = !{i32 0, i32 4, i32 2, i32 4} // NumThreads // Arg #1: 1024 diff --git a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case014_getrecordcount_nodeinputarray.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case014_getrecordcount_nodeinputarray.hlsl index cf11cc02a5..26e705a31d 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case014_getrecordcount_nodeinputarray.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case014_getrecordcount_nodeinputarray.hlsl @@ -73,7 +73,7 @@ void node014_getrecordcount([MaxRecords(256)] GroupNodeInputRecords output) // Arg #1: Size Tag (0) // Arg #4: 4 bytes // ------------------------------------------------------------------ -// CHECK: [[OUTPUT_RECORD:![0-9]+]] = !{i32 0, i32 4} +// CHECK: [[OUTPUT_RECORD:![0-9]+]] = !{i32 0, i32 4, i32 2, i32 4} // NodeID // ------------------------------------------------------------------ diff --git a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case037_finishedcrossgroupsharing.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case037_finishedcrossgroupsharing.hlsl index fb8fd2a921..3d7b1aa966 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case037_finishedcrossgroupsharing.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/case037_finishedcrossgroupsharing.hlsl @@ -80,7 +80,7 @@ void node037_finishedcrossgroupsharing(RWDispatchNodeInputRecord i // Arg #1: Size Tag (0) // Arg #2: 4 bytes // ------------------------------------------------------------------ -// CHECK: [[INPUT_RECORD]] = !{i32 0, i32 4} +// CHECK: [[INPUT_RECORD]] = !{i32 0, i32 4, i32 2, i32 4} // NumThreads // Arg #1: 1024 diff --git a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/sparsenodes.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/sparsenodes.hlsl index 30d728d178..10335ee864 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/sparsenodes.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/sparsenodes.hlsl @@ -44,13 +44,13 @@ // Make sure AllowSparseNodes is true // Make sure OutputArraySize is -1 for [UnboundedSparseNodes] -// Starting from !"OutputArray_*": OutputID.Name, OutputID.Index, MaxRecords, MaxRecordsSharedWith, OutputArraySize, AllowSparseNodes -// HLCHECK-DAG: = !{void (%"struct.NodeOutputArray"*)* @node_1_0, {{.*}} !"OutputArray_1_0", i32 0, i32 31, i32 -1, i32 129, i1 true} -// HLCHECK-DAG: = !{void (%"struct.NodeOutputArray"*)* @node_1_1, {{.*}} !"OutputArray_1_1", i32 0, i32 37, i32 -1, i32 -1, i1 true} -// HLCHECK-DAG: = !{void (%"struct.NodeOutput"*)* @node_1_2, {{.*}} !"Output_1_2", i32 0, i32 47, i32 -1, i32 0, i1 true} -// HLCHECK-DAG: = !{void (%struct.EmptyNodeOutputArray*)* @node_2_0, {{.*}} !"OutputArray_2_0", i32 0, i32 41, i32 -1, i32 131, i1 true} -// HLCHECK-DAG: = !{void (%struct.EmptyNodeOutputArray*)* @node_2_1, {{.*}} !"OutputArray_2_1", i32 0, i32 43, i32 -1, i32 -1, i1 true} -// HLCHECK-DAG: = !{void (%struct.EmptyNodeOutput*)* @node_2_2, {{.*}} !"Output_2_2", i32 0, i32 53, i32 -1, i32 0, i1 true} +// Starting from !"OutputArray_*": OutputID.Name, OutputID.Index, MaxRecords, MaxRecordsSharedWith, OutputArraySize, AllowSparseNodes, Alignment +// HLCHECK-DAG: = !{void (%"struct.NodeOutputArray"*)* @node_1_0, {{.*}} !"OutputArray_1_0", i32 0, i32 31, i32 -1, i32 129, i1 true, i32 4} +// HLCHECK-DAG: = !{void (%"struct.NodeOutputArray"*)* @node_1_1, {{.*}} !"OutputArray_1_1", i32 0, i32 37, i32 -1, i32 -1, i1 true, i32 4} +// HLCHECK-DAG: = !{void (%"struct.NodeOutput"*)* @node_1_2, {{.*}} !"Output_1_2", i32 0, i32 47, i32 -1, i32 0, i1 true, i32 4} +// HLCHECK-DAG: = !{void (%struct.EmptyNodeOutputArray*)* @node_2_0, {{.*}} !"OutputArray_2_0", i32 0, i32 41, i32 -1, i32 131, i1 true, i32 0} +// HLCHECK-DAG: = !{void (%struct.EmptyNodeOutputArray*)* @node_2_1, {{.*}} !"OutputArray_2_1", i32 0, i32 43, i32 -1, i32 -1, i1 true, i32 0} +// HLCHECK-DAG: = !{void (%struct.EmptyNodeOutput*)* @node_2_2, {{.*}} !"Output_2_2", i32 0, i32 53, i32 -1, i32 0, i1 true, i32 0} // ==== RDAT Checks ====