Skip to content

Commit b581e49

Browse files
Simlify matrix layout check and fix typo in validation message matrix layout -> matrix stride
1 parent 72b8a09 commit b581e49

4 files changed

Lines changed: 7 additions & 11 deletions

File tree

docs/DXIL.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3145,7 +3145,7 @@ INSTR.LINALGINVALIDMEMORYINTERPVALUE In Memory Interpol
31453145
INSTR.LINALGINVALIDREGISTERINTERPVALUE From Register Interpretation value must be valid.
31463146
INSTR.LINALGMATRIXLAYOUTNOTTRANSPOSABLE Row Major and Column Major matrix layouts are not transposable.
31473147
INSTR.LINALGMATRIXSHAPEPARAMSARECONST Matrix Layout, Dimensions and isTranspose are constants
3148-
INSTR.LINALGMATRIXSTRIDEZEROFOROPTIMALLAYOUTS Matrix Layout for optimal layouts must be zero
3148+
INSTR.LINALGMATRIXSTRIDEZEROFOROPTIMALLAYOUTS For optimal layouts, matrix stride must be zero.
31493149
INSTR.LINALGNOTANUNSIGNEDTYPE Unsigned flag set for a float signed type
31503150
INSTR.MATVECOPISUNSIGNEDFLAGSARECONST In Linalg Mul/MulAdd functions, IsUnsigned flag is a constant.
31513151
INSTR.MAYREORDERTHREADUNDEFCOHERENCEHINTPARAM Use of undef coherence hint or num coherence hint bits in MaybeReorderThread.

lib/DxilValidation/DxilValidation.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -997,11 +997,6 @@ static bool CheckMatrixLayoutForMatVecMulOps(unsigned Layout) {
997997
static_cast<unsigned>(DXIL::LinalgMatrixLayout::OuterProductOptimal);
998998
}
999999

1000-
static bool CheckMatrixLayoutForOuterProdAcc(unsigned Layout) {
1001-
return Layout ==
1002-
static_cast<unsigned>(DXIL::LinalgMatrixLayout::OuterProductOptimal);
1003-
}
1004-
10051000
std::string GetMatrixLayoutStr(unsigned Layout) {
10061001
switch (static_cast<DXIL::LinalgMatrixLayout>(Layout)) {
10071002
case DXIL::LinalgMatrixLayout::RowMajor:
@@ -1236,7 +1231,8 @@ static void ValidateImmOperandsForOuterProdAcc(CallInst *CI,
12361231
}
12371232
ConstantInt *ML = cast<ConstantInt>(MatrixLayout);
12381233
uint64_t MLValue = ML->getLimitedValue();
1239-
if (!CheckMatrixLayoutForOuterProdAcc(MLValue))
1234+
if (MLValue !=
1235+
static_cast<unsigned>(DXIL::LinalgMatrixLayout::OuterProductOptimal))
12401236
ValCtx.EmitInstrFormatError(
12411237
CI,
12421238
ValidationRule::

tools/clang/test/CodeGenDXIL/hlsl/intrinsics/linalg_builtins/outer-product-accumulate-matrix-layout.hlsl renamed to tools/clang/test/CodeGenHLSL/linalg/outer-product-accumulate-matrix-layout.hlsl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// RUN: %dxc -T cs_6_9 %s -enable-16bit-types -DML=RowMajor -DSTRIDE=64 2>&1| FileCheck %s --check-prefixes DXIL-0
32
// RUN: %dxc -T cs_6_9 %s -enable-16bit-types -DML=ColumnMajor -DSTRIDE=64 2>&1 | FileCheck %s --check-prefixes DXIL-1
43
// RUN: %dxc -T cs_6_9 %s -enable-16bit-types -DML=MulOptimal -DSTRIDE=64 2>&1 | FileCheck %s --check-prefixes DXIL-2
@@ -47,7 +46,7 @@ enum MatLayout {
4746
// DXIL-1: error: matrix layout value 'ColumnMajor' is not valid for outerproductaccumulate, must be 'OuterProductOptimal'
4847
// DXIL-2: error: matrix layout value 'MulOptimal' is not valid for outerproductaccumulate, must be 'OuterProductOptimal'
4948
// DXIL-3-NOT: error: matrix layout value 'OuterProductOptimal' is not valid for outerproductaccumulate, must be 'OuterProductOptimal'
50-
// DXIL-3: error: Matrix Layout for optimal layouts must be zero
49+
// DXIL-3: error: matrix stride must be zero for optimal layouts
5150
// DXIL-4: call void @dx.op.outerProductAccumulate.v8f16.v8f16(i32 307, <8 x half> %{{[^ ]+}}, <8 x half> %{{[^ ]+}}, %dx.types.Handle %{{[^ ]+}}, i32 0, i32 8, i32 3, i32 0)
5251

5352
[Numthreads(1,1,1)]

utils/hct/hctdb.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8447,9 +8447,10 @@ def build_valrules(self):
84478447
"matrix layout value '%0' is not valid. Must be between [%1 - %2]",
84488448
)
84498449

8450-
self.add_valrule(
8450+
self.add_valrule_msg(
84518451
"Instr.LinalgMatrixStrideZeroForOptimalLayouts",
8452-
"Matrix Layout for optimal layouts must be zero",
8452+
"For optimal layouts, matrix stride must be zero.",
8453+
"matrix stride must be zero for optimal layouts",
84538454
)
84548455

84558456
self.add_valrule_msg(

0 commit comments

Comments
 (0)