From c3286daf030beb34a4430afaa71a07f1aa250a96 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Tue, 25 Aug 2026 18:39:16 -0600 Subject: [PATCH 1/2] save work --- include/dxc/DXIL/DxilConstants.h | 3 + include/dxc/DXIL/DxilOperations.h | 1 + include/dxc/DXIL/DxilShaderFlags.h | 11 +- .../DxilPipelineStateValidation.h | 317 +++++++++++++++- .../dxc/DxilContainer/RDAT_LibraryTypes.inl | 1 + lib/DXIL/DxilOperations.cpp | 16 +- lib/DXIL/DxilShaderFlags.cpp | 8 +- lib/DxilContainer/DxilContainerAssembler.cpp | 341 ++++++++++++++++++ .../DxilPipelineStateValidation.cpp | 91 +++++ .../DxilContainerValidation.cpp | 81 +++++ lib/HLSL/DxilPreparePasses.cpp | 2 +- tools/clang/test/DXC/dumpPSV_LinAlg.hlsl | 56 +++ .../LinAlgMatrix/linalgmatrix-copyconvert.ll | 2 +- .../linalgmatrix-groupshared-vector-memory.ll | 2 +- .../linalgmatrix-illegal-component-type.ll | 2 +- .../linalgmatrix-matrixaccumulate.ll | 2 +- ...nalgmatrix-matrixaccumulatetodescriptor.ll | 3 +- .../linalgmatrix-matrixloadfromdescriptor.ll | 3 +- .../linalgmatrix-matrixmultiply.ll | 3 +- .../linalgmatrix-matrixmultiplyaccumulate.ll | 3 +- .../linalgmatrix-matrixstoretodescriptor.ll | 3 +- .../LinAlgMatrix/linalgmatrix-matvecmul.ll | 2 +- .../LinAlgMatrix/linalgmatrix-matvecmuladd.ll | 2 +- .../LinAlgMatrix/linalgmatrix-max-k-dim.ll | 2 +- .../linalgmatrix-non-thread-ops.ll | 3 +- .../LinAlgMatrix/linalgmatrix-outerproduct.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-anyhit.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-as.ll | 3 +- .../linalgmatrix-stage-callable.ll | 3 +- .../linalgmatrix-stage-closesthit.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-cs.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-ds.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-gs.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-hs.ll | 3 +- .../linalgmatrix-stage-intersection.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-miss.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-ms.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-node.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-ps.ll | 3 +- .../linalgmatrix-stage-raygeneration.ll | 3 +- .../LinAlgMatrix/linalgmatrix-stage-vs.ll | 3 +- .../LinAlgMatrix/linalgmatrix-undef-param.ll | 2 +- ...nalgmatrix-vectoraccumulatetodescriptor.ll | 3 +- 43 files changed, 950 insertions(+), 63 deletions(-) create mode 100644 tools/clang/test/DXC/dumpPSV_LinAlg.hlsl diff --git a/include/dxc/DXIL/DxilConstants.h b/include/dxc/DXIL/DxilConstants.h index 7d7d7d74e5..d9226d8d0b 100644 --- a/include/dxc/DXIL/DxilConstants.h +++ b/include/dxc/DXIL/DxilConstants.h @@ -2370,6 +2370,9 @@ const uint64_t ShaderFeatureInfo_ExtendedCommandInfo = 0x100000000; // Experimental SM 6.9+ - Reserved, not yet supported. const uint64_t ShaderFeatureInfo_Reserved = 0x8000000; +// SM 6.10+ +const uint64_t ShaderFeatureInfo_LinearAlgebra = 0x200000000; + // Maximum count without rolling over into another 64-bit field is 40, // so the last flag we can use for a feature requirement is: 0x8000000000 // This is because of the following set of flags, considered optional diff --git a/include/dxc/DXIL/DxilOperations.h b/include/dxc/DXIL/DxilOperations.h index 210d9c6593..a119e735cc 100644 --- a/include/dxc/DXIL/DxilOperations.h +++ b/include/dxc/DXIL/DxilOperations.h @@ -147,6 +147,7 @@ class OP { static bool IsDxilOpFuncName(llvm::StringRef name); static bool IsDxilOpFunc(const llvm::Function *F); static bool IsDxilOpLinAlgFuncName(llvm::StringRef Name); + static bool IsDxilOpLinAlgFunc(const llvm::Function *F); static bool IsDxilOpFuncCallInst(const llvm::Instruction *I); static bool IsDxilOpFuncCallInst(const llvm::Instruction *I, OpCode opcode); static bool IsDxilOpWave(OpCode C); diff --git a/include/dxc/DXIL/DxilShaderFlags.h b/include/dxc/DXIL/DxilShaderFlags.h index 7b065c63fa..0458d3280d 100644 --- a/include/dxc/DXIL/DxilShaderFlags.h +++ b/include/dxc/DXIL/DxilShaderFlags.h @@ -219,6 +219,10 @@ class ShaderFlags { void SetRequiresGroup(bool flag) { m_bRequiresGroup = flag; } bool GetRequiresGroup() const { return m_bRequiresGroup; } + // SM 6.10+ + void SetLinearAlgebra(bool flag) { m_bLinearAlgebra = flag; } + bool GetLinearAlgebra() const { return m_bLinearAlgebra; } + private: // Bit: 0 unsigned @@ -359,7 +363,12 @@ class ShaderFlags { unsigned m_bRequiresGroup : 1; // SHADER_FEATURE_OPT_REQUIRES_GROUP // (OptFeatureInfo_RequiresGroup) - uint32_t m_align1 : 23; // align to 64 bit. + // SM 6.10+ + // m_bLinearAlgebra indicates the shader uses LinearAlgebra features. + // Bit: 41 + unsigned m_bLinearAlgebra : 1; // SHADER_FEATURE_LINEAR_ALGEBRA + + uint32_t m_align1 : 22; // align to 64 bit. }; } // namespace hlsl diff --git a/include/dxc/DxilContainer/DxilPipelineStateValidation.h b/include/dxc/DxilContainer/DxilPipelineStateValidation.h index 87919f7df8..af298b637d 100644 --- a/include/dxc/DxilContainer/DxilPipelineStateValidation.h +++ b/include/dxc/DxilContainer/DxilPipelineStateValidation.h @@ -175,8 +175,88 @@ struct PSVRuntimeInfo3 : public PSVRuntimeInfo2 { uint32_t EntryFunctionName; }; +enum class PSVRuntimeInfo4Flag : uint32_t { + None = 0x00000000, + LinAlgRuntimeInfoPresent = 0x00000001, +}; + struct PSVRuntimeInfo4 : public PSVRuntimeInfo3 { uint32_t NumBytesGroupSharedMemory; + uint32_t Flags; // PSVRuntimeInfo4Flag +}; + +struct PSVLinAlgRuntimeInfo0 { + uint32_t MatrixOperationShapeCount; + uint32_t MatrixConstructionCount; + uint32_t ThreadMatrixVectorMultiplyCount; + uint32_t WaveMatrixMultiplyCount; + uint32_t ThreadGroupMatrixMultiplyCount; + uint32_t OuterProductCount; + uint32_t AccumulateStoreCount; +}; + +struct PSVLinAlgMatrixOperationShape0 { + uint32_t M; + uint32_t N; + uint32_t K; +}; + +struct PSVLinAlgMatrixShapeArrayReference { + uint32_t ShapesIndex; + uint32_t Count; +}; + +struct PSVLinAlgMatrixConstruction0 { + PSVLinAlgMatrixShapeArrayReference OperationShapes; + uint8_t MatrixType; + uint8_t Reserved[3]; +}; + +enum class PSVLinAlgThreadMatrixVectorMultiplyFlag : uint8_t { + None = 0, + MatrixTransposed = 1 << 0, + MatrixNonMulOptimalLayout = 1 << 1, +}; + +struct PSVLinAlgThreadMatrixVectorMultiply0 { + uint8_t ResultType; + uint8_t MatrixType; + uint8_t VectorInputType; + uint8_t Flags; // PSVLinAlgThreadMatrixVectorMultiplyFlag +}; + +struct PSVLinAlgWaveMatrixMultiply0 { + PSVLinAlgMatrixShapeArrayReference OperationShapes; + uint8_t AccumulatorType; + uint8_t MatrixAType; + uint8_t MatrixBType; + uint8_t Reserved; +}; + +struct PSVLinAlgThreadGroupMatrixMultiply0 { + PSVLinAlgMatrixShapeArrayReference OperationShapes; + uint8_t AccumulatorType; + uint8_t MatrixAType; + uint8_t MatrixBType; + uint8_t Reserved; +}; + +struct PSVLinAlgOuterProduct0 { + uint8_t ResultType; + uint8_t VectorInputType; + uint8_t Reserved[2]; +}; + +enum class PSVLinAlgAccumulateStoreFlag : uint8_t { + None = 0, + RawBuffer = 1 << 0, + GroupShared = 1 << 1, +}; + +struct PSVLinAlgAccumulateStore0 { + uint8_t AccumulatorType; + uint8_t Flags; // PSVLinAlgAccumulateStoreFlag + uint8_t Reserved[2]; }; enum class PSVResourceType { @@ -494,6 +574,30 @@ struct PSVInitInfo { uint8_t SigInputVectors = 0; uint8_t SigPatchConstOrPrimVectors = 0; uint8_t SigOutputVectors[PSV_GS_MAX_STREAMS] = {0, 0, 0, 0}; + const PSVLinAlgMatrixOperationShape0 *LinAlgMatrixOperationShapes = nullptr; + uint32_t LinAlgMatrixOperationShapeCount = 0; + const PSVLinAlgMatrixConstruction0 *LinAlgMatrixConstructions = nullptr; + uint32_t LinAlgMatrixConstructionCount = 0; + const PSVLinAlgThreadMatrixVectorMultiply0 + *LinAlgThreadMatrixVectorMultiplies = nullptr; + uint32_t LinAlgThreadMatrixVectorMultiplyCount = 0; + const PSVLinAlgWaveMatrixMultiply0 *LinAlgWaveMatrixMultiplies = nullptr; + uint32_t LinAlgWaveMatrixMultiplyCount = 0; + const PSVLinAlgThreadGroupMatrixMultiply0 *LinAlgThreadGroupMatrixMultiplies = + nullptr; + uint32_t LinAlgThreadGroupMatrixMultiplyCount = 0; + const PSVLinAlgOuterProduct0 *LinAlgOuterProducts = nullptr; + uint32_t LinAlgOuterProductCount = 0; + const PSVLinAlgAccumulateStore0 *LinAlgAccumulateStores = nullptr; + uint32_t LinAlgAccumulateStoreCount = 0; + + bool HasLinAlgRuntimeInfo() const { + return LinAlgMatrixConstructionCount || + LinAlgThreadMatrixVectorMultiplyCount || + LinAlgWaveMatrixMultiplyCount || + LinAlgThreadGroupMatrixMultiplyCount || LinAlgOuterProductCount || + LinAlgAccumulateStoreCount; + } static_assert(MAX_PSV_VERSION == 4, "otherwise this needs updating."); uint32_t RuntimeInfoSize() const { @@ -542,6 +646,22 @@ class DxilPipelineStateValidation { nullptr, nullptr}; uint32_t *m_pInputToPCOutputTable = nullptr; uint32_t *m_pPCInputToOutputTable = nullptr; + uint32_t m_uPSVLinAlgRuntimeInfoSize = 0; + PSVLinAlgRuntimeInfo0 *m_pPSVLinAlgRuntimeInfo0 = nullptr; + uint32_t m_uPSVLinAlgMatrixOperationShapeSize = 0; + void *m_pPSVLinAlgMatrixOperationShapes = nullptr; + uint32_t m_uPSVLinAlgMatrixConstructionSize = 0; + void *m_pPSVLinAlgMatrixConstructions = nullptr; + uint32_t m_uPSVLinAlgThreadMatrixVectorMultiplySize = 0; + void *m_pPSVLinAlgThreadMatrixVectorMultiplies = nullptr; + uint32_t m_uPSVLinAlgWaveMatrixMultiplySize = 0; + void *m_pPSVLinAlgWaveMatrixMultiplies = nullptr; + uint32_t m_uPSVLinAlgThreadGroupMatrixMultiplySize = 0; + void *m_pPSVLinAlgThreadGroupMatrixMultiplies = nullptr; + uint32_t m_uPSVLinAlgOuterProductSize = 0; + void *m_pPSVLinAlgOuterProducts = nullptr; + uint32_t m_uPSVLinAlgAccumulateStoreSize = 0; + void *m_pPSVLinAlgAccumulateStores = nullptr; public: DxilPipelineStateValidation() {} @@ -643,6 +763,101 @@ class DxilPipelineStateValidation { PSVRuntimeInfo4 *GetPSVRuntimeInfo4() const { return m_pPSVRuntimeInfo4; } + PSVLinAlgRuntimeInfo0 *GetPSVLinAlgRuntimeInfo0() const { + return m_pPSVLinAlgRuntimeInfo0; + } + + uint32_t GetPSVLinAlgMatrixOperationShapeCount() const { + return m_pPSVLinAlgRuntimeInfo0 + ? m_pPSVLinAlgRuntimeInfo0->MatrixOperationShapeCount + : 0; + } + + PSVLinAlgMatrixOperationShape0 * + GetPSVLinAlgMatrixOperationShape(uint32_t index) const { + return GetRecord( + m_pPSVLinAlgMatrixOperationShapes, m_uPSVLinAlgMatrixOperationShapeSize, + GetPSVLinAlgMatrixOperationShapeCount(), index); + } + + uint32_t GetPSVLinAlgMatrixConstructionCount() const { + return m_pPSVLinAlgRuntimeInfo0 + ? m_pPSVLinAlgRuntimeInfo0->MatrixConstructionCount + : 0; + } + + PSVLinAlgMatrixConstruction0 * + GetPSVLinAlgMatrixConstruction(uint32_t index) const { + return GetRecord( + m_pPSVLinAlgMatrixConstructions, m_uPSVLinAlgMatrixConstructionSize, + GetPSVLinAlgMatrixConstructionCount(), index); + } + + uint32_t GetPSVLinAlgThreadMatrixVectorMultiplyCount() const { + return m_pPSVLinAlgRuntimeInfo0 + ? m_pPSVLinAlgRuntimeInfo0->ThreadMatrixVectorMultiplyCount + : 0; + } + + PSVLinAlgThreadMatrixVectorMultiply0 * + GetPSVLinAlgThreadMatrixVectorMultiply(uint32_t index) const { + return GetRecord( + m_pPSVLinAlgThreadMatrixVectorMultiplies, + m_uPSVLinAlgThreadMatrixVectorMultiplySize, + GetPSVLinAlgThreadMatrixVectorMultiplyCount(), index); + } + + uint32_t GetPSVLinAlgWaveMatrixMultiplyCount() const { + return m_pPSVLinAlgRuntimeInfo0 + ? m_pPSVLinAlgRuntimeInfo0->WaveMatrixMultiplyCount + : 0; + } + + PSVLinAlgWaveMatrixMultiply0 * + GetPSVLinAlgWaveMatrixMultiply(uint32_t index) const { + return GetRecord( + m_pPSVLinAlgWaveMatrixMultiplies, m_uPSVLinAlgWaveMatrixMultiplySize, + GetPSVLinAlgWaveMatrixMultiplyCount(), index); + } + + uint32_t GetPSVLinAlgThreadGroupMatrixMultiplyCount() const { + return m_pPSVLinAlgRuntimeInfo0 + ? m_pPSVLinAlgRuntimeInfo0->ThreadGroupMatrixMultiplyCount + : 0; + } + + PSVLinAlgThreadGroupMatrixMultiply0 * + GetPSVLinAlgThreadGroupMatrixMultiply(uint32_t index) const { + return GetRecord( + m_pPSVLinAlgThreadGroupMatrixMultiplies, + m_uPSVLinAlgThreadGroupMatrixMultiplySize, + GetPSVLinAlgThreadGroupMatrixMultiplyCount(), index); + } + + uint32_t GetPSVLinAlgOuterProductCount() const { + return m_pPSVLinAlgRuntimeInfo0 + ? m_pPSVLinAlgRuntimeInfo0->OuterProductCount + : 0; + } + + PSVLinAlgOuterProduct0 *GetPSVLinAlgOuterProduct(uint32_t index) const { + return GetRecord( + m_pPSVLinAlgOuterProducts, m_uPSVLinAlgOuterProductSize, + GetPSVLinAlgOuterProductCount(), index); + } + + uint32_t GetPSVLinAlgAccumulateStoreCount() const { + return m_pPSVLinAlgRuntimeInfo0 + ? m_pPSVLinAlgRuntimeInfo0->AccumulateStoreCount + : 0; + } + + PSVLinAlgAccumulateStore0 *GetPSVLinAlgAccumulateStore(uint32_t index) const { + return GetRecord( + m_pPSVLinAlgAccumulateStores, m_uPSVLinAlgAccumulateStoreSize, + GetPSVLinAlgAccumulateStoreCount(), index); + } + uint32_t GetBindCount() const { return m_uResourceCount; } template @@ -938,6 +1153,12 @@ inline void DxilPipelineStateValidation::CheckedReaderWriter::Clear() { // PSVComputeInputOutputTableDwords(SigPatchConstOrPrimVectors, // SigOutputVectors[0]) } // - Outputs affected by patch constant inputs as a table of bitmasks +// If PSVRuntimeInfo4::Flags has LinAlgRuntimeInfoPresent: +// uint32_t PSVLinAlgRuntimeInfo_size +// { PSVLinAlgRuntimeInfoN structure } +// For each non-empty LinAlg record table, in declaration order: +// uint32_t record_size +// { record } * record_count // returns true if no errors occurred. inline bool DxilPipelineStateValidation::ReadOrWrite(const void *pBits, uint32_t *pSize, @@ -963,11 +1184,22 @@ DxilPipelineStateValidation::ReadOrWrite(const void *pBits, uint32_t *pSize, // In RWMode::CalcSize, use temp runtime info to hold needed values from // initInfo - PSVRuntimeInfo1 tempRuntimeInfo = {}; + PSVRuntimeInfo4 tempRuntimeInfo = {}; if (mode == RWMode::CalcSize && initInfo.PSVVersion > 0) { m_pPSVRuntimeInfo1 = &tempRuntimeInfo; + if (initInfo.PSVVersion > 1) + m_pPSVRuntimeInfo2 = &tempRuntimeInfo; + if (initInfo.PSVVersion > 2) + m_pPSVRuntimeInfo3 = &tempRuntimeInfo; + if (initInfo.PSVVersion > 3) + m_pPSVRuntimeInfo4 = &tempRuntimeInfo; } + if (mode != RWMode::Read && m_pPSVRuntimeInfo4 && + initInfo.HasLinAlgRuntimeInfo()) + m_pPSVRuntimeInfo4->Flags |= + static_cast(PSVRuntimeInfo4Flag::LinAlgRuntimeInfoPresent); + PSV_RETB(rw.MapValue(&m_uResourceCount, initInfo.ResourceCount)); if (m_uResourceCount > 0) { @@ -1092,9 +1324,90 @@ DxilPipelineStateValidation::ReadOrWrite(const void *pBits, uint32_t *pSize, } } + bool HasLinAlgRuntimeInfo = + m_pPSVRuntimeInfo4 && + (m_pPSVRuntimeInfo4->Flags & + static_cast(PSVRuntimeInfo4Flag::LinAlgRuntimeInfoPresent)); + PSVLinAlgRuntimeInfo0 tempLinAlgRuntimeInfo = {}; + if (HasLinAlgRuntimeInfo) { + PSV_RETB(rw.MapValue(&m_uPSVLinAlgRuntimeInfoSize, + static_cast(sizeof(PSVLinAlgRuntimeInfo0)))); + PSV_RETB(sizeof(PSVLinAlgRuntimeInfo0) <= m_uPSVLinAlgRuntimeInfoSize); + PSV_RETB( + rw.MapArray(&m_pPSVLinAlgRuntimeInfo0, 1, m_uPSVLinAlgRuntimeInfoSize)); + if (mode == RWMode::CalcSize) + m_pPSVLinAlgRuntimeInfo0 = &tempLinAlgRuntimeInfo; + + if (mode != RWMode::Read) { + m_pPSVLinAlgRuntimeInfo0->MatrixOperationShapeCount = + initInfo.LinAlgMatrixOperationShapeCount; + m_pPSVLinAlgRuntimeInfo0->MatrixConstructionCount = + initInfo.LinAlgMatrixConstructionCount; + m_pPSVLinAlgRuntimeInfo0->ThreadMatrixVectorMultiplyCount = + initInfo.LinAlgThreadMatrixVectorMultiplyCount; + m_pPSVLinAlgRuntimeInfo0->WaveMatrixMultiplyCount = + initInfo.LinAlgWaveMatrixMultiplyCount; + m_pPSVLinAlgRuntimeInfo0->ThreadGroupMatrixMultiplyCount = + initInfo.LinAlgThreadGroupMatrixMultiplyCount; + m_pPSVLinAlgRuntimeInfo0->OuterProductCount = + initInfo.LinAlgOuterProductCount; + m_pPSVLinAlgRuntimeInfo0->AccumulateStoreCount = + initInfo.LinAlgAccumulateStoreCount; + } + +#define PSV_MAP_LINALG_TABLE(Record, CountField, SizeField, DataField, \ + InitData) \ + if (m_pPSVLinAlgRuntimeInfo0->CountField) { \ + PSV_RETB(rw.MapValue(&SizeField, static_cast(sizeof(Record)))); \ + PSV_RETB(sizeof(Record) <= SizeField); \ + PSV_RETB(rw.MapArray(&DataField, m_pPSVLinAlgRuntimeInfo0->CountField, \ + SizeField)); \ + if (mode == RWMode::Write) { \ + PSV_RETB(InitData != nullptr); \ + memcpy(DataField, InitData, \ + sizeof(Record) * m_pPSVLinAlgRuntimeInfo0->CountField); \ + } \ + } + + PSV_MAP_LINALG_TABLE( + PSVLinAlgMatrixOperationShape0, MatrixOperationShapeCount, + m_uPSVLinAlgMatrixOperationShapeSize, m_pPSVLinAlgMatrixOperationShapes, + initInfo.LinAlgMatrixOperationShapes); + PSV_MAP_LINALG_TABLE(PSVLinAlgMatrixConstruction0, MatrixConstructionCount, + m_uPSVLinAlgMatrixConstructionSize, + m_pPSVLinAlgMatrixConstructions, + initInfo.LinAlgMatrixConstructions); + PSV_MAP_LINALG_TABLE(PSVLinAlgThreadMatrixVectorMultiply0, + ThreadMatrixVectorMultiplyCount, + m_uPSVLinAlgThreadMatrixVectorMultiplySize, + m_pPSVLinAlgThreadMatrixVectorMultiplies, + initInfo.LinAlgThreadMatrixVectorMultiplies); + PSV_MAP_LINALG_TABLE(PSVLinAlgWaveMatrixMultiply0, WaveMatrixMultiplyCount, + m_uPSVLinAlgWaveMatrixMultiplySize, + m_pPSVLinAlgWaveMatrixMultiplies, + initInfo.LinAlgWaveMatrixMultiplies); + PSV_MAP_LINALG_TABLE(PSVLinAlgThreadGroupMatrixMultiply0, + ThreadGroupMatrixMultiplyCount, + m_uPSVLinAlgThreadGroupMatrixMultiplySize, + m_pPSVLinAlgThreadGroupMatrixMultiplies, + initInfo.LinAlgThreadGroupMatrixMultiplies); + PSV_MAP_LINALG_TABLE( + PSVLinAlgOuterProduct0, OuterProductCount, m_uPSVLinAlgOuterProductSize, + m_pPSVLinAlgOuterProducts, initInfo.LinAlgOuterProducts); + PSV_MAP_LINALG_TABLE(PSVLinAlgAccumulateStore0, AccumulateStoreCount, + m_uPSVLinAlgAccumulateStoreSize, + m_pPSVLinAlgAccumulateStores, + initInfo.LinAlgAccumulateStores); +#undef PSV_MAP_LINALG_TABLE + } + if (mode == RWMode::CalcSize) { *pSize = rw.GetSize(); - m_pPSVRuntimeInfo1 = nullptr; // clear ptr to tempRuntimeInfo + m_pPSVRuntimeInfo1 = nullptr; + m_pPSVRuntimeInfo2 = nullptr; + m_pPSVRuntimeInfo3 = nullptr; + m_pPSVRuntimeInfo4 = nullptr; + m_pPSVLinAlgRuntimeInfo0 = nullptr; } return true; } diff --git a/include/dxc/DxilContainer/RDAT_LibraryTypes.inl b/include/dxc/DxilContainer/RDAT_LibraryTypes.inl index dd5c8e5f69..5fbad24785 100644 --- a/include/dxc/DxilContainer/RDAT_LibraryTypes.inl +++ b/include/dxc/DxilContainer/RDAT_LibraryTypes.inl @@ -83,6 +83,7 @@ RDAT_ENUM_END() // High 32-bits of ShaderFeatureInfo from DFCC_FeatureInfo RDAT_ENUM_START(DxilFeatureInfo2, uint32_t) RDAT_ENUM_VALUE(ExtendedCommandInfo, 0x1) + RDAT_ENUM_VALUE(LinearAlgebra, 0x2) // OptFeatureInfo flags RDAT_ENUM_VALUE(Opt_UsesDerivatives, 0x100) RDAT_ENUM_VALUE(Opt_RequiresGroup, 0x200) diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index 8dd92ce0fd..5fa649ace2 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -3316,10 +3316,6 @@ bool OP::IsDxilOpFuncName(StringRef name) { return name.startswith(OP::m_NamePrefix); } -bool OP::IsDxilOpLinAlgFuncName(StringRef Name) { - return Name.startswith(OP::m_LinAlgNamePrefix); -} - bool OP::IsDxilOpFunc(const llvm::Function *F) { // Test for null to allow IsDxilOpFunc(Call.getCalledFunc()) to be resilient // to indirect calls @@ -3328,6 +3324,18 @@ bool OP::IsDxilOpFunc(const llvm::Function *F) { return IsDxilOpFuncName(F->getName()); } +bool OP::IsDxilOpLinAlgFuncName(StringRef Name) { + return Name.startswith(OP::m_LinAlgNamePrefix); +} + +bool OP::IsDxilOpLinAlgFunc(const llvm::Function *F) { + // Test for null to allow IsDxilOpLinAlgFunc(Call.getCalledFunc()) to be + // resilient to indirect calls + if (F == nullptr || !F->hasName()) + return false; + return IsDxilOpLinAlgFuncName(F->getName()); +} + bool OP::IsDxilOpFuncCallInst(const llvm::Instruction *I) { const CallInst *CI = dyn_cast(I); if (CI == nullptr) diff --git a/lib/DXIL/DxilShaderFlags.cpp b/lib/DXIL/DxilShaderFlags.cpp index 90b7d033b5..b3f2e36f06 100644 --- a/lib/DXIL/DxilShaderFlags.cpp +++ b/lib/DXIL/DxilShaderFlags.cpp @@ -47,7 +47,7 @@ ShaderFlags::ShaderFlags() m_bAdvancedTextureOps(false), m_bWriteableMSAATextures(false), m_bReserved(false), m_bSampleCmpGradientOrBias(false), m_bExtendedCommandInfo(false), m_bUsesDerivatives(false), - m_bRequiresGroup(false), m_align1(0) { + m_bRequiresGroup(false), m_bLinearAlgebra(false), m_align1(0) { // Silence unused field warnings (void)m_align1; } @@ -132,6 +132,7 @@ uint64_t ShaderFlags::GetFeatureInfo() const { Flags |= m_bExtendedCommandInfo ? hlsl::DXIL::ShaderFeatureInfo_ExtendedCommandInfo : 0; + Flags |= m_bLinearAlgebra ? hlsl::DXIL::ShaderFeatureInfo_LinearAlgebra : 0; // Per-function flags Flags |= m_bUsesDerivatives ? hlsl::DXIL::OptFeatureInfo_UsesDerivatives : 0; @@ -198,6 +199,7 @@ uint64_t ShaderFlags::GetShaderFlagsRawForCollection() { Flags.SetWriteableMSAATextures(true); Flags.SetSampleCmpGradientOrBias(true); Flags.SetExtendedCommandInfo(true); + Flags.SetLinearAlgebra(true); Flags.SetUsesDerivatives(true); Flags.SetRequiresGroup(true); return Flags.GetShaderFlagsRaw(); @@ -445,6 +447,7 @@ ShaderFlags ShaderFlags::CollectShaderFlags(const Function *F, bool hasSampleCmpGradientOrBias = false; bool hasExtendedCommandInfo = false; + bool hasLinearAlgebra = false; // UsesDerivatives is used to indicate any derivative use per-function, before // flags are combined from called functions. Later, the flags are adjusted for @@ -584,6 +587,8 @@ ShaderFlags ShaderFlags::CollectShaderFlags(const Function *F, DXIL::OpCode dxilOp = hlsl::OP::getOpCode(CI); if (dxilOp == DXIL::OpCode::NumOpCodes) continue; + if (hlsl::OP::IsDxilOpLinAlgFunc(CI->getCalledFunction())) + hasLinearAlgebra = true; if (hlsl::OP::IsDxilOpWave(dxilOp)) hasWaveOps = true; if (hlsl::OP::IsDxilOpFeedback(dxilOp)) @@ -861,6 +866,7 @@ ShaderFlags ShaderFlags::CollectShaderFlags(const Function *F, !M->GetResMayAlias()); flag.SetSampleCmpGradientOrBias(hasSampleCmpGradientOrBias); flag.SetExtendedCommandInfo(hasExtendedCommandInfo); + flag.SetLinearAlgebra(hasLinearAlgebra); flag.SetUsesDerivatives(hasDerivatives); flag.SetRequiresGroup(requiresGroup); diff --git a/lib/DxilContainer/DxilContainerAssembler.cpp b/lib/DxilContainer/DxilContainerAssembler.cpp index d865971e47..736d864049 100644 --- a/lib/DxilContainer/DxilContainerAssembler.cpp +++ b/lib/DxilContainer/DxilContainerAssembler.cpp @@ -31,6 +31,7 @@ #include "llvm/ADT/MapVector.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetVector.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/IR/DebugInfo.h" #include "llvm/IR/Instructions.h" @@ -42,6 +43,8 @@ #include #include // Needed for DxilPipelineStateValidation.h #include +#include +#include using namespace llvm; using namespace hlsl; @@ -679,6 +682,14 @@ unsigned hlsl::LoadViewIDStateFromPSV(unsigned *pOutputData, class DxilPSVWriter : public DxilPartWriter { private: + struct LinAlgMatrixInfo { + DXIL::ComponentType Type = DXIL::ComponentType::Invalid; + uint32_t M = 0; + uint32_t N = 0; + DXIL::MatrixUse Use = DXIL::MatrixUse::A; + DXIL::MatrixScope Scope = DXIL::MatrixScope::Thread; + }; + const DxilModule &m_Module; unsigned m_ValMajor = 0, m_ValMinor = 0; PSVInitInfo m_PSVInitInfo; @@ -690,8 +701,335 @@ class DxilPSVWriter : public DxilPartWriter { std::vector m_SigInputElements; std::vector m_SigOutputElements; std::vector m_SigPatchConstOrPrimElements; + std::vector m_LinAlgShapes; + std::vector m_LinAlgConstructions; + std::vector + m_LinAlgThreadMatrixVectorMultiplies; + std::vector m_LinAlgWaveMatrixMultiplies; + std::vector + m_LinAlgThreadGroupMatrixMultiplies; + std::vector m_LinAlgOuterProducts; + std::vector m_LinAlgAccumulateStores; unsigned EntryFunctionName = 0; + static bool GetLinAlgMatrixInfo(Type *Ty, LinAlgMatrixInfo &Info) { + if (!dxilutil::IsHLSLLinAlgMatrixType(Ty)) + return false; + StringRef Mangling = + dxilutil::GetHLSLLinAlgMatrixTypeMangling(cast(Ty)); + unsigned TypeValue, UseValue, ScopeValue; + if (sscanf(Mangling.str().c_str(), "C%uM%uN%uU%uS%u", &TypeValue, &Info.M, + &Info.N, &UseValue, &ScopeValue) != 5) + return false; + Info.Type = static_cast(TypeValue); + Info.Use = static_cast(UseValue); + Info.Scope = static_cast(ScopeValue); + return true; + } + + static DXIL::ComponentType GetScalarComponentType(Type *Ty, + bool IsSigned = true) { + if (Ty->isHalfTy()) + return DXIL::ComponentType::F16; + if (Ty->isFloatTy()) + return DXIL::ComponentType::F32; + if (Ty->isDoubleTy()) + return DXIL::ComponentType::F64; + if (!Ty->isIntegerTy()) + return DXIL::ComponentType::Invalid; + switch (Ty->getIntegerBitWidth()) { + case 8: + return IsSigned ? DXIL::ComponentType::I8 : DXIL::ComponentType::U8; + case 16: + return IsSigned ? DXIL::ComponentType::I16 : DXIL::ComponentType::U16; + case 32: + return IsSigned ? DXIL::ComponentType::I32 : DXIL::ComponentType::U32; + case 64: + return IsSigned ? DXIL::ComponentType::I64 : DXIL::ComponentType::U64; + default: + return DXIL::ComponentType::Invalid; + } + } + + static DXIL::ComponentType GetVectorComponentType(Type *Ty, + bool IsSigned = true) { + if (VectorType *VT = dyn_cast(Ty)) + return GetScalarComponentType(VT->getElementType(), IsSigned); + return GetScalarComponentType(Ty, IsSigned); + } + + uint32_t AddLinAlgShape(uint32_t M, uint32_t N, uint32_t K) { + for (uint32_t I = 0; I < m_LinAlgShapes.size(); ++I) { + const auto &Shape = m_LinAlgShapes[I]; + if (Shape.M == M && Shape.N == N && Shape.K == K) + return I; + } + m_LinAlgShapes.push_back({M, N, K}); + return static_cast(m_LinAlgShapes.size() - 1); + } + + uint32_t AddShapeIndexArray(ArrayRef ShapeIndexes) { + for (uint32_t Offset = 0; + Offset + ShapeIndexes.size() <= m_SemanticIndexBuffer.size(); + ++Offset) { + if (std::equal(ShapeIndexes.begin(), ShapeIndexes.end(), + m_SemanticIndexBuffer.begin() + Offset)) + return Offset; + } + uint32_t Offset = static_cast(m_SemanticIndexBuffer.size()); + m_SemanticIndexBuffer.append(ShapeIndexes.begin(), ShapeIndexes.end()); + return Offset; + } + + static void AddUniqueIndex(std::vector &Indexes, uint32_t Index) { + if (std::find(Indexes.begin(), Indexes.end(), Index) == Indexes.end()) + Indexes.push_back(Index); + } + + uint8_t GetMatVecLayoutFlags(Value *Matrix) const { + SmallVector Worklist(1, Matrix); + SmallPtrSet Visited; + uint8_t Flags = 0; + while (!Worklist.empty()) { + Value *V = Worklist.pop_back_val(); + if (!Visited.insert(V).second) + continue; + if (CallInst *CI = dyn_cast(V)) { + DXIL::OpCode OpCode = OP::getOpCode(CI); + if (OpCode == DXIL::OpCode::LinAlgMatrixLoadFromDescriptor) { + auto *Layout = dyn_cast(CI->getArgOperand(4)); + if (!Layout) + continue; + DXIL::MatrixLayout LayoutValue = + static_cast(Layout->getZExtValue()); + if (LayoutValue == DXIL::MatrixLayout::MulOptimalTranspose) + Flags |= static_cast( + PSVLinAlgThreadMatrixVectorMultiplyFlag::MatrixTransposed); + else if (LayoutValue != DXIL::MatrixLayout::MulOptimal) + Flags |= + static_cast(PSVLinAlgThreadMatrixVectorMultiplyFlag:: + MatrixNonMulOptimalLayout); + } else if (OpCode == DXIL::OpCode::LinAlgCopyConvertMatrix) { + Worklist.push_back(CI->getArgOperand(1)); + } + } else if (PHINode *Phi = dyn_cast(V)) { + Worklist.append(Phi->incoming_values().begin(), + Phi->incoming_values().end()); + } else if (SelectInst *Select = dyn_cast(V)) { + Worklist.push_back(Select->getTrueValue()); + Worklist.push_back(Select->getFalseValue()); + } + } + return Flags; + } + + void CollectLinAlgRuntimeInfo() { + using ConstructionKey = std::pair; + using MultiplyKey = std::tuple; + std::map> ConstructionShapes; + std::map> MultiplyShapes; + + auto CollectConstruction = [&](Type *Ty) { + LinAlgMatrixInfo Matrix; + if (!GetLinAlgMatrixInfo(Ty, Matrix) || + Matrix.Scope == DXIL::MatrixScope::Thread) + return; + uint32_t M = Matrix.Use == DXIL::MatrixUse::B ? 0 : Matrix.M; + uint32_t N = Matrix.Use == DXIL::MatrixUse::A ? 0 : Matrix.N; + uint32_t K = + Matrix.Use == DXIL::MatrixUse::Accumulator + ? 0 + : (Matrix.Use == DXIL::MatrixUse::A ? Matrix.N : Matrix.M); + uint32_t Shape = AddLinAlgShape(M, N, K); + AddUniqueIndex(ConstructionShapes[{static_cast(Matrix.Type), + static_cast(Matrix.Use)}], + Shape); + }; + + for (const Function &F : m_Module.GetModule()->functions()) { + for (const BasicBlock &BB : F) { + for (const Instruction &I : BB) { + const CallInst *ConstCI = dyn_cast(&I); + if (!ConstCI || !OP::IsDxilOpFuncCallInst(ConstCI)) + continue; + CallInst *CI = const_cast(ConstCI); + DXIL::OpCode OpCode = OP::getOpCode(CI); + bool IsSpecializedUse = true; + switch (OpCode) { + case DXIL::OpCode::LinAlgMatVecMul: + case DXIL::OpCode::LinAlgMatVecMulAdd: { + LinAlgMatrixInfo Matrix; + if (!GetLinAlgMatrixInfo(CI->getArgOperand(1)->getType(), Matrix)) + break; + bool IsSigned = + cast(CI->getArgOperand(2))->getZExtValue() != 0; + DXIL::ComponentType ResultType = + GetVectorComponentType(CI->getType(), IsSigned); + DXIL::ComponentType InputType = static_cast( + cast(CI->getArgOperand(4))->getZExtValue()); + uint8_t Flags = GetMatVecLayoutFlags(CI->getArgOperand(1)); + auto It = std::find_if( + m_LinAlgThreadMatrixVectorMultiplies.begin(), + m_LinAlgThreadMatrixVectorMultiplies.end(), + [&](const PSVLinAlgThreadMatrixVectorMultiply0 &Record) { + return Record.ResultType == + static_cast(ResultType) && + Record.MatrixType == + static_cast(Matrix.Type) && + Record.VectorInputType == + static_cast(InputType); + }); + if (It == m_LinAlgThreadMatrixVectorMultiplies.end()) + m_LinAlgThreadMatrixVectorMultiplies.push_back( + {static_cast(ResultType), + static_cast(Matrix.Type), + static_cast(InputType), Flags}); + else + It->Flags |= Flags; + break; + } + case DXIL::OpCode::LinAlgMatrixMultiply: + case DXIL::OpCode::LinAlgMatrixMultiplyAccumulate: { + LinAlgMatrixInfo Result, A, B; + if (!GetLinAlgMatrixInfo(CI->getType(), Result) || + !GetLinAlgMatrixInfo(CI->getArgOperand(1)->getType(), A) || + !GetLinAlgMatrixInfo(CI->getArgOperand(2)->getType(), B)) + break; + uint32_t Shape = AddLinAlgShape(A.M, B.N, A.N); + AddUniqueIndex(MultiplyShapes[{static_cast(Result.Scope), + static_cast(Result.Type), + static_cast(A.Type), + static_cast(B.Type)}], + Shape); + break; + } + case DXIL::OpCode::LinAlgMatrixOuterProduct: { + LinAlgMatrixInfo Result; + if (!GetLinAlgMatrixInfo(CI->getType(), Result)) + break; + PSVLinAlgOuterProduct0 Record = { + static_cast(Result.Type), + static_cast( + GetVectorComponentType(CI->getArgOperand(1)->getType())), + {0, 0}}; + if (std::find_if( + m_LinAlgOuterProducts.begin(), m_LinAlgOuterProducts.end(), + [&](const PSVLinAlgOuterProduct0 &Existing) { + return Existing.ResultType == Record.ResultType && + Existing.VectorInputType == Record.VectorInputType; + }) == m_LinAlgOuterProducts.end()) + m_LinAlgOuterProducts.push_back(Record); + break; + } + case DXIL::OpCode::LinAlgMatrixAccumulateToDescriptor: + case DXIL::OpCode::LinAlgMatrixAccumulateToMemory: { + LinAlgMatrixInfo Matrix; + if (!GetLinAlgMatrixInfo(CI->getArgOperand(1)->getType(), Matrix)) + break; + DXIL::ComponentType AccumulatorType = Matrix.Type; + if (OpCode == DXIL::OpCode::LinAlgMatrixAccumulateToMemory) + AccumulatorType = static_cast( + cast(CI->getArgOperand(3))->getZExtValue()); + uint8_t Flag = + OpCode == DXIL::OpCode::LinAlgMatrixAccumulateToDescriptor + ? static_cast( + PSVLinAlgAccumulateStoreFlag::RawBuffer) + : static_cast( + PSVLinAlgAccumulateStoreFlag::GroupShared); + auto It = + std::find_if(m_LinAlgAccumulateStores.begin(), + m_LinAlgAccumulateStores.end(), + [&](const PSVLinAlgAccumulateStore0 &Record) { + return Record.AccumulatorType == + static_cast(AccumulatorType); + }); + if (It == m_LinAlgAccumulateStores.end()) + m_LinAlgAccumulateStores.push_back( + {static_cast(AccumulatorType), Flag, {0, 0}}); + else + It->Flags |= Flag; + break; + } + case DXIL::OpCode::LinAlgVectorAccumulateToDescriptor: { + DXIL::ComponentType Type = + GetVectorComponentType(CI->getArgOperand(4)->getType()); + auto It = std::find_if( + m_LinAlgAccumulateStores.begin(), + m_LinAlgAccumulateStores.end(), + [&](const PSVLinAlgAccumulateStore0 &Record) { + return Record.AccumulatorType == static_cast(Type); + }); + if (It == m_LinAlgAccumulateStores.end()) + m_LinAlgAccumulateStores.push_back( + {static_cast(Type), + static_cast( + PSVLinAlgAccumulateStoreFlag::RawBuffer), + {0, 0}}); + else + It->Flags |= + static_cast(PSVLinAlgAccumulateStoreFlag::RawBuffer); + break; + } + default: + IsSpecializedUse = false; + break; + } + + if (!IsSpecializedUse && + OP::IsDxilOpLinAlgFunc(CI->getCalledFunction())) { + CollectConstruction(CI->getType()); + for (unsigned ArgIndex = 0; ArgIndex < CI->getNumArgOperands(); + ++ArgIndex) + CollectConstruction(CI->getArgOperand(ArgIndex)->getType()); + } + } + } + } + + for (const auto &Entry : ConstructionShapes) { + const auto &Indexes = Entry.second; + m_LinAlgConstructions.push_back( + {{AddShapeIndexArray(Indexes), static_cast(Indexes.size())}, + Entry.first.first, + {0, 0, 0}}); + } + for (const auto &Entry : MultiplyShapes) { + const auto &Indexes = Entry.second; + PSVLinAlgMatrixShapeArrayReference Shapes = { + AddShapeIndexArray(Indexes), static_cast(Indexes.size())}; + uint8_t Scope = std::get<0>(Entry.first); + if (Scope == static_cast(DXIL::MatrixScope::Wave)) + m_LinAlgWaveMatrixMultiplies.push_back( + {Shapes, std::get<1>(Entry.first), std::get<2>(Entry.first), + std::get<3>(Entry.first), 0}); + else + m_LinAlgThreadGroupMatrixMultiplies.push_back( + {Shapes, std::get<1>(Entry.first), std::get<2>(Entry.first), + std::get<3>(Entry.first), 0}); + } + + m_PSVInitInfo.LinAlgMatrixOperationShapes = m_LinAlgShapes.data(); + m_PSVInitInfo.LinAlgMatrixOperationShapeCount = m_LinAlgShapes.size(); + m_PSVInitInfo.LinAlgMatrixConstructions = m_LinAlgConstructions.data(); + m_PSVInitInfo.LinAlgMatrixConstructionCount = m_LinAlgConstructions.size(); + m_PSVInitInfo.LinAlgThreadMatrixVectorMultiplies = + m_LinAlgThreadMatrixVectorMultiplies.data(); + m_PSVInitInfo.LinAlgThreadMatrixVectorMultiplyCount = + m_LinAlgThreadMatrixVectorMultiplies.size(); + m_PSVInitInfo.LinAlgWaveMatrixMultiplies = + m_LinAlgWaveMatrixMultiplies.data(); + m_PSVInitInfo.LinAlgWaveMatrixMultiplyCount = + m_LinAlgWaveMatrixMultiplies.size(); + m_PSVInitInfo.LinAlgThreadGroupMatrixMultiplies = + m_LinAlgThreadGroupMatrixMultiplies.data(); + m_PSVInitInfo.LinAlgThreadGroupMatrixMultiplyCount = + m_LinAlgThreadGroupMatrixMultiplies.size(); + m_PSVInitInfo.LinAlgOuterProducts = m_LinAlgOuterProducts.data(); + m_PSVInitInfo.LinAlgOuterProductCount = m_LinAlgOuterProducts.size(); + m_PSVInitInfo.LinAlgAccumulateStores = m_LinAlgAccumulateStores.data(); + m_PSVInitInfo.LinAlgAccumulateStoreCount = m_LinAlgAccumulateStores.size(); + } + void SetPSVSigElement(PSVSignatureElement0 &E, const DxilSignatureElement &SE) { memset(&E, 0, sizeof(PSVSignatureElement0)); @@ -771,6 +1109,9 @@ class DxilPSVWriter : public DxilPartWriter { Name.size()); } + if (m_PSVInitInfo.PSVVersion > 3) + CollectLinAlgRuntimeInfo(); + // Set String and SemanticInput Tables m_PSVInitInfo.StringTable.Table = m_StringBuffer.data(); m_PSVInitInfo.StringTable.Size = m_StringBuffer.size(); diff --git a/lib/DxilContainer/DxilPipelineStateValidation.cpp b/lib/DxilContainer/DxilPipelineStateValidation.cpp index 78be73c41d..cfe198fddf 100644 --- a/lib/DxilContainer/DxilPipelineStateValidation.cpp +++ b/lib/DxilContainer/DxilPipelineStateValidation.cpp @@ -911,6 +911,10 @@ void hlsl::PrintPSVRuntimeInfo(llvm::raw_ostream &OS, PSVRuntimeInfo0 *pInfo0, } if (pInfo3) OS << Comment << " EntryFunctionName: " << EntryName << "\n"; + if (pInfo4 && + (pInfo4->Flags & + static_cast(PSVRuntimeInfo4Flag::LinAlgRuntimeInfoPresent))) + OS << Comment << " LinAlgRuntimeInfoPresent: true\n"; } void DxilPipelineStateValidation::PrintPSVRuntimeInfo( @@ -986,6 +990,93 @@ void DxilPipelineStateValidation::Print(raw_ostream &OS, OS << "DxilPipelineStateValidation:\n"; PrintPSVRuntimeInfo(OS, ShaderKind, ""); + if (m_pPSVLinAlgRuntimeInfo0) { + OS << "PSVLinAlgRuntimeInfo:\n"; + OS << " MatrixOperationShapeCount: " + << m_pPSVLinAlgRuntimeInfo0->MatrixOperationShapeCount << "\n"; + OS << " MatrixConstructionCount: " + << m_pPSVLinAlgRuntimeInfo0->MatrixConstructionCount << "\n"; + OS << " ThreadMatrixVectorMultiplyCount: " + << m_pPSVLinAlgRuntimeInfo0->ThreadMatrixVectorMultiplyCount << "\n"; + OS << " WaveMatrixMultiplyCount: " + << m_pPSVLinAlgRuntimeInfo0->WaveMatrixMultiplyCount << "\n"; + OS << " ThreadGroupMatrixMultiplyCount: " + << m_pPSVLinAlgRuntimeInfo0->ThreadGroupMatrixMultiplyCount << "\n"; + OS << " OuterProductCount: " << m_pPSVLinAlgRuntimeInfo0->OuterProductCount + << "\n"; + OS << " AccumulateStoreCount: " + << m_pPSVLinAlgRuntimeInfo0->AccumulateStoreCount << "\n"; + + auto PrintShapes = [&](const PSVLinAlgMatrixShapeArrayReference &ShapeRef) { + OS << "["; + const uint32_t *Indexes = m_SemanticIndexTable.Get(ShapeRef.ShapesIndex); + for (uint32_t I = 0; I < ShapeRef.Count; ++I) { + if (I) + OS << ", "; + PSVLinAlgMatrixOperationShape0 *Shape = + Indexes ? GetPSVLinAlgMatrixOperationShape(Indexes[I]) : nullptr; + if (Shape) + OS << "(" << Shape->M << "," << Shape->N << "," << Shape->K << ")"; + else + OS << "invalid"; + } + OS << "]"; + }; + + for (uint32_t I = 0; I < GetPSVLinAlgMatrixConstructionCount(); ++I) { + auto *Record = GetPSVLinAlgMatrixConstruction(I); + OS << " MatrixConstruction[" << I + << "]: MatrixType=" << static_cast(Record->MatrixType) + << ", Shapes="; + PrintShapes(Record->OperationShapes); + OS << "\n"; + } + for (uint32_t I = 0; I < GetPSVLinAlgThreadMatrixVectorMultiplyCount(); + ++I) { + auto *Record = GetPSVLinAlgThreadMatrixVectorMultiply(I); + OS << " ThreadMatrixVectorMultiply[" << I + << "]: ResultType=" << static_cast(Record->ResultType) + << ", MatrixType=" << static_cast(Record->MatrixType) + << ", VectorInputType=" + << static_cast(Record->VectorInputType) + << ", Flags=" << static_cast(Record->Flags) << "\n"; + } + for (uint32_t I = 0; I < GetPSVLinAlgWaveMatrixMultiplyCount(); ++I) { + auto *Record = GetPSVLinAlgWaveMatrixMultiply(I); + OS << " WaveMatrixMultiply[" << I << "]: AccumulatorType=" + << static_cast(Record->AccumulatorType) + << ", MatrixAType=" << static_cast(Record->MatrixAType) + << ", MatrixBType=" << static_cast(Record->MatrixBType) + << ", Shapes="; + PrintShapes(Record->OperationShapes); + OS << "\n"; + } + for (uint32_t I = 0; I < GetPSVLinAlgThreadGroupMatrixMultiplyCount(); + ++I) { + auto *Record = GetPSVLinAlgThreadGroupMatrixMultiply(I); + OS << " ThreadGroupMatrixMultiply[" << I << "]: AccumulatorType=" + << static_cast(Record->AccumulatorType) + << ", MatrixAType=" << static_cast(Record->MatrixAType) + << ", MatrixBType=" << static_cast(Record->MatrixBType) + << ", Shapes="; + PrintShapes(Record->OperationShapes); + OS << "\n"; + } + for (uint32_t I = 0; I < GetPSVLinAlgOuterProductCount(); ++I) { + auto *Record = GetPSVLinAlgOuterProduct(I); + OS << " OuterProduct[" << I + << "]: ResultType=" << static_cast(Record->ResultType) + << ", VectorInputType=" + << static_cast(Record->VectorInputType) << "\n"; + } + for (uint32_t I = 0; I < GetPSVLinAlgAccumulateStoreCount(); ++I) { + auto *Record = GetPSVLinAlgAccumulateStore(I); + OS << " AccumulateStore[" << I << "]: AccumulatorType=" + << static_cast(Record->AccumulatorType) + << ", Flags=" << static_cast(Record->Flags) << "\n"; + } + } + OS << "ResourceCount : " << m_uResourceCount << "\n "; if (m_uResourceCount) { if (m_uPSVResourceBindInfoSize == sizeof(PSVResourceBindInfo0)) { diff --git a/lib/DxilValidation/DxilContainerValidation.cpp b/lib/DxilValidation/DxilContainerValidation.cpp index a138de6d6b..1fb15548cb 100644 --- a/lib/DxilValidation/DxilContainerValidation.cpp +++ b/lib/DxilValidation/DxilContainerValidation.cpp @@ -180,6 +180,7 @@ class PSVContentVerifier { PSVSignatureElement0 *, const PSVStringTable &, const PSVSemanticIndexTable &, std::string, bool); void VerifyResources(unsigned PSVVersion); + void VerifyLinAlgRuntimeInfo(); template void VerifyResourceTable(T &ResTab, unsigned &ResourceIndex, unsigned PSVVersion); @@ -465,6 +466,34 @@ void PSVContentVerifier::VerifyEntryProperties( } } +void PSVContentVerifier::VerifyLinAlgRuntimeInfo() { + if (!PSV.GetPSVLinAlgRuntimeInfo0()) + return; + + auto VerifyShapes = [&](const PSVLinAlgMatrixShapeArrayReference &ShapeRef) { + if (!IndexTableVerifier.MarkUse(ShapeRef.ShapesIndex, ShapeRef.Count)) { + EmitInvalidError("LinAlgOperationShapes"); + return; + } + const uint32_t *ShapeIndexes = + PSV.GetSemanticIndexTable().Get(ShapeRef.ShapesIndex); + for (uint32_t I = 0; I < ShapeRef.Count; ++I) { + if (!PSV.GetPSVLinAlgMatrixOperationShape(ShapeIndexes[I])) { + EmitInvalidError("LinAlgOperationShapeIndex"); + return; + } + } + }; + + for (uint32_t I = 0; I < PSV.GetPSVLinAlgMatrixConstructionCount(); ++I) + VerifyShapes(PSV.GetPSVLinAlgMatrixConstruction(I)->OperationShapes); + for (uint32_t I = 0; I < PSV.GetPSVLinAlgWaveMatrixMultiplyCount(); ++I) + VerifyShapes(PSV.GetPSVLinAlgWaveMatrixMultiply(I)->OperationShapes); + for (uint32_t I = 0; I < PSV.GetPSVLinAlgThreadGroupMatrixMultiplyCount(); + ++I) + VerifyShapes(PSV.GetPSVLinAlgThreadGroupMatrixMultiply(I)->OperationShapes); +} + void PSVContentVerifier::Verify(unsigned ValMajor, unsigned ValMinor, unsigned PSVVersion) { PSVInitInfo PSVInfo(PSVVersion); @@ -521,6 +550,8 @@ void PSVContentVerifier::Verify(unsigned ValMajor, unsigned ValMinor, DM.GetEntryFunctionName()); } } + if (PSVVersion > 3) + VerifyLinAlgRuntimeInfo(); StrTableVerifier.Verify(ValCtx); IndexTableVerifier.Verify(ValCtx); @@ -616,6 +647,7 @@ struct SimplePSV { const uint32_t *SemanticIndexTable = nullptr; uint32_t PSVSignatureElementSize = 0; const PSVRuntimeInfo1 *RuntimeInfo1 = nullptr; + const PSVRuntimeInfo4 *RuntimeInfo4 = nullptr; bool IsValid = true; SimplePSV(const void *pPSVData, uint32_t PSVSize) { @@ -632,6 +664,9 @@ struct SimplePSV { if (PSVRuntimeInfoSize >= sizeof(PSVRuntimeInfo1)) RuntimeInfo1 = (const PSVRuntimeInfo1 *)(GetPtrAtOffset(pPSVData, Offset)); + if (PSVRuntimeInfoSize >= sizeof(PSVRuntimeInfo4)) + RuntimeInfo4 = + (const PSVRuntimeInfo4 *)(GetPtrAtOffset(pPSVData, Offset)); INCREMENT_POS(PSVRuntimeInfoSize); PSVNumResources = GetUint32AtOffset(pPSVData, Offset); @@ -723,6 +758,52 @@ struct SimplePSV { INCREMENT_POS(TableSizeInBytes); } } + + if (RuntimeInfo4 && (RuntimeInfo4->Flags & + static_cast( + PSVRuntimeInfo4Flag::LinAlgRuntimeInfoPresent))) { + uint32_t LinAlgRuntimeInfoSize = GetUint32AtOffset(pPSVData, Offset); + INCREMENT_POS(4); + if (LinAlgRuntimeInfoSize < sizeof(PSVLinAlgRuntimeInfo0)) { + IsValid = false; + return; + } + const PSVLinAlgRuntimeInfo0 *LinAlgInfo = + reinterpret_cast( + GetPtrAtOffset(pPSVData, Offset)); + INCREMENT_POS(LinAlgRuntimeInfoSize); + + const uint32_t Counts[] = { + LinAlgInfo->MatrixOperationShapeCount, + LinAlgInfo->MatrixConstructionCount, + LinAlgInfo->ThreadMatrixVectorMultiplyCount, + LinAlgInfo->WaveMatrixMultiplyCount, + LinAlgInfo->ThreadGroupMatrixMultiplyCount, + LinAlgInfo->OuterProductCount, + LinAlgInfo->AccumulateStoreCount, + }; + const uint32_t MinimumRecordSizes[] = { + sizeof(PSVLinAlgMatrixOperationShape0), + sizeof(PSVLinAlgMatrixConstruction0), + sizeof(PSVLinAlgThreadMatrixVectorMultiply0), + sizeof(PSVLinAlgWaveMatrixMultiply0), + sizeof(PSVLinAlgThreadGroupMatrixMultiply0), + sizeof(PSVLinAlgOuterProduct0), + sizeof(PSVLinAlgAccumulateStore0), + }; + for (unsigned I = 0; I < sizeof(Counts) / sizeof(Counts[0]); ++I) { + if (!Counts[I]) + continue; + uint32_t RecordSize = GetUint32AtOffset(pPSVData, Offset); + INCREMENT_POS(4); + if ((RecordSize & 3) != 0 || RecordSize < MinimumRecordSizes[I] || + Counts[I] > (PSVSize - Offset) / RecordSize) { + IsValid = false; + return; + } + INCREMENT_POS(Counts[I] * RecordSize); + } + } IsValid = PSVSize == Offset; #undef INCREMENT_POS } diff --git a/lib/HLSL/DxilPreparePasses.cpp b/lib/HLSL/DxilPreparePasses.cpp index 81b9dff4ca..eb7d5b7124 100644 --- a/lib/HLSL/DxilPreparePasses.cpp +++ b/lib/HLSL/DxilPreparePasses.cpp @@ -1717,7 +1717,7 @@ class DxilTrimTargetTypes : public ModulePass { continue; // Currently only LinAlgMatrix ops use target types. - if (!OP::IsDxilOpLinAlgFuncName(F.getName())) + if (!OP::IsDxilOpLinAlgFunc(&F)) continue; llvm::Type *RetTy = F.getReturnType(); diff --git a/tools/clang/test/DXC/dumpPSV_LinAlg.hlsl b/tools/clang/test/DXC/dumpPSV_LinAlg.hlsl new file mode 100644 index 0000000000..d348dd02cd --- /dev/null +++ b/tools/clang/test/DXC/dumpPSV_LinAlg.hlsl @@ -0,0 +1,56 @@ +// REQUIRES: dxil-1-10 +// RUN: %dxc -enable-16bit-types -E main -T cs_6_10 %s -Fo %t +// RUN: %dxa %t -dumppsv | FileCheck %s + +#include +using namespace dx::linalg; + +ByteAddressBuffer Input : register(t0); +RWByteAddressBuffer Output : register(u0); +RWStructuredBuffer > VectorOutput : register(u1); +groupshared uint8_t4_packed SharedOutput[64]; + +using ThreadA = + Matrix; +using WaveA = + Matrix; +using WaveB = + Matrix; +using WaveAccumulator = + Matrix; +using ThreadAccumulator = Matrix; + +[numthreads(4, 4, 1)] +void main(uint Index : SV_GroupIndex) { + ThreadA TA = + ThreadA::Load(Input, 0, 0); + VectorOutput[Index] = Multiply(TA, (vector)1.0h); + + WaveA A = WaveA::Splat(1.0h); + WaveB B = WaveB::Splat(2); + WaveAccumulator C = Multiply(A, B); + C.Store(Output, 0, 20, MatrixLayout::RowMajor); + C.InterlockedAccumulate( + SharedOutput, 0, 16, MatrixLayout::RowMajor); + + ThreadAccumulator Outer = + OuterProduct((float4)1.0f, (float4)2.0f); + Outer.InterlockedAccumulate(Output, 256); + InterlockedAccumulate(Output, 512, (int4)Index); +} + +// CHECK: LinAlgRuntimeInfoPresent: true +// CHECK: PSVLinAlgRuntimeInfo: +// CHECK: MatrixOperationShapeCount: +// CHECK: MatrixConstructionCount: +// CHECK: ThreadMatrixVectorMultiplyCount: 1 +// CHECK: WaveMatrixMultiplyCount: 1 +// CHECK: ThreadGroupMatrixMultiplyCount: 0 +// CHECK: OuterProductCount: 1 +// CHECK: AccumulateStoreCount: 2 +// CHECK: ThreadMatrixVectorMultiply[0]: ResultType=8, MatrixType=8, VectorInputType=8, Flags=1 +// CHECK: WaveMatrixMultiply[0]: AccumulatorType=9, MatrixAType=8, MatrixBType=4, Shapes=[(3,5,4)] +// CHECK: OuterProduct[0]: ResultType=9, VectorInputType=9 +// CHECK-DAG: AccumulateStore[{{[0-9]+}}]: AccumulatorType=9, Flags=1 +// CHECK-DAG: AccumulateStore[{{[0-9]+}}]: AccumulatorType=4, Flags=3 diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-copyconvert.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-copyconvert.ll index e0d493b1df..6c97599c32 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-copyconvert.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-copyconvert.ll @@ -96,7 +96,7 @@ attributes #1 = { nounwind readnone } !7 = !{i32 1, i32 10} !8 = !{!"cs", i32 6, i32 10} !9 = !{void ()* @main, !"main", null, null, !10} -!10 = !{i32 4, !11} +!10 = !{i32 0, i64 2199023255552, i32 4, !11} !11 = !{i32 1, i32 1, i32 1} !12 = !{!13, null, null, null} !13 = !{!14} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-groupshared-vector-memory.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-groupshared-vector-memory.ll index 9d52399b6c..f9c8596c55 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-groupshared-vector-memory.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-groupshared-vector-memory.ll @@ -49,5 +49,5 @@ attributes #0 = { nounwind } !3 = !{i32 1, i32 10} !4 = !{!"cs", i32 6, i32 10} !5 = !{void ()* @main, !"main", null, null, !6} -!6 = !{i32 4, !7} +!6 = !{i32 0, i64 2199023255552, i32 4, !7} !7 = !{i32 4, i32 4, i32 4} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-illegal-component-type.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-illegal-component-type.ll index 58d9db2a55..481d4a1aa3 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-illegal-component-type.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-illegal-component-type.ll @@ -51,5 +51,5 @@ attributes #1 = { nounwind readnone } !5 = !{!6} !6 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} !7 = !{void ()* @main, !"main", null, !4, !8} -!8 = !{i32 0, i64 8388624, i32 4, !9} +!8 = !{i32 0, i64 2199031644176, i32 4, !9} !9 = !{i32 1, i32 1, i32 1} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulate.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulate.ll index 7c8b7a136e..14a13b9c97 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulate.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulate.ll @@ -104,5 +104,5 @@ attributes #0 = { nounwind } !7 = !{i32 1, i32 10} !8 = !{!"cs", i32 6, i32 10} !9 = !{void ()* @main, !"main", null, null, !10} -!10 = !{i32 4, !11} +!10 = !{i32 0, i64 2199023255552, i32 4, !11} !11 = !{i32 1, i32 1, i32 1} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetodescriptor.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetodescriptor.ll index 8258e8b183..52c84411ed 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetodescriptor.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetodescriptor.ll @@ -132,6 +132,5 @@ attributes #2 = { nounwind readnone } !9 = !{!10} !10 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i1 false, i1 false, i1 false, null} !11 = !{void ()* @main, !"main", null, !6, !12} -!12 = !{i32 0, i64 8598323216, i32 4, !13} +!12 = !{i32 0, i64 2207621578768, i32 4, !13} !13 = !{i32 1, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixloadfromdescriptor.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixloadfromdescriptor.ll index 0050904d9b..b6e6d5a199 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixloadfromdescriptor.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixloadfromdescriptor.ll @@ -159,6 +159,5 @@ attributes #2 = { nounwind readnone } !17 = !{!18} !18 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i1 false, i1 false, i1 false, null} !19 = !{void ()* @main, !"main", null, !12, !20} -!20 = !{i32 0, i64 8598323216, i32 4, !21} +!20 = !{i32 0, i64 2207621578768, i32 4, !21} !21 = !{i32 1, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixmultiply.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixmultiply.ll index 4300f84262..ed196e08f8 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixmultiply.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixmultiply.ll @@ -145,6 +145,5 @@ attributes #1 = { nounwind readnone } !12 = !{!13} !13 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} !14 = !{void ()* @main, !"main", null, !11, !15} -!15 = !{i32 0, i64 8388624, i32 4, !16} +!15 = !{i32 0, i64 2199031644176, i32 4, !16} !16 = !{i32 1, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixmultiplyaccumulate.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixmultiplyaccumulate.ll index bb34e8273a..9687c516a0 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixmultiplyaccumulate.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixmultiplyaccumulate.ll @@ -191,6 +191,5 @@ attributes #1 = { nounwind readnone } !12 = !{!13} !13 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} !14 = !{void ()* @main, !"main", null, !11, !15} -!15 = !{i32 0, i64 8388624, i32 4, !16} +!15 = !{i32 0, i64 2199031644176, i32 4, !16} !16 = !{i32 1, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixstoretodescriptor.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixstoretodescriptor.ll index 624b615baa..8ceb71d624 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixstoretodescriptor.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixstoretodescriptor.ll @@ -107,6 +107,5 @@ attributes #2 = { nounwind readnone } !8 = !{!9} !9 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i1 false, i1 false, i1 false, null} !10 = !{void ()* @main, !"main", null, !5, !11} -!11 = !{i32 0, i64 8598323216, i32 4, !12} +!11 = !{i32 0, i64 2207621578768, i32 4, !12} !12 = !{i32 1, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll index f1b5716523..b15c166055 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll @@ -124,5 +124,5 @@ attributes #1 = { nounwind readnone } !9 = !{!10} !10 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} !11 = !{void ()* @main, !"main", null, !8, !12} -!12 = !{i32 0, i64 8388624, i32 4, !13} +!12 = !{i32 0, i64 2199031644176, i32 4, !13} !13 = !{i32 1, i32 1, i32 1} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll index c05f76ff00..be9a35c4f6 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll @@ -132,5 +132,5 @@ attributes #1 = { nounwind readnone } !9 = !{!10} !10 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} !11 = !{void ()* @main, !"main", null, !8, !12} -!12 = !{i32 0, i64 8388624, i32 4, !13} +!12 = !{i32 0, i64 2199031644176, i32 4, !13} !13 = !{i32 1, i32 1, i32 1} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-max-k-dim.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-max-k-dim.ll index cc88c770cc..74e04d9d80 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-max-k-dim.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-max-k-dim.ll @@ -252,5 +252,5 @@ attributes #1 = { nounwind readnone } !26 = !{!27} !27 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} !28 = !{void ()* @main, !"main", null, !25, !29} -!29 = !{i32 0, i64 8388624, i32 4, !30} +!29 = !{i32 0, i64 2199031644176, i32 4, !30} !30 = !{i32 1, i32 1, i32 1} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-non-thread-ops.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-non-thread-ops.ll index 2a8aeefb31..952080c89d 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-non-thread-ops.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-non-thread-ops.ll @@ -62,6 +62,5 @@ attributes #0 = { nounwind } !2 = !{i32 1, i32 10} !3 = !{!"cs", i32 6, i32 10} !4 = !{void ()* @main, !"main", null, null, !5} -!5 = !{i32 0, i64 8388608, i32 4, !6} +!5 = !{i32 0, i64 2199031644160, i32 4, !6} !6 = !{i32 1, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-outerproduct.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-outerproduct.ll index a0b304eb6e..61fcfe36cc 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-outerproduct.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-outerproduct.ll @@ -87,6 +87,5 @@ attributes #0 = { nounwind } !7 = !{i32 1, i32 10} !8 = !{!"cs", i32 6, i32 10} !9 = !{void ()* @main, !"main", null, null, !10} -!10 = !{i32 0, i64 8388608, i32 4, !11} +!10 = !{i32 0, i64 2199031644160, i32 4, !11} !11 = !{i32 1, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-anyhit.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-anyhit.ll index d8127fe017..dfc03ef812 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-anyhit.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-anyhit.ll @@ -207,11 +207,10 @@ attributes #2 = { nounwind readonly } !14 = !{!15} !15 = !{i32 0, i32 13107} !16 = !{null, !"", null, !8, !17} -!17 = !{i32 0, i64 8598323248} +!17 = !{i32 0, i64 2207621578800} !18 = !{void (%struct.RayPayload*, %struct.Attribs*)* @"\01?mainAH@@YAXURayPayload@@UAttribs@@@Z", !"\01?mainAH@@YAXURayPayload@@UAttribs@@@Z", null, null, !19} !19 = !{i32 8, i32 9, i32 6, i32 4, i32 7, i32 8, i32 5, !20} !20 = !{i32 0} !21 = !{!22} !22 = distinct !{!22, !23, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z: %agg.result"} !23 = distinct !{!23, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z"} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-as.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-as.ll index cb6e8f4a46..b751af5aa1 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-as.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-as.ll @@ -208,7 +208,6 @@ attributes #1 = { nounwind readnone } !11 = !{!12} !12 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i1 false, i1 false, i1 false, null} !13 = !{void ()* @mainAS, !"mainAS", null, !8, !14} -!14 = !{i32 0, i64 8598323248, i32 10, !15} +!14 = !{i32 0, i64 2207621578800, i32 10, !15} !15 = !{!16, i32 8} !16 = !{i32 8, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-callable.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-callable.ll index 81352dda0d..99a261cd7f 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-callable.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-callable.ll @@ -202,11 +202,10 @@ attributes #2 = { nounwind readonly } !11 = !{!12} !12 = !{i32 0, %struct.RWByteAddressBuffer* bitcast (%dx.types.Handle* @"\01?OutBuf@@3URWByteAddressBuffer@@A" to %struct.RWByteAddressBuffer*), !"OutBuf", i32 -1, i32 -1, i32 1, i32 11, i1 false, i1 false, i1 false, null} !13 = !{null, !"", null, !8, !14} -!14 = !{i32 0, i64 8598323248} +!14 = !{i32 0, i64 2207621578800} !15 = !{void (%struct.Attribs*)* @"\01?mainCALL@@YAXUAttribs@@@Z", !"\01?mainCALL@@YAXUAttribs@@@Z", null, null, !16} !16 = !{i32 8, i32 12, i32 6, i32 8, i32 5, !17} !17 = !{i32 0} !18 = !{!19} !19 = distinct !{!19, !20, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z: %agg.result"} !20 = distinct !{!20, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z"} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-closesthit.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-closesthit.ll index 8ffe4cdb5c..cec8efc268 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-closesthit.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-closesthit.ll @@ -207,11 +207,10 @@ attributes #2 = { nounwind readonly } !14 = !{!15} !15 = !{i32 0, i32 13107} !16 = !{null, !"", null, !8, !17} -!17 = !{i32 0, i64 8598323248} +!17 = !{i32 0, i64 2207621578800} !18 = !{void (%struct.RayPayload*, %struct.Attribs*)* @"\01?mainCH@@YAXURayPayload@@UAttribs@@@Z", !"\01?mainCH@@YAXURayPayload@@UAttribs@@@Z", null, null, !19} !19 = !{i32 8, i32 10, i32 6, i32 4, i32 7, i32 8, i32 5, !20} !20 = !{i32 0} !21 = !{!22} !22 = distinct !{!22, !23, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z: %agg.result"} !23 = distinct !{!23, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z"} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-cs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-cs.ll index 6c90ead9ca..7d7f60eacb 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-cs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-cs.ll @@ -159,6 +159,5 @@ attributes #1 = { nounwind readnone } !11 = !{!12} !12 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i1 false, i1 false, i1 false, null} !13 = !{void ()* @mainCS, !"mainCS", null, !8, !14} -!14 = !{i32 0, i64 8598323248, i32 4, !15} +!14 = !{i32 0, i64 2207621578800, i32 4, !15} !15 = !{i32 4, i32 4, i32 4} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ds.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ds.ll index 42c8344f06..6df22e400f 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ds.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ds.ll @@ -213,6 +213,5 @@ attributes #1 = { nounwind } !17 = !{i32 0, !"SV_Position", i8 9, i8 3, !18, i8 4, i32 1, i8 4, i32 0, i8 0, !19} !18 = !{i32 0} !19 = !{i32 3, i32 15} -!20 = !{i32 0, i64 8598388784, i32 2, !21} +!20 = !{i32 0, i64 2207621644336, i32 2, !21} !21 = !{i32 2, i32 3} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-gs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-gs.ll index 19ccfaacae..2ff3f6aa58 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-gs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-gs.ll @@ -231,6 +231,5 @@ attributes #2 = { nounwind readnone } !21 = !{!22} !22 = !{i32 0, !"SV_Position", i8 9, i8 3, !20, i8 4, i32 1, i8 4, i32 0, i8 0, !23} !23 = !{i32 3, i32 15} -!24 = !{i32 0, i64 8598388784, i32 1, !25} +!24 = !{i32 0, i64 2207621644336, i32 1, !25} !25 = !{i32 3, i32 1, i32 1, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-hs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-hs.ll index 9eb2750070..4be77da40e 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-hs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-hs.ll @@ -239,6 +239,5 @@ attributes #1 = { nounwind } !23 = !{i32 3, i32 1} !24 = !{i32 1, !"SV_InsideTessFactor", i8 9, i8 26, !18, i8 0, i32 1, i8 1, i32 3, i8 0, !23} !25 = !{i32 2, !"TEST", i8 9, i8 0, !18, i8 0, i32 1, i8 4, i32 4, i8 0, !19} -!26 = !{i32 0, i64 8598388784, i32 3, !27} +!26 = !{i32 0, i64 2207621644336, i32 3, !27} !27 = !{void ()* @"\01?HSPatch@@YA?AUPCStruct@@V?$InputPatch@UPosStruct@@$02@@V?$OutputPatch@UPosStruct@@$02@@I@Z", i32 3, i32 3, i32 2, i32 3, i32 3, float 6.400000e+01} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-intersection.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-intersection.ll index d69d88f08c..a84ca51caf 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-intersection.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-intersection.ll @@ -201,11 +201,10 @@ attributes #2 = { nounwind readonly } !11 = !{!12} !12 = !{i32 0, %struct.RWByteAddressBuffer* bitcast (%dx.types.Handle* @"\01?OutBuf@@3URWByteAddressBuffer@@A" to %struct.RWByteAddressBuffer*), !"OutBuf", i32 -1, i32 -1, i32 1, i32 11, i1 false, i1 false, i1 false, null} !13 = !{null, !"", null, !8, !14} -!14 = !{i32 0, i64 8598323248} +!14 = !{i32 0, i64 2207621578800} !15 = !{void ()* @"\01?mainIS@@YAXXZ", !"\01?mainIS@@YAXXZ", null, null, !16} !16 = !{i32 8, i32 8, i32 5, !17} !17 = !{i32 0} !18 = !{!19} !19 = distinct !{!19, !20, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z: %agg.result"} !20 = distinct !{!20, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z"} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-miss.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-miss.ll index baa1739db7..6e63d1feab 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-miss.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-miss.ll @@ -206,11 +206,10 @@ attributes #2 = { nounwind readonly } !14 = !{!15} !15 = !{i32 0, i32 13107} !16 = !{null, !"", null, !8, !17} -!17 = !{i32 0, i64 8598323248} +!17 = !{i32 0, i64 2207621578800} !18 = !{void (%struct.RayPayload*)* @"\01?mainMS@@YAXURayPayload@@@Z", !"\01?mainMS@@YAXURayPayload@@@Z", null, null, !19} !19 = !{i32 8, i32 11, i32 6, i32 4, i32 5, !20} !20 = !{i32 0} !21 = !{!22} !22 = distinct !{!22, !23, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z: %agg.result"} !23 = distinct !{!23, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z"} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ms.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ms.ll index 7dba832629..c208830ab8 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ms.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ms.ll @@ -211,7 +211,6 @@ attributes #1 = { nounwind } !17 = !{i32 0, !"SV_Position", i8 9, i8 3, !18, i8 4, i32 1, i8 4, i32 0, i8 0, !19} !18 = !{i32 0} !19 = !{i32 3, i32 15} -!20 = !{i32 0, i64 8598323248, i32 9, !21} +!20 = !{i32 0, i64 2207621578800, i32 9, !21} !21 = !{!22, i32 32, i32 0, i32 2, i32 0} !22 = !{i32 8, i32 8, i32 2} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-node.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-node.ll index cdedf36d6f..6d120c35d3 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-node.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-node.ll @@ -198,7 +198,7 @@ attributes #2 = { nounwind readonly } !11 = !{!12} !12 = !{i32 0, %struct.RWByteAddressBuffer* bitcast (%dx.types.Handle* @"\01?OutBuf@@3URWByteAddressBuffer@@A" to %struct.RWByteAddressBuffer*), !"OutBuf", i32 -1, i32 -1, i32 1, i32 11, i1 false, i1 false, i1 false, null} !13 = !{null, !"", null, !8, !14} -!14 = !{i32 0, i64 8598323248} +!14 = !{i32 0, i64 2207621578800} !15 = !{void ()* @mainNS, !"mainNS", null, null, !16} !16 = !{i32 8, i32 15, i32 13, i32 1, i32 15, !17, i32 16, i32 -1, i32 18, !18, i32 4, !19, i32 5, !20} !17 = !{!"mainNS", i32 0} @@ -208,4 +208,3 @@ attributes #2 = { nounwind readonly } !21 = !{!22} !22 = distinct !{!22, !23, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z: %agg.result"} !23 = distinct !{!23, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z"} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ps.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ps.ll index c8a6846f68..e5b015a474 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ps.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-ps.ll @@ -208,5 +208,4 @@ attributes #1 = { nounwind readnone } !19 = !{!20} !20 = !{i32 0, !"SV_Target", i8 9, i8 16, !18, i8 0, i32 1, i8 4, i32 0, i8 0, !21} !21 = !{i32 3, i32 15} -!22 = !{i32 0, i64 8598323248} - +!22 = !{i32 0, i64 2207621578800} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-raygeneration.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-raygeneration.ll index 4306930055..05962398d5 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-raygeneration.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-raygeneration.ll @@ -201,11 +201,10 @@ attributes #2 = { nounwind readonly } !11 = !{!12} !12 = !{i32 0, %struct.RWByteAddressBuffer* bitcast (%dx.types.Handle* @"\01?OutBuf@@3URWByteAddressBuffer@@A" to %struct.RWByteAddressBuffer*), !"OutBuf", i32 -1, i32 -1, i32 1, i32 11, i1 false, i1 false, i1 false, null} !13 = !{null, !"", null, !8, !14} -!14 = !{i32 0, i64 8598323248} +!14 = !{i32 0, i64 2207621578800} !15 = !{void ()* @"\01?mainRG@@YAXXZ", !"\01?mainRG@@YAXXZ", null, null, !16} !16 = !{i32 8, i32 7, i32 5, !17} !17 = !{i32 0} !18 = !{!19} !19 = distinct !{!19, !20, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z: %agg.result"} !20 = distinct !{!20, !"\01??$Load@$0IA@@?$Matrix@$07$0BA@$0BA@$01$00@linalg@dx@@SA?AV012@UByteAddressBuffer@@IIW4MatrixLayoutEnum@MatrixLayout@12@@Z"} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-vs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-vs.ll index f086c35140..40d10f8b0d 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-vs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-stage-vs.ll @@ -208,5 +208,4 @@ attributes #1 = { nounwind readnone } !19 = !{!20} !20 = !{i32 0, !"OUT", i8 9, i8 0, !18, i8 2, i32 1, i8 4, i32 0, i8 0, !21} !21 = !{i32 3, i32 15} -!22 = !{i32 0, i64 8598388784} - +!22 = !{i32 0, i64 2207621644336} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-undef-param.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-undef-param.ll index 6310a086d6..b105ae6c48 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-undef-param.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-undef-param.ll @@ -58,5 +58,5 @@ attributes #1 = { nounwind readnone } !21 = !{!22} !22 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i1 false, i1 false, i1 false, null} !23 = !{void ()* @main, !"main", null, !20, !24} -!24 = !{i32 0, i64 8589934608, i32 4, !25} +!24 = !{i32 0, i64 2207613190160, i32 4, !25} !25 = !{i32 4, i32 4, i32 4} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vectoraccumulatetodescriptor.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vectoraccumulatetodescriptor.ll index c9c923245a..355ce5e6bb 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vectoraccumulatetodescriptor.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vectoraccumulatetodescriptor.ll @@ -78,6 +78,5 @@ attributes #2 = { nounwind readnone } !6 = !{!7} !7 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i1 false, i1 false, i1 false, null} !8 = !{void ()* @main, !"main", null, !3, !9} -!9 = !{i32 0, i64 8598323216, i32 4, !10} +!9 = !{i32 0, i64 2207621578768, i32 4, !10} !10 = !{i32 1, i32 1, i32 1} - From 23419e28bf7583dad7c9f64fce38e7d50028380b Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Wed, 2 Sep 2026 11:24:40 -0600 Subject: [PATCH 2/2] fix tests --- lib/DxilContainer/DxilContainerAssembler.cpp | 8 ++++++-- .../LinAlgMatrix/linalgmatrix-matrixaccumulatetomemory.ll | 3 +-- .../LinAlgMatrix/linalgmatrix-matrixstoretomemory.ll | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/DxilContainer/DxilContainerAssembler.cpp b/lib/DxilContainer/DxilContainerAssembler.cpp index 736d864049..9d1a9bb8f3 100644 --- a/lib/DxilContainer/DxilContainerAssembler.cpp +++ b/lib/DxilContainer/DxilContainerAssembler.cpp @@ -927,9 +927,13 @@ class DxilPSVWriter : public DxilPartWriter { if (!GetLinAlgMatrixInfo(CI->getArgOperand(1)->getType(), Matrix)) break; DXIL::ComponentType AccumulatorType = Matrix.Type; - if (OpCode == DXIL::OpCode::LinAlgMatrixAccumulateToMemory) + if (OpCode == DXIL::OpCode::LinAlgMatrixAccumulateToMemory) { + auto *TargetType = dyn_cast(CI->getArgOperand(3)); + if (!TargetType) + break; AccumulatorType = static_cast( - cast(CI->getArgOperand(3))->getZExtValue()); + TargetType->getZExtValue()); + } uint8_t Flag = OpCode == DXIL::OpCode::LinAlgMatrixAccumulateToDescriptor ? static_cast( diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetomemory.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetomemory.ll index d915cee5a5..53ec9ecb21 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetomemory.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetomemory.ll @@ -192,6 +192,5 @@ attributes #2 = { nounwind readnone } !11 = !{!12} !12 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} !13 = !{void ()* @main, !"main", null, !10, !14} -!14 = !{i32 0, i64 8388624, i32 4, !15} +!14 = !{i32 0, i64 2199023255568, i32 4, !15} !15 = !{i32 1, i32 1, i32 1} - diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixstoretomemory.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixstoretomemory.ll index bdad7d1b08..8d9179a982 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixstoretomemory.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixstoretomemory.ll @@ -153,6 +153,5 @@ attributes #1 = { nounwind readnone } !10 = !{!11} !11 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} !12 = !{void ()* @main, !"main", null, !9, !13} -!13 = !{i32 0, i64 8388624, i32 4, !14} +!13 = !{i32 0, i64 2199023255568, i32 4, !14} !14 = !{i32 1, i32 1, i32 1} -