Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/DXIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3209,14 +3209,18 @@ 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.LINALGMATRIXDIMKVECKMISMATCH %0 vector size '%1' must be %2 for matrix with K '%3' and Type '%4'
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.
Expand Down
175 changes: 150 additions & 25 deletions lib/DxilValidation/DxilValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -995,6 +996,58 @@ 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:
Comment thread
bob80905 marked this conversation as resolved.
Resolved
case DXIL::ComponentType::BFloat16:
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;
case DXIL::ComponentType::BFloat16:
return 2;
case DXIL::ComponentType::I8:
case DXIL::ComponentType::U8:
case DXIL::ComponentType::F8_E4M3FN:
case DXIL::ComponentType::F8_E5M2:
return 4;
// All other ComponentTypes are illegal to use in LinAlg Matrix. Their usage
// is detected and reported in other parts on the validator
default:
return 4;
Comment on lines +1046 to +1047

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth listing out the elements here or a comment as it isn't immediately obvious why this would the case.

nit: Also I would expect LastEntry/Invalid should maybe be 0? Although it is presumably unreachable in any case

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern of only listing out the native types was copied over from what we do in the linalg.h header (which this comment reminds me, I need to do BFloat16 = 2 here)

Happy to explictly list them and add a comment like 8bit => 4 elements

I think I'd rather asster on LastEntry/Invalid. IIRC ComponentTypeElementsPerScalar can be used as a divisor so 0 would be a really bad potential value

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! 1141

unsigned K = (MatLATT.N + ElementsPerScalar - 1) / ElementsPerScalar;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Listing them and asserting otherwise sounds good to me

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I can't assert here because it'll crash the tests where we intentionally use invalid types to verify a validation error is raised. I think this we have the validation error it should be okay to add a comment along the lines of all other values are invalid and their usage is detected in other parts of the validator

}
}

static void ValidateLinAlgOpReturnMatrix(CallInst *CI,
ValidationContext &ValCtx) {
Type *Ty = CI->getType();
Expand Down Expand Up @@ -1025,29 +1078,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:
case DXIL::ComponentType::BFloat16:
break;
default:
ValCtx.EmitInstrFormatError(CI,
ValidationRule::InstrLinAlgIllegalComponentType,
{ComponentTypeToString(LATT.Type)});
break;
}
ValidateLinAlgComponentType(CI, LATT.Type, ValCtx);
}

static void ValidateLinAlgMatrixLength(CallInst *CI,
Expand Down Expand Up @@ -1075,13 +1106,107 @@ 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<VectorType>(CI->getType());
Type *MatTy = Op.get_matrix()->getType();
ConstantInt *IsSignedCI = dyn_cast<ConstantInt>(Op.get_isOutputSigned());
VectorType *InputVecTy = cast<VectorType>(Op.get_inputVector()->getType());
ConstantInt *InputInterpCI = dyn_cast<ConstantInt>(Op.get_interpretation());

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<DXIL::ComponentType>(InputInterpCI->getLimitedValue());
ValidateLinAlgComponentType(CI, Interp, ValCtx);
Comment thread
V-FEXrt marked this conversation as resolved.
Resolved
} else
ValCtx.EmitInstrFormatError(CI, ValidationRule::InstrOpConst,
{"InputInterp", OpName});

// InputVec's length must match the K dim of input matrix after accounting
// for multiple elements packed into a single scalar. The packed elements may
// not fully saturate the final vector element but it must still be included.
// K is always the N of the matrix since its ensured to be an A Matrix.
unsigned ElementsPerScalar = ComponentTypeElementsPerScalar(Interp);
unsigned ExpectedVecK =
(MatLATT.N + ElementsPerScalar - 1) / ElementsPerScalar;

if (ExpectedVecK != InputVecTy->getNumElements())
ValCtx.EmitInstrFormatError(
CI, ValidationRule::InstrLinAlgMatrixDimKVecKMismatch,
{"Input", std::to_string(InputVecTy->getNumElements()),
std::to_string(ExpectedVecK), std::to_string(MatLATT.N),
ComponentTypeToString(Interp)});

// 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", OpName});
}

static void ValidateLinAlgMatVecMulAdd(CallInst *CI,
ValidationContext &ValCtx) {
ValidateLinAlgOpParameters(CI, ValCtx);
// All the rules from LinAlgMatVecMul apply
ValidateLinAlgMatVecMul(CI, ValCtx, "LinAlgMatVecMulAdd");

DxilInst_LinAlgMatVecMulAdd Op(CI);

VectorType *OutputVecTy = cast<VectorType>(CI->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<VectorType>(Op.get_biasVector()->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
Expand Down
7 changes: 7 additions & 0 deletions lib/DxilValidation/DxilValidationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,4 +717,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
2 changes: 2 additions & 0 deletions lib/DxilValidation/DxilValidationUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these numbers changing to workaround something that now would trigger a validation error?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep!

__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> <float 1.000000e+00, float 2.000000e+00,
// CHECK-SAME: float 3.000000e+00, float 4.000000e+00>, 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> <float 1.000000e+00, float 2.000000e+00,
// CHECK-SAME: float 3.000000e+00, float 4.000000e+00>, 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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> <float 1.000000e+00,
// CHECK-SAME: float 2.000000e+00, float 3.000000e+00, float 4.000000e+00>, 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> <float 1.000000e+00,
// CHECK-SAME: float 2.000000e+00, float 3.000000e+00, float 4.000000e+00>, 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> <double 1.000000e+00,
// CHECK-SAME: double 2.000000e+00, double 3.000000e+00, double 4.000000e+00>, 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> <double 1.000000e+00,
// CHECK-SAME: double 2.000000e+00, double 3.000000e+00, double 4.000000e+00>, 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<int64_t, 4> vec3 = {1,2,3,4};
vector<int64_t, 4> 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> <i64 1,
// CHECK-SAME: i64 2, i64 3, i64 4>, 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> <i64 1,
// CHECK-SAME: i64 2, i64 3, i64 4>, 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);
Expand All @@ -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);
}
Loading
Loading