From 85e6b47d1e898be6fb251dda4d42390d4bbd51ef Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Tue, 28 Jul 2026 16:06:10 -0600 Subject: [PATCH 1/2] [SM6.10] LinAlg Validation: MatVecMul MatVecMulAdd --- docs/DXIL.rst | 3 + lib/DxilValidation/DxilValidation.cpp | 156 +++++++++++++++--- lib/DxilValidation/DxilValidationUtils.cpp | 7 + lib/DxilValidation/DxilValidationUtils.h | 2 + .../matrixvectormultiply/nominal.hlsl | 14 +- .../matrixvectormultiplyadd/nominal.hlsl | 54 +++--- .../LinAlgMatrix/linalgmatrix-as.ll | 19 ++- .../LinAlgMatrix/linalgmatrix-cs.ll | 20 ++- .../LinAlgMatrix/linalgmatrix-ds.ll | 20 ++- .../LinAlgMatrix/linalgmatrix-gs.ll | 20 ++- .../LinAlgMatrix/linalgmatrix-hs.ll | 20 ++- .../LinAlgMatrix/linalgmatrix-matvecmul.ll | 128 ++++++++++++++ .../LinAlgMatrix/linalgmatrix-matvecmuladd.ll | 136 +++++++++++++++ .../LinAlgMatrix/linalgmatrix-ms.ll | 20 ++- .../LinAlgMatrix/linalgmatrix-node.ll | 20 ++- .../LinAlgMatrix/linalgmatrix-ps.ll | 20 ++- .../LinAlgMatrix/linalgmatrix-raytracing.ll | 59 +++++-- .../LinAlgMatrix/linalgmatrix-vs.ll | 20 ++- utils/hct/hctdb.py | 12 ++ 19 files changed, 626 insertions(+), 124 deletions(-) create mode 100644 tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll create mode 100644 tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll diff --git a/docs/DXIL.rst b/docs/DXIL.rst index 15bf3af730..9408bfab8d 100644 --- a/docs/DXIL.rst +++ b/docs/DXIL.rst @@ -3212,11 +3212,14 @@ INSTR.INBOUNDSACCESS Access to out-of-bounds me INSTR.LINALGILLEGALCOMPONENTTYPE Matrix Component Type '%0' not allowed in LinAlg Matrix. INSTR.LINALGILLEGALKDIM Matrix K Dimension out of bounds. K=%0 must be >= %1 and <= %2. INSTR.LINALGMATRIXDIMMISMATCH Matrix Dimension '%0x%1' does not match expected dimension %2x%3. +INSTR.LINALGMATRIXDIMVECTORMISMATCH %0 vector size '%1' must match matrix %2 dimension '%3' INSTR.LINALGMATRIXLAYOUTREQSTRIDE Matrix layout '%0' requires stride 0. INSTR.LINALGMATRIXNOTEXACTMATCH Matrix '%0' must exactly match matrix '%1'. +INSTR.LINALGMATRIXOUTPUTBIASVECMISMATCH Output vector element type '%0' must match Bias vector element type '%1' INSTR.LINALGMATRIXSCOPEMISMATCH Matrix Scope '%0' does not match expected scope %1. INSTR.LINALGMATRIXSCOPENOTALLOWED Matrix Scope '%0' not allowed in %1 operation. INSTR.LINALGMATRIXSCOPEREQLAYOUT2 Matrix scope '%0' requires layout %1 or %2. +INSTR.LINALGMATRIXUNSIGNEDFLOATTYPENOTALLOWED Float-like type '%0' must be signed INSTR.LINALGMATRIXUSEMISMATCH Matrix Use '%0' does not match expected use %1. INSTR.LINALGMATRIXUSEMISMATCH2 Matrix Use '%0' does not match expected use %1 or %2. INSTR.MAYREORDERTHREADUNDEFCOHERENCEHINTPARAM Use of undef coherence hint or num coherence hint bits in MaybeReorderThread. diff --git a/lib/DxilValidation/DxilValidation.cpp b/lib/DxilValidation/DxilValidation.cpp index 747542cdcb..b2bede7e4e 100644 --- a/lib/DxilValidation/DxilValidation.cpp +++ b/lib/DxilValidation/DxilValidation.cpp @@ -35,6 +35,7 @@ #include "llvm/Analysis/ValueTracking.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/DerivedTypes.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/DiagnosticPrinter.h" #include "llvm/IR/Dominators.h" @@ -995,6 +996,48 @@ static void ValidateLinAlgOpParameters(CallInst *CI, } } +static void ValidateLinAlgComponentType(CallInst *CI, DXIL::ComponentType CT, + ValidationContext &ValCtx) { + switch (CT) { + case DXIL::ComponentType::I8: + case DXIL::ComponentType::I16: + case DXIL::ComponentType::I32: + case DXIL::ComponentType::I64: + case DXIL::ComponentType::U8: + case DXIL::ComponentType::U16: + case DXIL::ComponentType::U32: + case DXIL::ComponentType::U64: + case DXIL::ComponentType::F8_E4M3FN: + case DXIL::ComponentType::F8_E5M2: + case DXIL::ComponentType::F16: + case DXIL::ComponentType::F32: + case DXIL::ComponentType::F64: + break; + default: + ValCtx.EmitInstrFormatError(CI, + ValidationRule::InstrLinAlgIllegalComponentType, + {ComponentTypeToString(CT)}); + break; + } +} + +static unsigned ComponentTypeElementsPerScalar(DXIL::ComponentType CT) { + switch (CT) { + case DXIL::ComponentType::I16: + case DXIL::ComponentType::I32: + case DXIL::ComponentType::I64: + case DXIL::ComponentType::U16: + case DXIL::ComponentType::U32: + case DXIL::ComponentType::U64: + case DXIL::ComponentType::F16: + case DXIL::ComponentType::F32: + case DXIL::ComponentType::F64: + return 1; + default: + return 4; + } +} + static void ValidateLinAlgOpReturnMatrix(CallInst *CI, ValidationContext &ValCtx) { Type *Ty = CI->getType(); @@ -1025,28 +1068,7 @@ static void ValidateLinAlgOpReturnMatrix(CallInst *CI, {std::to_string(K), std::to_string(MinK), std::to_string(MaxK)}); } - // Validate the ComponentType is allowed - switch (LATT.Type) { - case DXIL::ComponentType::I8: - case DXIL::ComponentType::I16: - case DXIL::ComponentType::I32: - case DXIL::ComponentType::I64: - case DXIL::ComponentType::U8: - case DXIL::ComponentType::U16: - case DXIL::ComponentType::U32: - case DXIL::ComponentType::U64: - case DXIL::ComponentType::F8_E4M3FN: - case DXIL::ComponentType::F8_E5M2: - case DXIL::ComponentType::F16: - case DXIL::ComponentType::F32: - case DXIL::ComponentType::F64: - break; - default: - ValCtx.EmitInstrFormatError(CI, - ValidationRule::InstrLinAlgIllegalComponentType, - {ComponentTypeToString(LATT.Type)}); - break; - } + ValidateLinAlgComponentType(CI, LATT.Type, ValCtx); } static void ValidateLinAlgMatrixLength(CallInst *CI, @@ -1076,11 +1098,99 @@ static void ValidateLinAlgMatrixStoreToMemory(CallInst *CI, static void ValidateLinAlgMatVecMul(CallInst *CI, ValidationContext &ValCtx) { ValidateLinAlgOpParameters(CI, ValCtx); + + VectorType *OutputVecTy = cast(CI->getType()); + Type *MatTy = CI->getArgOperand(1)->getType(); + Value *IsSignedOp = CI->getArgOperand(2); + ConstantInt *IsSignedCI = dyn_cast(IsSignedOp); + VectorType *InputVecTy = cast(CI->getArgOperand(3)->getType()); + Value *InputInterpOp = CI->getArgOperand(4); + ConstantInt *InputInterpCI = dyn_cast(InputInterpOp); + + assert(dxilutil::IsHLSLLinAlgMatrixType(MatTy) && "Must be LinAlg type"); + + auto MatIt = ValCtx.LinAlgTargetTypeMap.find(MatTy); + if (MatIt == ValCtx.LinAlgTargetTypeMap.end()) + return; + LinAlgTargetType MatLATT = MatIt->second; + + // Mat must be A matrix of Thread scope + if (MatLATT.Scope != DXIL::MatrixScope::Thread) + ValCtx.EmitInstrFormatError(CI, + ValidationRule::InstrLinAlgMatrixScopeMismatch, + {MatrixScopeToString(MatLATT.Scope), "Thread"}); + if (MatLATT.Use != DXIL::MatrixUse::A) + ValCtx.EmitInstrFormatError(CI, + ValidationRule::InstrLinAlgMatrixUseMismatch, + {MatrixUseToString(MatLATT.Use), "A"}); + + // Input Interp must be a immarg of allowed ComponentType + DXIL::ComponentType Interp = DXIL::ComponentType::Invalid; + if (InputInterpCI) { + Interp = static_cast(InputInterpCI->getLimitedValue()); + ValidateLinAlgComponentType(CI, Interp, ValCtx); + } else + ValCtx.EmitInstrFormatError(CI, ValidationRule::InstrOpConst, + {"InputInterp", "LinAlgMatVecMul"}); + + // InputVec length must match K dim + // K is always N since Use is always A however when the element is packed + // the size of the vector needed to hold the contents is smaller + unsigned ElementsPerScalar = ComponentTypeElementsPerScalar(Interp); + unsigned K = (MatLATT.N + ElementsPerScalar - 1) / ElementsPerScalar; + + if (K != InputVecTy->getNumElements()) + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrLinAlgMatrixDimVectorMismatch, + {"Input", std::to_string(InputVecTy->getNumElements()), "K", + std::to_string(K)}); + + // OutputVec length must match M dim + if (MatLATT.M != OutputVecTy->getNumElements()) + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrLinAlgMatrixDimVectorMismatch, + {"Output", std::to_string(OutputVecTy->getNumElements()), "M", + std::to_string(MatLATT.M)}); + + // Sign bit must be immarg and must be true if output vec is a + // native floating point type + if (IsSignedCI) { + bool IsSigned = IsSignedCI->isOne(); + if (OutputVecTy->getElementType()->isFloatingPointTy() && !IsSigned) + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrLinAlgMatrixUnsignedFloatTypeNotAllowed, + {TypeToString(OutputVecTy->getElementType())}); + } else + ValCtx.EmitInstrFormatError(CI, ValidationRule::InstrOpConst, + {"IsSigned", "LinAlgMatVecMul"}); } static void ValidateLinAlgMatVecMulAdd(CallInst *CI, ValidationContext &ValCtx) { - ValidateLinAlgOpParameters(CI, ValCtx); + // All the rules from LinAlgMatVecMul apply + ValidateLinAlgMatVecMul(CI, ValCtx); + + VectorType *OutputVecTy = cast(CI->getType()); + Type *MatTy = CI->getArgOperand(1)->getType(); + auto MatIt = ValCtx.LinAlgTargetTypeMap.find(MatTy); + if (MatIt == ValCtx.LinAlgTargetTypeMap.end()) + return; + LinAlgTargetType MatLATT = MatIt->second; + VectorType *BiasVecTy = cast(CI->getArgOperand(5)->getType()); + + // BiasVec length must match M dim + if (MatLATT.M != BiasVecTy->getNumElements()) + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrLinAlgMatrixDimVectorMismatch, + {"Bias", std::to_string(BiasVecTy->getNumElements()), "M", + std::to_string(MatLATT.M)}); + + // Bias element type must match output element type + if (BiasVecTy->getElementType() != OutputVecTy->getElementType()) + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrLinAlgMatrixOutputBiasVecMismatch, + {TypeToString(OutputVecTy->getElementType()), + TypeToString(BiasVecTy->getElementType())}); } static void diff --git a/lib/DxilValidation/DxilValidationUtils.cpp b/lib/DxilValidation/DxilValidationUtils.cpp index 324853778d..90e1d31f53 100644 --- a/lib/DxilValidation/DxilValidationUtils.cpp +++ b/lib/DxilValidation/DxilValidationUtils.cpp @@ -715,4 +715,11 @@ llvm::StringRef MatrixLayoutToString(DXIL::MatrixLayout ML) { } } +std::string TypeToString(llvm::Type *Ty) { + std::string S; + llvm::raw_string_ostream OS(S); + Ty->print(OS); + return OS.str(); +} + } // namespace hlsl diff --git a/lib/DxilValidation/DxilValidationUtils.h b/lib/DxilValidation/DxilValidationUtils.h index 1e924182c1..b9c09d7bff 100644 --- a/lib/DxilValidation/DxilValidationUtils.h +++ b/lib/DxilValidation/DxilValidationUtils.h @@ -163,4 +163,6 @@ llvm::StringRef MatrixScopeToString(DXIL::MatrixScope MS); llvm::StringRef MatrixUseToString(DXIL::MatrixUse MU); llvm::StringRef MatrixLayoutToString(DXIL::MatrixLayout ML); + +std::string TypeToString(llvm::Type *Ty); } // namespace hlsl diff --git a/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiply/nominal.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiply/nominal.hlsl index fc9fd3ee00..d0215f14ef 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiply/nominal.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiply/nominal.hlsl @@ -6,16 +6,16 @@ void main() { // CHECK-LABEL: define void @main() - __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; + __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 4, 4, 0, 0)]] mat; __builtin_LinAlg_FillMatrix(mat, 1); float4 vec = {1,2,3,4}; float4 result; - // CHECK: call <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC4M5N4U1S2.v4f32(i32 -2147483623, - // CHECK-SAME: %dx.types.LinAlgMatrixC4M5N4U1S2 %{{.*}}, i1 true, <4 x float> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + // CHECK: call <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC4M4N4U0S0.v4f32(i32 -2147483623, + // CHECK-SAME: %dx.types.LinAlgMatrixC4M4N4U0S0 %{{.*}}, i1 true, <4 x float> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) - // CHECK2: call void @"dx.hl.op..void (i32, <4 x float>*, %dx.types.LinAlgMatrixC4M5N4U1S2, i1, <4 x float>, i32) - // CHECK2-SAME: "(i32 418, <4 x float>* %result, %dx.types.LinAlgMatrixC4M5N4U1S2 %{{.*}}, i1 true, <4 x float> %{{.*}}, i32 1) - __builtin_LinAlg_MatrixVectorMultiply(result, mat, true, vec, 1); + // CHECK2: call void @"dx.hl.op..void (i32, <4 x float>*, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x float>, i32) + // CHECK2-SAME: "(i32 418, <4 x float>* %result, %dx.types.LinAlgMatrixC4M4N4U0S0 %{{.*}}, i1 true, <4 x float> %{{.*}}, i32 9) + __builtin_LinAlg_MatrixVectorMultiply(result, mat, true, vec, 9); } diff --git a/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiplyadd/nominal.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiplyadd/nominal.hlsl index 8c745dbb71..19d5d81187 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiplyadd/nominal.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiplyadd/nominal.hlsl @@ -5,53 +5,53 @@ [numthreads(1,1,1)] void main() { // CHECK-LABEL: define void @main() - __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 3, 4, 0, 0)]] mat1; + __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 4, 4, 0, 0)]] mat1; __builtin_LinAlg_FillMatrix(mat1, 1); float4 vec = {1,2,3,4}; float4 result = 0; - // CHECK: call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC5M3N4U0S0.v4f32.v4f32(i32 -2147483622, - // CHECK-SAME: %dx.types.LinAlgMatrixC5M3N4U0S0 %{{.*}}, i1 true, <4 x float> , i32 1, <4 x float> zeroinitializer) + // CHECK: call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC5M4N4U0S0.v4f32.v4f32(i32 -2147483622, + // CHECK-SAME: %dx.types.LinAlgMatrixC5M4N4U0S0 %{{.*}}, i1 true, <4 x float> , i32 9, <4 x float> zeroinitializer) // CHECK-SAME: ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) - // CHECK2: call void @"dx.hl.op..void (i32, <4 x float>*, %dx.types.LinAlgMatrixC5M3N4U0S0, i1, <4 x float>, - // CHECK2-SAME: i32, <4 x float>)"(i32 419, <4 x float>* %result, %dx.types.LinAlgMatrixC5M3N4U0S0 %{{[0-9]+}}, - // CHECK2-SAME: i1 true, <4 x float> %{{[0-9]+}}, i32 1, <4 x float> %{{[0-9]+}}) + // CHECK2: call void @"dx.hl.op..void (i32, <4 x float>*, %dx.types.LinAlgMatrixC5M4N4U0S0, i1, <4 x float>, + // CHECK2-SAME: i32, <4 x float>)"(i32 419, <4 x float>* %result, %dx.types.LinAlgMatrixC5M4N4U0S0 %{{[0-9]+}}, + // CHECK2-SAME: i1 true, <4 x float> %{{[0-9]+}}, i32 9, <4 x float> %{{[0-9]+}}) - __builtin_LinAlg_MatrixVectorMultiplyAdd(result, mat1, true, vec, 1, result); + __builtin_LinAlg_MatrixVectorMultiplyAdd(result, mat1, true, vec, 9, result); - __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 3, 4, 0, 0)]] mat2; + __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 4, 4, 0, 0)]] mat2; __builtin_LinAlg_FillMatrix(mat2, 2); double4 vec2 = {1,2,3,4}; double4 result2 = 0; - // CHECK: call <4 x double> @dx.op.linAlgMatVecMulAdd.v4f64.mC5M3N4U0S0.v4f64.v4f64(i32 -2147483622, - // CHECK-SAME: %dx.types.LinAlgMatrixC5M3N4U0S0 %{{.*}}, i1 true, <4 x double> , i32 1, <4 x double> zeroinitializer) + // CHECK: call <4 x double> @dx.op.linAlgMatVecMulAdd.v4f64.mC5M4N4U0S0.v4f64.v4f64(i32 -2147483622, + // CHECK-SAME: %dx.types.LinAlgMatrixC5M4N4U0S0 %{{.*}}, i1 true, <4 x double> , i32 10, <4 x double> zeroinitializer) // CHECK-SAME: ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) - // CHECK2: call void @"dx.hl.op..void (i32, <4 x double>*, %dx.types.LinAlgMatrixC5M3N4U0S0, i1, <4 x double>, - // CHECK2-SAME: i32, <4 x double>)"(i32 419, <4 x double>* %result2, %dx.types.LinAlgMatrixC5M3N4U0S0 %{{[0-9]+}}, - // CHECK2-SAME: i1 true, <4 x double> %{{[0-9]+}}, i32 1, <4 x double> %{{[0-9]+}}) + // CHECK2: call void @"dx.hl.op..void (i32, <4 x double>*, %dx.types.LinAlgMatrixC5M4N4U0S0, i1, <4 x double>, + // CHECK2-SAME: i32, <4 x double>)"(i32 419, <4 x double>* %result2, %dx.types.LinAlgMatrixC5M4N4U0S0 %{{[0-9]+}}, + // CHECK2-SAME: i1 true, <4 x double> %{{[0-9]+}}, i32 10, <4 x double> %{{[0-9]+}}) - __builtin_LinAlg_MatrixVectorMultiplyAdd(result2, mat2, true, vec2, 1, result2); + __builtin_LinAlg_MatrixVectorMultiplyAdd(result2, mat2, true, vec2, 10, result2); - __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 3, 4, 0, 0)]] mat3; + __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 4, 4, 0, 0)]] mat3; __builtin_LinAlg_FillMatrix(mat3, 3); vector vec3 = {1,2,3,4}; vector result3 = 0; - // CHECK: call <4 x i64> @dx.op.linAlgMatVecMulAdd.v4i64.mC5M3N4U0S0.v4i64.v4i64(i32 -2147483622, - // CHECK-SAME: %dx.types.LinAlgMatrixC5M3N4U0S0 %{{.*}}, i1 true, <4 x i64> , i32 1, <4 x i64> zeroinitializer) + // CHECK: call <4 x i64> @dx.op.linAlgMatVecMulAdd.v4i64.mC5M4N4U0S0.v4i64.v4i64(i32 -2147483622, + // CHECK-SAME: %dx.types.LinAlgMatrixC5M4N4U0S0 %{{.*}}, i1 true, <4 x i64> , i32 6, <4 x i64> zeroinitializer) // CHECK-SAME: ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) - // CHECK2: call void @"dx.hl.op..void (i32, <4 x i64>*, %dx.types.LinAlgMatrixC5M3N4U0S0, i1, <4 x i64>, - // CHECK2-SAME: i32, <4 x i64>)"(i32 419, <4 x i64>* %result3, %dx.types.LinAlgMatrixC5M3N4U0S0 %{{[0-9]+}}, - // CHECK2-SAME: i1 true, <4 x i64> %{{[0-9]+}}, i32 1, <4 x i64> %{{[0-9]+}}) + // CHECK2: call void @"dx.hl.op..void (i32, <4 x i64>*, %dx.types.LinAlgMatrixC5M4N4U0S0, i1, <4 x i64>, + // CHECK2-SAME: i32, <4 x i64>)"(i32 419, <4 x i64>* %result3, %dx.types.LinAlgMatrixC5M4N4U0S0 %{{[0-9]+}}, + // CHECK2-SAME: i1 true, <4 x i64> %{{[0-9]+}}, i32 6, <4 x i64> %{{[0-9]+}}) - __builtin_LinAlg_MatrixVectorMultiplyAdd(result3, mat3, true, vec3, 1, result3); + __builtin_LinAlg_MatrixVectorMultiplyAdd(result3, mat3, true, vec3, 6, result3); __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 8, 8, 0, 0)]] mat4; __builtin_LinAlg_FillMatrix(mat4, 4); @@ -60,12 +60,12 @@ void main() { // CHECK: call <8 x i32> @dx.op.linAlgMatVecMulAdd.v8i32.mC4M8N8U0S0.v8i32.v8i32(i32 -2147483622, // CHECK-SAME: %dx.types.LinAlgMatrixC4M8N8U0S0 %{{.*}}, i1 true, <8 x i32> zeroinitializer, - // CHECK-SAME: i32 1, <8 x i32> zeroinitializer) + // CHECK-SAME: i32 4, <8 x i32> zeroinitializer) // CHECK-SAME: ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) // CHECK2: call void @"dx.hl.op..void (i32, <8 x i32>*, %dx.types.LinAlgMatrixC4M8N8U0S0, i1, <8 x i32>, // CHECK2-SAME: i32, <8 x i32>)"(i32 419, <8 x i32>* %result4, %dx.types.LinAlgMatrixC4M8N8U0S0 %{{[0-9]+}}, - // CHECK2-SAME: i1 true, <8 x i32> %{{[0-9]+}}, i32 1, <8 x i32> %{{[0-9]+}}) + // CHECK2-SAME: i1 true, <8 x i32> %{{[0-9]+}}, i32 4, <8 x i32> %{{[0-9]+}}) - __builtin_LinAlg_MatrixVectorMultiplyAdd(result4, mat4, true, vec4, 1, result4); + __builtin_LinAlg_MatrixVectorMultiplyAdd(result4, mat4, true, vec4, 4, result4); } diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-as.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-as.ll index 9ac79dce9e..00af3d975c 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-as.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-as.ll @@ -40,6 +40,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* } %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -54,7 +55,11 @@ define void @mainAS() { ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) ; dx.op.linAlgMatrixAccumulate @@ -76,10 +81,10 @@ define void @mainAS() { %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() ; dx.op.linAlgMatVecMul - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) ; dx.op.linAlgMatVecMulAdd - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) ; dx.op.linAlgConvert %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) @@ -151,6 +156,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -158,10 +166,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -208,7 +216,7 @@ declare void @dx.op.dispatchMesh.struct.AmpPayload.0(i32, i32, i32, i32, %struct attributes #0 = { nounwind } attributes #1 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2} +!dx.targetTypes = !{!0, !1, !2, !13} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -229,3 +237,4 @@ attributes #1 = { nounwind readnone } !10 = !{i32 0, i64 8589934608, i32 10, !11} !11 = !{!12, i32 8} !12 = !{i32 8, i32 1, i32 1} +!13 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll index 15a08913d4..de925237b5 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll @@ -12,6 +12,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -26,8 +27,13 @@ define void @mainCS() { ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) ; dx.op.linAlgMatrixAccumulate @@ -49,10 +55,10 @@ define void @mainCS() { %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() ; dx.op.linAlgMatVecMul - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) ; dx.op.linAlgMatVecMulAdd - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) ; dx.op.linAlgConvert %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) @@ -124,6 +130,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -131,10 +140,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -178,7 +187,7 @@ declare %dx.types.Handle @dx.op.createHandleFromBinding(i32, %dx.types.ResBind, attributes #0 = { nounwind } attributes #1 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2, !12} +!dx.targetTypes = !{!0, !1, !2, !12, !13} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -199,3 +208,4 @@ attributes #1 = { nounwind readnone } !10 = !{i32 0, i64 8589934608, i32 4, !11} !11 = !{i32 4, i32 4, i32 4} !12 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} +!13 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ds.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ds.ll index 0331af0fc1..0162670c72 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ds.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ds.ll @@ -41,6 +41,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* } %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -55,9 +56,12 @@ define void @MainDS() { ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) - ; dx.op.linAlgMatrixAccumulate %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -77,10 +81,10 @@ define void @MainDS() { %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() ; dx.op.linAlgMatVecMul - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) ; dx.op.linAlgMatVecMulAdd - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) ; dx.op.linAlgConvert %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) @@ -157,6 +161,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -164,10 +171,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -217,7 +224,7 @@ declare void @dx.op.storeOutput.f32(i32, i32, i32, i8, float) #1 attributes #0 = { nounwind } attributes #1 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2} +!dx.targetTypes = !{!0, !1, !2, !18} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -244,3 +251,4 @@ attributes #1 = { nounwind readnone } !15 = !{i32 3, i32 15} !16 = !{i32 0, i64 8590000144, i32 2, !17} !17 = !{i32 2, i32 3} +!18 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-gs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-gs.ll index db3301a1fd..a0adc9b3c0 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-gs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-gs.ll @@ -41,6 +41,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* } %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -55,9 +56,12 @@ define void @MainGS() { ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) - ; dx.op.linAlgMatrixAccumulate %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -77,10 +81,10 @@ define void @MainGS() { %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() ; dx.op.linAlgMatVecMul - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) ; dx.op.linAlgMatVecMulAdd - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) ; dx.op.linAlgConvert %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) @@ -156,6 +160,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -163,10 +170,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -220,7 +227,7 @@ attributes #0 = { nounwind } attributes #1 = { nounwind readonly } attributes #2 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2} +!dx.targetTypes = !{!0, !1, !2, !20} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -249,3 +256,4 @@ attributes #2 = { nounwind readnone } !17 = !{i32 3, i32 15} !18 = !{i32 0, i64 8590000144, i32 1, !19} !19 = !{i32 3, i32 1, i32 1, i32 1, i32 1} +!20 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-hs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-hs.ll index 82e20f7d9e..89421f49dc 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-hs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-hs.ll @@ -40,6 +40,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* } %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -54,9 +55,12 @@ define void @MainHS() { ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) - ; dx.op.linAlgMatrixAccumulate %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -76,10 +80,10 @@ define void @MainHS() { %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() ; dx.op.linAlgMatVecMul - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) ; dx.op.linAlgMatVecMulAdd - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) ; dx.op.linAlgConvert %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) @@ -161,6 +165,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -168,10 +175,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -222,7 +229,7 @@ declare void @dx.op.storePatchConstant.f32(i32, i32, i32, i8, float) #1 attributes #0 = { nounwind } attributes #1 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2} +!dx.targetTypes = !{!0, !1, !2, !24} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -255,3 +262,4 @@ attributes #1 = { nounwind readnone } !21 = !{i32 2, !"TEST", i8 9, i8 0, !14, i8 0, i32 1, i8 4, i32 4, i8 0, !15} !22 = !{i32 0, i64 8590000144, i32 3, !23} !23 = !{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} +!24 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll new file mode 100644 index 0000000000..d0217cbeb9 --- /dev/null +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll @@ -0,0 +1,128 @@ +; REQUIRES: dxil-1-10 +; RUN: not %dxv %s 2>&1 | FileCheck %s + +target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" +target triple = "dxil-ms-dx" + +%dx.types.Handle = type { i8* } +%dx.types.ResBind = type { i32, i32, i32, i8 } +%dx.types.ResourceProperties = type { i32, i32 } +%dx.types.LinAlgMatrixC9M4N32U0S0 = type { i8* } +%dx.types.LinAlgMatrixC9M4N8U0S2 = type { i8* } +%dx.types.LinAlgMatrixC9M4N8U1S0 = type { i8* } +%dx.types.LinAlgMatrixC9M4N8U0S0 = type { i8* } +%dx.types.LinAlgMatrixC21M4N8U0S0 = type { i8* } +%struct.ByteAddressBuffer = type { i32 } + +define void @main() { + %1 = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind zeroinitializer, i32 0, i1 false) ; CreateHandleFromBinding(bind,index,nonUniformIndex) + %2 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %3 = call %dx.types.LinAlgMatrixC9M4N32U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N32U0S0(i32 -2147483634, %dx.types.Handle %2, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK: Function: main: error: Matrix Component Type 'I1' not allowed in LinAlg Matrix. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMul.v4f32.mC9M4N32U0S0.v8f32 + %4 = call <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N32U0S0.v8f32(i32 -2147483623, %dx.types.LinAlgMatrixC9M4N32U0S0 %3, i1 true, <8 x float> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %5 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %6 = call %dx.types.LinAlgMatrixC9M4N8U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U0S2(i32 -2147483634, %dx.types.Handle %5, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Matrix Scope 'ThreadGroup' does not match expected scope Thread. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U0S2.v8f32 + %7 = call <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U0S2.v8f32(i32 -2147483623, %dx.types.LinAlgMatrixC9M4N8U0S2 %6, i1 true, <8 x float> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %8 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %9 = call %dx.types.LinAlgMatrixC9M4N8U1S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U1S0(i32 -2147483634, %dx.types.Handle %8, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Matrix Use 'B' does not match expected use A. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U1S0.v8f32 + %10 = call <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U1S0.v8f32(i32 -2147483623, %dx.types.LinAlgMatrixC9M4N8U1S0 %9, i1 true, <8 x float> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %11 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %12 = call %dx.types.LinAlgMatrixC9M4N8U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U0S0(i32 -2147483634, %dx.types.Handle %11, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Input vector size '4' must match matrix K dimension '8' + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U0S0.v4f32 + %13 = call <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U0S0.v4f32(i32 -2147483623, %dx.types.LinAlgMatrixC9M4N8U0S0 %12, i1 true, <4 x float> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %14 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %15 = call %dx.types.LinAlgMatrixC21M4N8U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC21M4N8U0S0(i32 -2147483634, %dx.types.Handle %14, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Input vector size '8' must match matrix K dimension '2' + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMul.v4f32.mC21M4N8U0S0.v8f32 + %16 = call <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC21M4N8U0S0.v8f32(i32 -2147483623, %dx.types.LinAlgMatrixC21M4N8U0S0 %15, i1 true, <8 x float> , i32 21) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + + ; CHECK-NEXT: Function: main: error: Output vector size '2' must match matrix M dimension '4' + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMul.v2f32.mC9M4N8U0S0.v8f32 + %17 = call <2 x float> @dx.op.linAlgMatVecMul.v2f32.mC9M4N8U0S0.v8f32(i32 -2147483623, %dx.types.LinAlgMatrixC9M4N8U0S0 %12, i1 true, <8 x float> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + + ; CHECK-NEXT: Function: main: error: Float-like type 'float' must be signed + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U0S0.v8f32 + %18 = call <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U0S0.v8f32(i32 -2147483623, %dx.types.LinAlgMatrixC9M4N8U0S0 %12, i1 false, <8 x float> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + ret void + + ; CHECK-NEXT: Validation failed. +} + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC9M4N32U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N32U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N32U0S0.v8f32(i32, %dx.types.LinAlgMatrixC9M4N32U0S0, i1, <8 x float>, i32) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC9M4N8U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U0S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U0S2.v8f32(i32, %dx.types.LinAlgMatrixC9M4N8U0S2, i1, <8 x float>, i32) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC9M4N8U1S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U1S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U1S0.v8f32(i32, %dx.types.LinAlgMatrixC9M4N8U1S0, i1, <8 x float>, i32) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC9M4N8U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U0S0.v4f32(i32, %dx.types.LinAlgMatrixC9M4N8U0S0, i1, <4 x float>, i32) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC21M4N8U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC21M4N8U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC21M4N8U0S0.v8f32(i32, %dx.types.LinAlgMatrixC21M4N8U0S0, i1, <8 x float>, i32) #0 + +; Function Attrs: nounwind +declare <2 x float> @dx.op.linAlgMatVecMul.v2f32.mC9M4N8U0S0.v8f32(i32, %dx.types.LinAlgMatrixC9M4N8U0S0, i1, <8 x float>, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N8U0S0.v8f32(i32, %dx.types.LinAlgMatrixC9M4N8U0S0, i1, <8 x float>, i32) #0 + +; Function Attrs: nounwind readnone +declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #1 + +; Function Attrs: nounwind readnone +declare %dx.types.Handle @dx.op.createHandleFromBinding(i32, %dx.types.ResBind, i32, i1) #1 + +attributes #0 = { nounwind } +attributes #1 = { nounwind readnone } + +!dx.targetTypes = !{!0, !1, !2, !3, !4} +!llvm.ident = !{!5} +!dx.version = !{!6} +!dx.valver = !{!6} +!dx.shaderModel = !{!7} +!dx.resources = !{!8} +!dx.entryPoints = !{!11} + +!0 = !{%dx.types.LinAlgMatrixC9M4N32U0S0 undef, i32 9, i32 4, i32 32, i32 0, i32 0} +!1 = !{%dx.types.LinAlgMatrixC9M4N8U0S2 undef, i32 9, i32 4, i32 8, i32 0, i32 2} +!2 = !{%dx.types.LinAlgMatrixC9M4N8U1S0 undef, i32 9, i32 4, i32 8, i32 1, i32 0} +!3 = !{%dx.types.LinAlgMatrixC9M4N8U0S0 undef, i32 9, i32 4, i32 8, i32 0, i32 0} +!4 = !{%dx.types.LinAlgMatrixC21M4N8U0S0 undef, i32 21, i32 4, i32 8, i32 0, i32 0} +!5 = !{!"dxc(private) 1.9.0.5414 (linalg-matvecmul, b61cafa02-dirty)"} +!6 = !{i32 1, i32 10} +!7 = !{!"cs", i32 6, i32 10} +!8 = !{!9, null, null, null} +!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} +!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 new file mode 100644 index 0000000000..c656042c98 --- /dev/null +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll @@ -0,0 +1,136 @@ +; REQUIRES: dxil-1-10 +; RUN: not %dxv %s 2>&1 | FileCheck %s +target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" +target triple = "dxil-ms-dx" + +%dx.types.Handle = type { i8* } +%dx.types.ResBind = type { i32, i32, i32, i8 } +%dx.types.ResourceProperties = type { i32, i32 } +%dx.types.LinAlgMatrixC9M4N32U0S0 = type { i8* } +%dx.types.LinAlgMatrixC9M4N8U0S2 = type { i8* } +%dx.types.LinAlgMatrixC9M4N8U1S0 = type { i8* } +%dx.types.LinAlgMatrixC9M4N8U0S0 = type { i8* } +%dx.types.LinAlgMatrixC21M4N8U0S0 = type { i8* } +%struct.ByteAddressBuffer = type { i32 } + +define void @main() { + %1 = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind zeroinitializer, i32 0, i1 false) ; CreateHandleFromBinding(bind,index,nonUniformIndex) + %2 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %3 = call %dx.types.LinAlgMatrixC9M4N32U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N32U0S0(i32 -2147483634, %dx.types.Handle %2, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK: Function: main: error: Matrix Component Type 'I1' not allowed in LinAlg Matrix. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N32U0S0.v8f32.v4f32 + %4 = call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N32U0S0.v8f32.v4f32(i32 -2147483622, %dx.types.LinAlgMatrixC9M4N32U0S0 %3, i1 true, <8 x float> , i32 1, <4 x float> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %5 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %6 = call %dx.types.LinAlgMatrixC9M4N8U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U0S2(i32 -2147483634, %dx.types.Handle %5, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Matrix Scope 'ThreadGroup' does not match expected scope Thread. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S2.v8f32.v4f32 + %7 = call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S2.v8f32.v4f32(i32 -2147483622, %dx.types.LinAlgMatrixC9M4N8U0S2 %6, i1 true, <8 x float> , i32 9, <4 x float> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %8 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %9 = call %dx.types.LinAlgMatrixC9M4N8U1S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U1S0(i32 -2147483634, %dx.types.Handle %8, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Matrix Use 'B' does not match expected use A. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U1S0.v8f32.v4f32 + %10 = call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U1S0.v8f32.v4f32(i32 -2147483622, %dx.types.LinAlgMatrixC9M4N8U1S0 %9, i1 true, <8 x float> , i32 9, <4 x float> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %11 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %12 = call %dx.types.LinAlgMatrixC9M4N8U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U0S0(i32 -2147483634, %dx.types.Handle %11, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Input vector size '4' must match matrix K dimension '8' + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S0.v4f32.v4f32 + %13 = call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S0.v4f32.v4f32(i32 -2147483622, %dx.types.LinAlgMatrixC9M4N8U0S0 %12, i1 true, <4 x float> , i32 9, <4 x float> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %14 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %15 = call %dx.types.LinAlgMatrixC21M4N8U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC21M4N8U0S0(i32 -2147483634, %dx.types.Handle %14, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Input vector size '8' must match matrix K dimension '2' + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v4f32.mC21M4N8U0S0.v8f32.v4f32 + %16 = call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC21M4N8U0S0.v8f32.v4f32(i32 -2147483622, %dx.types.LinAlgMatrixC21M4N8U0S0 %15, i1 true, <8 x float> , i32 21, <4 x float> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + + ; CHECK-NEXT: Function: main: error: Output vector size '2' must match matrix M dimension '4' + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v2f32.mC9M4N8U0S0.v8f32.v2f32 + ; CHECK-NEXT: Function: main: error: Bias vector size '2' must match matrix M dimension '4' + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v2f32.mC9M4N8U0S0.v8f32.v2f32 + %17 = call <2 x float> @dx.op.linAlgMatVecMulAdd.v2f32.mC9M4N8U0S0.v8f32.v2f32(i32 -2147483622, %dx.types.LinAlgMatrixC9M4N8U0S0 %12, i1 true, <8 x float> , i32 9, <2 x float> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + + ; CHECK-NEXT: Function: main: error: Float-like type 'float' must be signed + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S0.v8f32.v4f32 + %18 = call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S0.v8f32.v4f32(i32 -2147483622, %dx.types.LinAlgMatrixC9M4N8U0S0 %12, i1 false, <8 x float> , i32 9, <4 x float> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + + ; CHECK-NEXT: Function: main: error: Output vector element type 'float' must match Bias vector element type 'i32' + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S0.v8f32.v4i32 + %19 = call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S0.v8f32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC9M4N8U0S0 %12, i1 true, <8 x float> , i32 9, <4 x i32> zeroinitializer) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + + ; CHECK-NEXT: Validation failed. + ret void +} + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC9M4N32U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N32U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N32U0S0.v8f32.v4f32(i32, %dx.types.LinAlgMatrixC9M4N32U0S0, i1, <8 x float>, i32, <4 x float>) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC9M4N8U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U0S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S2.v8f32.v4f32(i32, %dx.types.LinAlgMatrixC9M4N8U0S2, i1, <8 x float>, i32, <4 x float>) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC9M4N8U1S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U1S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U1S0.v8f32.v4f32(i32, %dx.types.LinAlgMatrixC9M4N8U1S0, i1, <8 x float>, i32, <4 x float>) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC9M4N8U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N8U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S0.v4f32.v4f32(i32, %dx.types.LinAlgMatrixC9M4N8U0S0, i1, <4 x float>, i32, <4 x float>) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC21M4N8U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC21M4N8U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC21M4N8U0S0.v8f32.v4f32(i32, %dx.types.LinAlgMatrixC21M4N8U0S0, i1, <8 x float>, i32, <4 x float>) #0 + +; Function Attrs: nounwind +declare <2 x float> @dx.op.linAlgMatVecMulAdd.v2f32.mC9M4N8U0S0.v8f32.v2f32(i32, %dx.types.LinAlgMatrixC9M4N8U0S0, i1, <8 x float>, i32, <2 x float>) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S0.v8f32.v4f32(i32, %dx.types.LinAlgMatrixC9M4N8U0S0, i1, <8 x float>, i32, <4 x float>) #0 + +; Function Attrs: nounwind +declare <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N8U0S0.v8f32.v4i32(i32, %dx.types.LinAlgMatrixC9M4N8U0S0, i1, <8 x float>, i32, <4 x i32>) #0 + +; Function Attrs: nounwind readnone +declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #1 + +; Function Attrs: nounwind readnone +declare %dx.types.Handle @dx.op.createHandleFromBinding(i32, %dx.types.ResBind, i32, i1) #1 + +attributes #0 = { nounwind } +attributes #1 = { nounwind readnone } + +!dx.targetTypes = !{!0, !1, !2, !3, !4} +!llvm.ident = !{!5} +!dx.version = !{!6} +!dx.valver = !{!6} +!dx.shaderModel = !{!7} +!dx.resources = !{!8} +!dx.entryPoints = !{!11} + +!0 = !{%dx.types.LinAlgMatrixC9M4N32U0S0 undef, i32 9, i32 4, i32 32, i32 0, i32 0} +!1 = !{%dx.types.LinAlgMatrixC9M4N8U0S2 undef, i32 9, i32 4, i32 8, i32 0, i32 2} +!2 = !{%dx.types.LinAlgMatrixC9M4N8U1S0 undef, i32 9, i32 4, i32 8, i32 1, i32 0} +!3 = !{%dx.types.LinAlgMatrixC9M4N8U0S0 undef, i32 9, i32 4, i32 8, i32 0, i32 0} +!4 = !{%dx.types.LinAlgMatrixC21M4N8U0S0 undef, i32 21, i32 4, i32 8, i32 0, i32 0} +!5 = !{!"dxc(private) 1.9.0.5414 (linalg-matvecmul, b61cafa02-dirty)"} +!6 = !{i32 1, i32 10} +!7 = !{!"cs", i32 6, i32 10} +!8 = !{!9, null, null, null} +!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} +!13 = !{i32 1, i32 1, i32 1} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ms.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ms.ll index 183e4b9948..b10428d32b 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ms.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ms.ll @@ -39,6 +39,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* } %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -54,9 +55,12 @@ define void @mainMeS() { ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) - ; dx.op.linAlgMatrixAccumulate %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -76,10 +80,10 @@ define void @mainMeS() { %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() ; dx.op.linAlgMatVecMul - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) ; dx.op.linAlgMatVecMulAdd - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) ; dx.op.linAlgConvert %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) @@ -154,6 +158,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -161,10 +168,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -217,7 +224,7 @@ declare void @dx.op.setMeshOutputCounts(i32, i32, i32) #1 attributes #0 = { nounwind } attributes #1 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2} +!dx.targetTypes = !{!0, !1, !2, !19} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -245,3 +252,4 @@ attributes #1 = { nounwind readnone } !16 = !{i32 0, i64 8589934608, i32 9, !17} !17 = !{!18, i32 32, i32 0, i32 2, i32 0} !18 = !{i32 8, i32 8, i32 2} +!19 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-node.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-node.ll index 96f1cca57d..b6b5e25194 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-node.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-node.ll @@ -40,6 +40,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* } %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -55,9 +56,12 @@ define void @mainNS() { ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) - ; dx.op.linAlgMatrixAccumulate %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -77,10 +81,10 @@ define void @mainNS() { %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() ; dx.op.linAlgMatVecMul - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) ; dx.op.linAlgMatVecMulAdd - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) ; dx.op.linAlgConvert %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) @@ -149,6 +153,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -156,10 +163,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -204,7 +211,7 @@ attributes #0 = { nounwind } attributes #1 = { nounwind readnone } attributes #2 = { nounwind readonly } -!dx.targetTypes = !{!0, !1, !2} +!dx.targetTypes = !{!0, !1, !2, !21} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -234,3 +241,4 @@ attributes #2 = { nounwind readonly } !18 = !{i32 8, i32 1, i32 1} !19 = !{i32 64, i32 2, i32 2} !20 = !{i32 0} +!21 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ps.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ps.ll index 2f15caef81..457e60fff9 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ps.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ps.ll @@ -40,6 +40,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* } %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -54,9 +55,12 @@ define void @mainPS() { ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) - ; dx.op.linAlgMatrixAccumulate %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -76,10 +80,10 @@ define void @mainPS() { %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() ; dx.op.linAlgMatVecMul - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) ; dx.op.linAlgMatVecMulAdd - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) ; dx.op.linAlgConvert %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) @@ -153,6 +157,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -160,10 +167,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -210,7 +217,7 @@ declare void @dx.op.storeOutput.f32(i32, i32, i32, i8, float) #0 attributes #0 = { nounwind } attributes #1 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2} +!dx.targetTypes = !{!0, !1, !2, !19} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -238,3 +245,4 @@ attributes #1 = { nounwind readnone } !16 = !{i32 0, !"SV_Target", i8 9, i8 16, !14, i8 0, i32 1, i8 4, i32 0, i8 0, !17} !17 = !{i32 3, i32 15} !18 = !{i32 0, i64 8589934608} +!19 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-raytracing.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-raytracing.ll index a16cf24b23..3319d4836a 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-raytracing.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-raytracing.ll @@ -203,6 +203,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* } %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.Attribs = type { <2 x float> } %struct.RayPayload = type { float } @@ -219,7 +220,11 @@ define void @"\01?MainRG@@YAXXZ"() #0 { ; ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -228,8 +233,8 @@ define void @"\01?MainRG@@YAXXZ"() #0 { %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout) %v4 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483619, <4 x i32> , <4 x i32> ) ; LinAlgMatrixOuterProduct(vectorA,vectorB) %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) ; dx.op.linAlgVectorAccumulateToDescriptor call void @dx.op.linAlgVectorAccumulateToDescriptor.v4f32(i32 -2147483617, %dx.types.Handle %handle, i32 0, i32 64, <4 x float> zeroinitializer) ; LinAlgVectorAccumulateToDescriptor(handle,offset,align,vector) @@ -259,7 +264,11 @@ define void @"\01?MainIS@@YAXXZ"() #0 { ; ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -268,8 +277,8 @@ define void @"\01?MainIS@@YAXXZ"() #0 { %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout) %v4 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483619, <4 x i32> , <4 x i32> ) ; LinAlgMatrixOuterProduct(vectorA,vectorB) %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) ; dx.op.linAlgVectorAccumulateToDescriptor call void @dx.op.linAlgVectorAccumulateToDescriptor.v4f32(i32 -2147483617, %dx.types.Handle %handle, i32 0, i32 64, <4 x float> zeroinitializer) ; LinAlgVectorAccumulateToDescriptor(handle,offset,align,vector) @@ -299,7 +308,11 @@ define void @"\01?MainCL@@YAXUAttribs@@@Z"(%struct.Attribs* noalias nocapture %a ; ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -308,8 +321,8 @@ define void @"\01?MainCL@@YAXUAttribs@@@Z"(%struct.Attribs* noalias nocapture %a %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout) %v4 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483619, <4 x i32> , <4 x i32> ) ; LinAlgMatrixOuterProduct(vectorA,vectorB) %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) ; dx.op.linAlgVectorAccumulateToDescriptor call void @dx.op.linAlgVectorAccumulateToDescriptor.v4f32(i32 -2147483617, %dx.types.Handle %handle, i32 0, i32 64, <4 x float> zeroinitializer) ; LinAlgVectorAccumulateToDescriptor(handle,offset,align,vector) @@ -339,7 +352,11 @@ define void @"\01?MainAH@@YAXURayPayload@@UAttribs@@@Z"(%struct.RayPayload* noal ; ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -348,8 +365,8 @@ define void @"\01?MainAH@@YAXURayPayload@@UAttribs@@@Z"(%struct.RayPayload* noal %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout) %v4 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483619, <4 x i32> , <4 x i32> ) ; LinAlgMatrixOuterProduct(vectorA,vectorB) %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) ; dx.op.linAlgVectorAccumulateToDescriptor call void @dx.op.linAlgVectorAccumulateToDescriptor.v4f32(i32 -2147483617, %dx.types.Handle %handle, i32 0, i32 64, <4 x float> zeroinitializer) ; LinAlgVectorAccumulateToDescriptor(handle,offset,align,vector) @@ -379,7 +396,11 @@ define void @"\01?MainCH@@YAXURayPayload@@UAttribs@@@Z"(%struct.RayPayload* noal ; ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -388,8 +409,8 @@ define void @"\01?MainCH@@YAXURayPayload@@UAttribs@@@Z"(%struct.RayPayload* noal %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout) %v4 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483619, <4 x i32> , <4 x i32> ) ; LinAlgMatrixOuterProduct(vectorA,vectorB) %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) ; dx.op.linAlgVectorAccumulateToDescriptor call void @dx.op.linAlgVectorAccumulateToDescriptor.v4f32(i32 -2147483617, %dx.types.Handle %handle, i32 0, i32 64, <4 x float> zeroinitializer) ; LinAlgVectorAccumulateToDescriptor(handle,offset,align,vector) @@ -419,7 +440,11 @@ define void @"\01?MainMS@@YAXURayPayload@@@Z"(%struct.RayPayload* noalias nocapt ; ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -428,8 +453,8 @@ define void @"\01?MainMS@@YAXURayPayload@@@Z"(%struct.RayPayload* noalias nocapt %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout) %v4 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483619, <4 x i32> , <4 x i32> ) ; LinAlgMatrixOuterProduct(vectorA,vectorB) %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) ; dx.op.linAlgVectorAccumulateToDescriptor call void @dx.op.linAlgVectorAccumulateToDescriptor.v4f32(i32 -2147483617, %dx.types.Handle %handle, i32 0, i32 64, <4 x float> zeroinitializer) ; LinAlgVectorAccumulateToDescriptor(handle,offset,align,vector) @@ -473,6 +498,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -480,10 +508,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -528,7 +556,7 @@ attributes #0 = { nounwind } attributes #1 = { nounwind readnone } attributes #2 = { nounwind readonly } -!dx.targetTypes = !{!0, !1, !2} +!dx.targetTypes = !{!0, !1, !2, !35} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -573,3 +601,4 @@ attributes #2 = { nounwind readonly } !32 = !{i32 8, i32 8, i32 5, !24} !33 = !{void (%struct.RayPayload*)* @"\01?MainMS@@YAXURayPayload@@@Z", !"\01?MainMS@@YAXURayPayload@@@Z", null, null, !34} !34 = !{i32 8, i32 11, i32 6, i32 4, i32 5, !24} +!35 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vs.ll index d3a6b1a3d0..f6953e0437 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vs.ll @@ -41,6 +41,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* } %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } +%dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -55,9 +56,12 @@ define void @mainVS() { ; Built-ins allowed in all stages ; + ; Matrix + %mC4M4N4U0S0 = call %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) + ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) - ; dx.op.linAlgMatrixAccumulate %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) @@ -77,10 +81,10 @@ define void @mainVS() { %v5 = call i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32 -2147483626) ; LinAlgMatrixQueryAccumulatorLayout() ; dx.op.linAlgMatVecMul - %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) + %v6 = call <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32 -2147483623, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 9) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) ; dx.op.linAlgMatVecMulAdd - %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M5N4U0S2 %v4, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) + %v7 = call <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32 -2147483622, %dx.types.LinAlgMatrixC4M4N4U0S0 %mC4M4N4U0S0, i1 true, <4 x i32> , i32 2, <4 x i32> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) ; dx.op.linAlgConvert %v16 = call <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32 -2147483618, <4 x i32> zeroinitializer, i32 1, i32 2) ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation) @@ -154,6 +158,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC4M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + ; Function Attrs: nounwind declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0 @@ -161,10 +168,10 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4 declare i32 @dx.op.linAlgMatrixQueryAccumulatorLayout(i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M5N4U0S2.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32) #0 +declare <4 x i32> @dx.op.linAlgMatVecMul.v4i32.mC4M4N4U0S0.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32) #0 ; Function Attrs: nounwind -declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M5N4U0S2.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, i1, <4 x i32>, i32, <4 x i32>) #0 +declare <4 x i32> @dx.op.linAlgMatVecMulAdd.v4i32.mC4M4N4U0S0.v4i32.v4i32(i32, %dx.types.LinAlgMatrixC4M4N4U0S0, i1, <4 x i32>, i32, <4 x i32>) #0 ; Function Attrs: nounwind declare <4 x float> @dx.op.linAlgConvert.v4f32.v4i32(i32, <4 x i32>, i32, i32) #0 @@ -211,7 +218,7 @@ declare void @dx.op.storeOutput.f32(i32, i32, i32, i8, float) #0 attributes #0 = { nounwind } attributes #1 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2} +!dx.targetTypes = !{!0, !1, !2, !19} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -239,3 +246,4 @@ attributes #1 = { nounwind readnone } !16 = !{i32 0, !"OUT", i8 9, i8 0, !14, i8 2, i32 1, i8 4, i32 0, i8 0, !17} !17 = !{i32 3, i32 15} !18 = !{i32 0, i64 8590000144} +!19 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 924da2f148..7a41931667 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -8674,6 +8674,18 @@ def build_valrules(self): "Instr.LinAlgMatrixLayoutReqStride", "Matrix layout '%0' requires stride 0.", ) + self.add_valrule( + "Instr.LinAlgMatrixDimVectorMismatch", + "%0 vector size '%1' must match matrix %2 dimension '%3'", + ) + self.add_valrule( + "Instr.LinAlgMatrixOutputBiasVecMismatch", + "Output vector element type '%0' must match Bias vector element type '%1'", + ) + self.add_valrule( + "Instr.LinAlgMatrixUnsignedFloatTypeNotAllowed", + "Float-like type '%0' must be signed", + ) # Some legacy rules: # - space is only supported for shader targets 5.1 and higher From 470027a438f956b7ca5ac9e049e80227461f96ff Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Fri, 31 Jul 2026 16:47:14 -0600 Subject: [PATCH 2/2] Address comments --- docs/DXIL.rst | 2 +- lib/DxilValidation/DxilValidation.cpp | 27 ++++++++++--------- .../linalgmatrix-illegal-component-type.ll | 2 +- .../LinAlgMatrix/linalgmatrix-matvecmul.ll | 2 +- .../LinAlgMatrix/linalgmatrix-matvecmuladd.ll | 2 +- utils/hct/hctdb.py | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/docs/DXIL.rst b/docs/DXIL.rst index 9408bfab8d..9e56c41298 100644 --- a/docs/DXIL.rst +++ b/docs/DXIL.rst @@ -3209,7 +3209,7 @@ INSTR.ILLEGALDXILOPCODE DXILOpCode must be valid o INSTR.ILLEGALDXILOPFUNCTION '%0' is not a DXILOpFuncition for DXILOpcode '%1'. INSTR.IMMBIASFORSAMPLEB bias amount for sample_b must be in the range [%0,%1], but %2 was specified as an immediate. INSTR.INBOUNDSACCESS Access to out-of-bounds memory is disallowed. -INSTR.LINALGILLEGALCOMPONENTTYPE Matrix Component Type '%0' not allowed in LinAlg Matrix. +INSTR.LINALGILLEGALCOMPONENTTYPE Component Type '%0' not allowed in LinAlg Matrix. INSTR.LINALGILLEGALKDIM Matrix K Dimension out of bounds. K=%0 must be >= %1 and <= %2. INSTR.LINALGMATRIXDIMMISMATCH Matrix Dimension '%0x%1' does not match expected dimension %2x%3. INSTR.LINALGMATRIXDIMVECTORMISMATCH %0 vector size '%1' must match matrix %2 dimension '%3' diff --git a/lib/DxilValidation/DxilValidation.cpp b/lib/DxilValidation/DxilValidation.cpp index b2bede7e4e..9670044c60 100644 --- a/lib/DxilValidation/DxilValidation.cpp +++ b/lib/DxilValidation/DxilValidation.cpp @@ -1096,16 +1096,17 @@ static void ValidateLinAlgMatrixStoreToMemory(CallInst *CI, ValidateLinAlgOpParameters(CI, ValCtx); } -static void ValidateLinAlgMatVecMul(CallInst *CI, ValidationContext &ValCtx) { +static void ValidateLinAlgMatVecMul(CallInst *CI, ValidationContext &ValCtx, + const char *OpName = "LinAlgMatVecMul") { ValidateLinAlgOpParameters(CI, ValCtx); + DxilInst_LinAlgMatVecMul Op(CI); + VectorType *OutputVecTy = cast(CI->getType()); - Type *MatTy = CI->getArgOperand(1)->getType(); - Value *IsSignedOp = CI->getArgOperand(2); - ConstantInt *IsSignedCI = dyn_cast(IsSignedOp); - VectorType *InputVecTy = cast(CI->getArgOperand(3)->getType()); - Value *InputInterpOp = CI->getArgOperand(4); - ConstantInt *InputInterpCI = dyn_cast(InputInterpOp); + Type *MatTy = Op.get_matrix()->getType(); + ConstantInt *IsSignedCI = dyn_cast(Op.get_isOutputSigned()); + VectorType *InputVecTy = cast(Op.get_inputVector()->getType()); + ConstantInt *InputInterpCI = dyn_cast(Op.get_interpretation()); assert(dxilutil::IsHLSLLinAlgMatrixType(MatTy) && "Must be LinAlg type"); @@ -1131,7 +1132,7 @@ static void ValidateLinAlgMatVecMul(CallInst *CI, ValidationContext &ValCtx) { ValidateLinAlgComponentType(CI, Interp, ValCtx); } else ValCtx.EmitInstrFormatError(CI, ValidationRule::InstrOpConst, - {"InputInterp", "LinAlgMatVecMul"}); + {"InputInterp", OpName}); // InputVec length must match K dim // K is always N since Use is always A however when the element is packed @@ -1162,21 +1163,23 @@ static void ValidateLinAlgMatVecMul(CallInst *CI, ValidationContext &ValCtx) { {TypeToString(OutputVecTy->getElementType())}); } else ValCtx.EmitInstrFormatError(CI, ValidationRule::InstrOpConst, - {"IsSigned", "LinAlgMatVecMul"}); + {"IsSigned", OpName}); } static void ValidateLinAlgMatVecMulAdd(CallInst *CI, ValidationContext &ValCtx) { // All the rules from LinAlgMatVecMul apply - ValidateLinAlgMatVecMul(CI, ValCtx); + ValidateLinAlgMatVecMul(CI, ValCtx, "LinAlgMatVecMulAdd"); + + DxilInst_LinAlgMatVecMulAdd Op(CI); VectorType *OutputVecTy = cast(CI->getType()); - Type *MatTy = CI->getArgOperand(1)->getType(); + Type *MatTy = Op.get_matrix()->getType(); auto MatIt = ValCtx.LinAlgTargetTypeMap.find(MatTy); if (MatIt == ValCtx.LinAlgTargetTypeMap.end()) return; LinAlgTargetType MatLATT = MatIt->second; - VectorType *BiasVecTy = cast(CI->getArgOperand(5)->getType()); + VectorType *BiasVecTy = cast(Op.get_biasVector()->getType()); // BiasVec length must match M dim if (MatLATT.M != BiasVecTy->getNumElements()) 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 89e1510d9d..a499d43a6d 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-illegal-component-type.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-illegal-component-type.ll @@ -14,7 +14,7 @@ define void @main() { %1 = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 0, i32 0, i32 0, i8 1 }, i32 0, i1 false) ; CreateHandleFromBinding(bind,index,nonUniformIndex) %handle = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 4107, i32 0 }) ; AnnotateHandle(res,props) resource: RWByteAddressBuffer - ; CHECK: Function: main: error: Matrix Component Type 'Invalid' not allowed in LinAlg Matrix. + ; CHECK: Function: main: error: Component Type 'Invalid' not allowed in LinAlg Matrix. ; CHECK-NEXT: note: at '%mC0M128N128U0S0 ; Matrix %mC0M128N128U0S0 = call %dx.types.LinAlgMatrixC0M128N128U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC0M128N128U0S0(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0) diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll index d0217cbeb9..a5186d94fc 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmul.ll @@ -19,7 +19,7 @@ define void @main() { %2 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer %3 = call %dx.types.LinAlgMatrixC9M4N32U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N32U0S0(i32 -2147483634, %dx.types.Handle %2, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) - ; CHECK: Function: main: error: Matrix Component Type 'I1' not allowed in LinAlg Matrix. + ; CHECK: Function: main: error: Component Type 'I1' not allowed in LinAlg Matrix. ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMul.v4f32.mC9M4N32U0S0.v8f32 %4 = call <4 x float> @dx.op.linAlgMatVecMul.v4f32.mC9M4N32U0S0.v8f32(i32 -2147483623, %dx.types.LinAlgMatrixC9M4N32U0S0 %3, i1 true, <8 x float> , i32 1) ; LinAlgMatVecMul(matrix,isOutputSigned,inputVector,interpretation) %5 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll index c656042c98..4f1bf7e5ef 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matvecmuladd.ll @@ -18,7 +18,7 @@ define void @main() { %2 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer %3 = call %dx.types.LinAlgMatrixC9M4N32U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC9M4N32U0S0(i32 -2147483634, %dx.types.Handle %2, i32 0, i32 0, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) - ; CHECK: Function: main: error: Matrix Component Type 'I1' not allowed in LinAlg Matrix. + ; CHECK: Function: main: error: Component Type 'I1' not allowed in LinAlg Matrix. ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N32U0S0.v8f32.v4f32 %4 = call <4 x float> @dx.op.linAlgMatVecMulAdd.v4f32.mC9M4N32U0S0.v8f32.v4f32(i32 -2147483622, %dx.types.LinAlgMatrixC9M4N32U0S0 %3, i1 true, <8 x float> , i32 1, <4 x float> ) ; LinAlgMatVecMulAdd(matrix,isOutputSigned,inputVector,inputInterpretation,biasVector) %5 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 7a41931667..968b9b30e8 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -8640,7 +8640,7 @@ def build_valrules(self): ) self.add_valrule( "Instr.LinAlgIllegalComponentType", - "Matrix Component Type '%0' not allowed in LinAlg Matrix.", + "Component Type '%0' not allowed in LinAlg Matrix.", ) self.add_valrule( "Instr.LinAlgMatrixScopeNotAllowed",