Skip to content

Commit 5955df0

Browse files
authored
[SM6.10] LinAlg Validation: MatrixAccumulate (#8627)
Fixes #8501
1 parent 63264ca commit 5955df0

8 files changed

Lines changed: 213 additions & 12 deletions

File tree

docs/DXIL.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,8 +3212,11 @@ INSTR.INBOUNDSACCESS Access to out-of-bounds me
32123212
INSTR.LINALGILLEGALCOMPONENTTYPE Matrix Component Type '%0' not allowed in LinAlg Matrix.
32133213
INSTR.LINALGILLEGALKDIM Matrix K Dimension out of bounds. K=%0 must be >= %1 and <= %2.
32143214
INSTR.LINALGMATRIXDIMMISMATCH Matrix Dimension '%0x%1' does not match expected dimension %2x%3.
3215+
INSTR.LINALGMATRIXNOTEXACTMATCH Matrix '%0' must exactly match matrix '%1'.
32153216
INSTR.LINALGMATRIXSCOPEMISMATCH Matrix Scope '%0' does not match expected scope %1.
32163217
INSTR.LINALGMATRIXSCOPENOTALLOWED Matrix Scope '%0' not allowed in %1 operation.
3218+
INSTR.LINALGMATRIXUSEMISMATCH Matrix Use '%0' does not match expected use %1.
3219+
INSTR.LINALGMATRIXUSEMISMATCH2 Matrix Use '%0' does not match expected use %1 or %2.
32173220
INSTR.MAYREORDERTHREADUNDEFCOHERENCEHINTPARAM Use of undef coherence hint or num coherence hint bits in MaybeReorderThread.
32183221
INSTR.MINPRECISIONNOTPRECISE Instructions marked precise may not refer to minprecision values.
32193222
INSTR.MINPRECISONBITCAST Bitcast on minprecison types is not allowed.

lib/DxilValidation/DxilValidation.cpp

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2273,13 +2273,71 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
22732273
case DXIL::OpCode::LinAlgMatrixLoadFromMemory:
22742274
case DXIL::OpCode::LinAlgMatrixSetElement:
22752275
case DXIL::OpCode::LinAlgMatrixMultiply:
2276-
case DXIL::OpCode::LinAlgMatrixAccumulate:
22772276
case DXIL::OpCode::LinAlgMatrixMultiplyAccumulate:
22782277
case DXIL::OpCode::LinAlgMatrixOuterProduct: {
22792278
ValidateLinAlgOpReturnMatrix(CI, ValCtx);
22802279
ValidateLinAlgOpParameters(CI, ValCtx);
22812280
break;
22822281
}
2282+
case DXIL::OpCode::LinAlgMatrixAccumulate: {
2283+
ValidateLinAlgOpReturnMatrix(CI, ValCtx);
2284+
ValidateLinAlgOpParameters(CI, ValCtx);
2285+
2286+
Type *RetMatTy = CI->getType();
2287+
Type *LHSMatTy = CI->getArgOperand(1)->getType();
2288+
Type *RHSMatTy = CI->getArgOperand(2)->getType();
2289+
assert(dxilutil::IsHLSLLinAlgMatrixType(RetMatTy) &&
2290+
dxilutil::IsHLSLLinAlgMatrixType(LHSMatTy) &&
2291+
dxilutil::IsHLSLLinAlgMatrixType(RHSMatTy) &&
2292+
"Must be LinAlg types");
2293+
2294+
// Ret and LHS must have the exact same type
2295+
if (RetMatTy != LHSMatTy) {
2296+
StructType *RetST = cast<StructType>(RetMatTy);
2297+
StructType *LHSST = cast<StructType>(LHSMatTy);
2298+
2299+
ValCtx.EmitInstrFormatError(
2300+
CI, ValidationRule::InstrLinAlgMatrixNotExactMatch,
2301+
{RetST->getName(), LHSST->getName()});
2302+
}
2303+
auto RetIt = ValCtx.LinAlgTargetTypeMap.find(RetMatTy);
2304+
auto RHSIt = ValCtx.LinAlgTargetTypeMap.find(RHSMatTy);
2305+
if (RetIt == ValCtx.LinAlgTargetTypeMap.end())
2306+
break;
2307+
if (RHSIt == ValCtx.LinAlgTargetTypeMap.end())
2308+
break;
2309+
LinAlgTargetType RetLATT = RetIt->second;
2310+
LinAlgTargetType RHSLATT = RHSIt->second;
2311+
2312+
if (RetLATT.Use != DXIL::MatrixUse::Accumulator)
2313+
ValCtx.EmitInstrFormatError(
2314+
CI, ValidationRule::InstrLinAlgMatrixUseMismatch,
2315+
{MatrixUseToString(RetLATT.Use), "Accumulator"});
2316+
2317+
if (RHSLATT.Use == DXIL::MatrixUse::Accumulator)
2318+
ValCtx.EmitInstrFormatError(CI,
2319+
ValidationRule::InstrLinAlgMatrixUseMismatch2,
2320+
{MatrixUseToString(RHSLATT.Use), "A", "B"});
2321+
2322+
if (RetLATT.Scope != RHSLATT.Scope)
2323+
ValCtx.EmitInstrFormatError(
2324+
CI, ValidationRule::InstrLinAlgMatrixScopeMismatch,
2325+
{MatrixScopeToString(RHSLATT.Scope),
2326+
MatrixScopeToString(RetLATT.Scope)});
2327+
2328+
if (RetLATT.Scope == DXIL::MatrixScope::Thread)
2329+
ValCtx.EmitInstrFormatError(
2330+
CI, ValidationRule::InstrLinAlgMatrixScopeNotAllowed,
2331+
{"Thread", "LinAlgMatrixAccumulate"});
2332+
2333+
if (RetLATT.M != RHSLATT.M || RetLATT.N != RHSLATT.N)
2334+
ValCtx.EmitInstrFormatError(
2335+
CI, ValidationRule::InstrLinAlgMatrixDimMismatch,
2336+
{std::to_string(RHSLATT.M), std::to_string(RHSLATT.N),
2337+
std::to_string(RetLATT.M), std::to_string(RetLATT.N)});
2338+
2339+
break;
2340+
}
22832341
case DXIL::OpCode::LinAlgCopyConvertMatrix: {
22842342
ValidateLinAlgOpReturnMatrix(CI, ValCtx);
22852343
ValidateLinAlgOpParameters(CI, ValCtx);

lib/DxilValidation/DxilValidationUtils.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,4 +683,17 @@ llvm::StringRef MatrixScopeToString(DXIL::MatrixScope MS) {
683683
}
684684
}
685685

686+
llvm::StringRef MatrixUseToString(DXIL::MatrixUse MU) {
687+
switch (MU) {
688+
case DXIL::MatrixUse::A:
689+
return "A";
690+
case DXIL::MatrixUse::B:
691+
return "B";
692+
case DXIL::MatrixUse::Accumulator:
693+
return "Accumulator";
694+
default:
695+
return "Unknown MatrixUse";
696+
}
697+
}
698+
686699
} // namespace hlsl

lib/DxilValidation/DxilValidationUtils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,6 @@ uint32_t ValidateDxilModule(llvm::Module *pModule, llvm::Module *pDebugModule);
159159
llvm::StringRef ComponentTypeToString(DXIL::ComponentType CT);
160160

161161
llvm::StringRef MatrixScopeToString(DXIL::MatrixScope MS);
162+
163+
llvm::StringRef MatrixUseToString(DXIL::MatrixUse MU);
162164
} // namespace hlsl

tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixaccumulate/nominal.hlsl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
void main() {
77
// CHECK-LABEL: define void @main()
88

9-
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 4, 4, 0, 0)]] mat1;
10-
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 4, 4, 0, 0)]] mat2;
11-
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 4, 4, 0, 0)]] mat3;
9+
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 4, 4, 0, 1)]] mat1;
10+
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 4, 4, 2, 1)]] mat2;
11+
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 4, 4, 2, 1)]] mat3;
1212

1313
__builtin_LinAlg_FillMatrix(mat1, 1);
1414
__builtin_LinAlg_FillMatrix(mat2, 2);
1515

16-
// CHECK: call %dx.types.LinAlgMatrixC5M4N4U0S0 @dx.op.linAlgMatrixAccumulate.mC5M4N4U0S0.mC5M4N4U0S0.mC5M4N4U0S0
17-
// CHECK-SAME: (i32 -2147483624, %dx.types.LinAlgMatrixC5M4N4U0S0 %{{.*}}, %dx.types.LinAlgMatrixC5M4N4U0S0 %{{.*}}) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
16+
// CHECK: call %dx.types.LinAlgMatrixC5M4N4U2S1 @dx.op.linAlgMatrixAccumulate.mC5M4N4U2S1.mC5M4N4U2S1.mC5M4N4U0S1
17+
// CHECK-SAME: (i32 -2147483624, %dx.types.LinAlgMatrixC5M4N4U2S1 %{{.*}}, %dx.types.LinAlgMatrixC5M4N4U0S1 %{{.*}}) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
1818

19-
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC5M4N4U0S0*, %dx.types.LinAlgMatrixC5M4N4U0S0,
20-
// CHECK2-SAME: %dx.types.LinAlgMatrixC5M4N4U0S0)"(i32 411, %dx.types.LinAlgMatrixC5M4N4U0S0* %mat3,
21-
// CHECK2-SAME: %dx.types.LinAlgMatrixC5M4N4U0S0 %{{[0-9]+}}, %dx.types.LinAlgMatrixC5M4N4U0S0 %{{[0-9]+}})
19+
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC5M4N4U2S1*, %dx.types.LinAlgMatrixC5M4N4U2S1,
20+
// CHECK2-SAME: %dx.types.LinAlgMatrixC5M4N4U0S1)"(i32 411, %dx.types.LinAlgMatrixC5M4N4U2S1* %mat3,
21+
// CHECK2-SAME: %dx.types.LinAlgMatrixC5M4N4U2S1 %{{[0-9]+}}, %dx.types.LinAlgMatrixC5M4N4U0S1 %{{[0-9]+}})
2222
__builtin_LinAlg_MatrixAccumulate(mat3, mat2, mat1);
2323
}

tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ target triple = "dxil-ms-dx"
1111
%dx.types.LinAlgMatrixC4M5N4U2S2 = type { i8* }
1212
%dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* }
1313
%dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* }
14+
%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* }
1415
%dx.types.ResourceProperties = type { i32, i32 }
1516
%struct.RWByteAddressBuffer = type { i32 }
1617

@@ -27,9 +28,10 @@ define void @mainCS() {
2728

2829
%mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0)
2930
%mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0)
31+
%mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %handle, i32 0, i32 0, i32 0, i32 0)
3032

3133
; dx.op.linAlgMatrixAccumulate
32-
%v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
34+
%v1 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixAccumulate.mC4M4N5U2S2.mC4M4N5U2S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
3335

3436
; dx.op.linAlgMatrixAccumulateToDescriptor
3537
call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %handle, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align)
@@ -102,7 +104,7 @@ define void @mainCS() {
102104
declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixMultiply.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2) #0
103105

104106
; Function Attrs: nounwind
105-
declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2) #0
107+
declare %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixAccumulate.mC4M4N5U2S2.mC4M4N5U2S2.mC4M4N5U1S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.LinAlgMatrixC4M4N5U1S2) #0
106108

107109
; Function Attrs: nounwind
108110
declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0
@@ -119,6 +121,9 @@ declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.m
119121
; Function Attrs: nounwind
120122
declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0
121123

124+
; Function Attrs: nounwind
125+
declare %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0
126+
122127
; Function Attrs: nounwind
123128
declare %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixOuterProduct.mC4M5N4U0S2.v4i32.v4i32(i32, <4 x i32>, <4 x i32>) #0
124129

@@ -173,7 +178,7 @@ declare %dx.types.Handle @dx.op.createHandleFromBinding(i32, %dx.types.ResBind,
173178
attributes #0 = { nounwind }
174179
attributes #1 = { nounwind readnone }
175180

176-
!dx.targetTypes = !{!0, !1, !2}
181+
!dx.targetTypes = !{!0, !1, !2, !12}
177182
!llvm.ident = !{!3}
178183
!dx.version = !{!4}
179184
!dx.valver = !{!4}
@@ -193,3 +198,4 @@ attributes #1 = { nounwind readnone }
193198
!9 = !{void ()* @mainCS, !"mainCS", null, !6, !10}
194199
!10 = !{i32 0, i64 8589934608, i32 4, !11}
195200
!11 = !{i32 4, i32 4, i32 4}
201+
!12 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
; REQUIRES: dxil-1-10
2+
; RUN: not %dxv %s 2>&1 | FileCheck %s
3+
target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64"
4+
target triple = "dxil-ms-dx"
5+
6+
%dx.types.LinAlgMatrixC8M4N4U2S2 = type { i8* }
7+
%dx.types.LinAlgMatrixC8M4N4U0S2 = type { i8* }
8+
%dx.types.LinAlgMatrixC8M4N4U2S0 = type { i8* }
9+
%dx.types.LinAlgMatrixC8M4N4U1S0 = type { i8* }
10+
%dx.types.LinAlgMatrixC8M4N4U1S1 = type { i8* }
11+
%dx.types.LinAlgMatrixC8M8N8U0S2 = type { i8* }
12+
13+
define void @main() {
14+
%1 = call %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgFillMatrix.mC8M4N4U2S2.i32(i32 -2147483636, i32 1) ; LinAlgFillMatrix(value)
15+
%2 = call %dx.types.LinAlgMatrixC8M4N4U0S2 @dx.op.linAlgFillMatrix.mC8M4N4U0S2.i32(i32 -2147483636, i32 2) ; LinAlgFillMatrix(value)
16+
%3 = call %dx.types.LinAlgMatrixC8M4N4U2S0 @dx.op.linAlgFillMatrix.mC8M4N4U2S0.i32(i32 -2147483636, i32 4) ; LinAlgFillMatrix(value)
17+
%4 = call %dx.types.LinAlgMatrixC8M4N4U1S0 @dx.op.linAlgFillMatrix.mC8M4N4U1S0.i32(i32 -2147483636, i32 5) ; LinAlgFillMatrix(value)
18+
%5 = call %dx.types.LinAlgMatrixC8M4N4U1S1 @dx.op.linAlgFillMatrix.mC8M4N4U1S1.i32(i32 -2147483636, i32 6) ; LinAlgFillMatrix(value)
19+
%6 = call %dx.types.LinAlgMatrixC8M8N8U0S2 @dx.op.linAlgFillMatrix.mC8M8N8U0S2.i32(i32 -2147483636, i32 7) ; LinAlgFillMatrix(value)
20+
21+
; CHECK: Function: main: error: Matrix 'dx.types.LinAlgMatrixC8M4N4U2S2' must exactly match matrix 'dx.types.LinAlgMatrixC8M4N4U0S2'.
22+
; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U0S2.mC8M4N4U0S2
23+
%7 = call %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U0S2.mC8M4N4U0S2(i32 -2147483624, %dx.types.LinAlgMatrixC8M4N4U0S2 %2, %dx.types.LinAlgMatrixC8M4N4U0S2 %2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
24+
25+
; CHECK-NEXT: Function: main: error: Matrix Use 'A' does not match expected use Accumulator.
26+
; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulate.mC8M4N4U0S2.mC8M4N4U0S2.mC8M4N4U0S2
27+
%8 = call %dx.types.LinAlgMatrixC8M4N4U0S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U0S2.mC8M4N4U0S2.mC8M4N4U0S2(i32 -2147483624, %dx.types.LinAlgMatrixC8M4N4U0S2 %2, %dx.types.LinAlgMatrixC8M4N4U0S2 %2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
28+
29+
; CHECK-NEXT: Function: main: error: Matrix Use 'Accumulator' does not match expected use A or B.
30+
; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U2S2.mC8M4N4U2S2
31+
%9 = call %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U2S2.mC8M4N4U2S2(i32 -2147483624, %dx.types.LinAlgMatrixC8M4N4U2S2 %1, %dx.types.LinAlgMatrixC8M4N4U2S2 %1) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
32+
33+
; CHECK-NEXT: Function: main: error: Matrix Scope 'Wave' does not match expected scope ThreadGroup.
34+
; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U2S2.mC8M4N4U1S1
35+
%10 = call %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U2S2.mC8M4N4U1S1(i32 -2147483624, %dx.types.LinAlgMatrixC8M4N4U2S2 %1, %dx.types.LinAlgMatrixC8M4N4U1S1 %5) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
36+
37+
; CHECK-NEXT: Function: main: error: Matrix Scope 'Thread' not allowed in LinAlgMatrixAccumulate operation.
38+
; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S0.mC8M4N4U2S0.mC8M4N4U1S0
39+
%11 = call %dx.types.LinAlgMatrixC8M4N4U2S0 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S0.mC8M4N4U2S0.mC8M4N4U1S0(i32 -2147483624, %dx.types.LinAlgMatrixC8M4N4U2S0 %3, %dx.types.LinAlgMatrixC8M4N4U1S0 %4) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
40+
41+
; CHECK-NEXT: Function: main: error: Matrix Dimension '8x8' does not match expected dimension 4x4.
42+
; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U2S2.mC8M8N8U0S2
43+
%12 = call %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U2S2.mC8M8N8U0S2(i32 -2147483624, %dx.types.LinAlgMatrixC8M4N4U2S2 %1, %dx.types.LinAlgMatrixC8M8N8U0S2 %6) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS)
44+
45+
; CHECK-NEXT: Validation failed
46+
47+
ret void
48+
}
49+
50+
; Function Attrs: nounwind
51+
declare %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgFillMatrix.mC8M4N4U2S2.i32(i32, i32) #0
52+
53+
; Function Attrs: nounwind
54+
declare %dx.types.LinAlgMatrixC8M4N4U0S2 @dx.op.linAlgFillMatrix.mC8M4N4U0S2.i32(i32, i32) #0
55+
56+
; Function Attrs: nounwind
57+
declare %dx.types.LinAlgMatrixC8M4N4U2S0 @dx.op.linAlgFillMatrix.mC8M4N4U2S0.i32(i32, i32) #0
58+
59+
; Function Attrs: nounwind
60+
declare %dx.types.LinAlgMatrixC8M4N4U1S0 @dx.op.linAlgFillMatrix.mC8M4N4U1S0.i32(i32, i32) #0
61+
62+
; Function Attrs: nounwind
63+
declare %dx.types.LinAlgMatrixC8M4N4U1S1 @dx.op.linAlgFillMatrix.mC8M4N4U1S1.i32(i32, i32) #0
64+
65+
; Function Attrs: nounwind
66+
declare %dx.types.LinAlgMatrixC8M8N8U0S2 @dx.op.linAlgFillMatrix.mC8M8N8U0S2.i32(i32, i32) #0
67+
68+
; Function Attrs: nounwind
69+
declare %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U0S2.mC8M4N4U0S2(i32, %dx.types.LinAlgMatrixC8M4N4U0S2, %dx.types.LinAlgMatrixC8M4N4U0S2) #0
70+
71+
; Function Attrs: nounwind
72+
declare %dx.types.LinAlgMatrixC8M4N4U0S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U0S2.mC8M4N4U0S2.mC8M4N4U0S2(i32, %dx.types.LinAlgMatrixC8M4N4U0S2, %dx.types.LinAlgMatrixC8M4N4U0S2) #0
73+
74+
; Function Attrs: nounwind
75+
declare %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U2S2.mC8M4N4U2S2(i32, %dx.types.LinAlgMatrixC8M4N4U2S2, %dx.types.LinAlgMatrixC8M4N4U2S2) #0
76+
77+
; Function Attrs: nounwind
78+
declare %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U2S2.mC8M4N4U1S1(i32, %dx.types.LinAlgMatrixC8M4N4U2S2, %dx.types.LinAlgMatrixC8M4N4U1S1) #0
79+
80+
; Function Attrs: nounwind
81+
declare %dx.types.LinAlgMatrixC8M4N4U2S0 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S0.mC8M4N4U2S0.mC8M4N4U1S0(i32, %dx.types.LinAlgMatrixC8M4N4U2S0, %dx.types.LinAlgMatrixC8M4N4U1S0) #0
82+
83+
; Function Attrs: nounwind
84+
declare %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixAccumulate.mC8M4N4U2S2.mC8M4N4U2S2.mC8M8N8U0S2(i32, %dx.types.LinAlgMatrixC8M4N4U2S2, %dx.types.LinAlgMatrixC8M8N8U0S2) #0
85+
86+
attributes #0 = { nounwind }
87+
88+
!dx.targetTypes = !{!0, !1, !2, !3, !4, !5}
89+
!llvm.ident = !{!6}
90+
!dx.version = !{!7}
91+
!dx.valver = !{!7}
92+
!dx.shaderModel = !{!8}
93+
!dx.entryPoints = !{!9}
94+
95+
!0 = !{%dx.types.LinAlgMatrixC8M4N4U2S2 undef, i32 8, i32 4, i32 4, i32 2, i32 2}
96+
!1 = !{%dx.types.LinAlgMatrixC8M4N4U0S2 undef, i32 8, i32 4, i32 4, i32 0, i32 2}
97+
!2 = !{%dx.types.LinAlgMatrixC8M4N4U2S0 undef, i32 8, i32 4, i32 4, i32 2, i32 0}
98+
!3 = !{%dx.types.LinAlgMatrixC8M4N4U1S0 undef, i32 8, i32 4, i32 4, i32 1, i32 0}
99+
!4 = !{%dx.types.LinAlgMatrixC8M4N4U1S1 undef, i32 8, i32 4, i32 4, i32 1, i32 1}
100+
!5 = !{%dx.types.LinAlgMatrixC8M8N8U0S2 undef, i32 8, i32 8, i32 8, i32 0, i32 2}
101+
!6 = !{!"dxc(private) 1.9.0.5391 (linalg-validation-copyconvert, 977f44792-dirty)"}
102+
!7 = !{i32 1, i32 10}
103+
!8 = !{!"cs", i32 6, i32 10}
104+
!9 = !{void ()* @main, !"main", null, null, !10}
105+
!10 = !{i32 4, !11}
106+
!11 = !{i32 1, i32 1, i32 1}

utils/hct/hctdb.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8656,6 +8656,19 @@ def build_valrules(self):
86568656
"Instr.LinAlgMatrixDimMismatch",
86578657
"Matrix Dimension '%0x%1' does not match expected dimension %2x%3.",
86588658
)
8659+
self.add_valrule(
8660+
"Instr.LinAlgMatrixUseMismatch",
8661+
"Matrix Use '%0' does not match expected use %1.",
8662+
)
8663+
self.add_valrule(
8664+
"Instr.LinAlgMatrixUseMismatch2",
8665+
"Matrix Use '%0' does not match expected use %1 or %2.",
8666+
)
8667+
self.add_valrule(
8668+
"Instr.LinAlgMatrixNotExactMatch",
8669+
"Matrix '%0' must exactly match matrix '%1'.",
8670+
)
8671+
86598672
# Some legacy rules:
86608673
# - space is only supported for shader targets 5.1 and higher
86618674
# - multiple rules regarding derivatives, which isn't a supported feature for DXIL

0 commit comments

Comments
 (0)