diff --git a/docs/DXIL.rst b/docs/DXIL.rst index 1d150e17d5..6431bf4139 100644 --- a/docs/DXIL.rst +++ b/docs/DXIL.rst @@ -3216,6 +3216,7 @@ INSTR.LINALGMATRIXDIMMISMATCH Matrix Dimension '%0x%1' d INSTR.LINALGMATRIXDIMVECTORMISMATCH %0 vector size '%1' must match matrix %2 dimension '%3' INSTR.LINALGMATRIXLAYOUTREQSTRIDE Matrix layout '%0' requires stride 0. INSTR.LINALGMATRIXLOADTHREADREQUIRESBAB Loading matrix with Thread scope requires ByteAddressBuffer. +INSTR.LINALGMATRIXLOADTHREADREQUIRESRWBAB Accumulating matrix requires RWByteAddressBuffer. 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. diff --git a/lib/DxilValidation/DxilValidation.cpp b/lib/DxilValidation/DxilValidation.cpp index 4982106bc8..23beb892c6 100644 --- a/lib/DxilValidation/DxilValidation.cpp +++ b/lib/DxilValidation/DxilValidation.cpp @@ -1213,6 +1213,87 @@ static void ValidateLinAlgMatrixAccumulateToDescriptor(CallInst *CI, ValidationContext &ValCtx) { ValidateLinAlgOpParameters(CI, ValCtx); + + DxilInst_LinAlgMatrixAccumulateToDescriptor Op(CI); + Type *MatTy = Op.get_matrix()->getType(); + + assert(dxilutil::IsHLSLLinAlgMatrixType(MatTy) && "Must be LinAlg type"); + auto MatIt = ValCtx.LinAlgTargetTypeMap.find(MatTy); + if (MatIt == ValCtx.LinAlgTargetTypeMap.end()) + return; + LinAlgTargetType MatLATT = MatIt->second; + + ConstantInt *LayoutCI = dyn_cast(Op.get_layout()); + if (!LayoutCI) { + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrOpConst, + {"Layout", "LinAlgMatrixAccumulateToDescriptor"}); + return; + } + auto Layout = static_cast(LayoutCI->getLimitedValue()); + bool LayoutIsRowColMajor = (Layout == DXIL::MatrixLayout::RowMajor || + Layout == DXIL::MatrixLayout::ColumnMajor); + + // Thread Matrix must have layout OuterProductOptimal* + if (MatLATT.Scope == DXIL::MatrixScope::Thread && + (Layout != DXIL::MatrixLayout::OuterProductOptimal && + Layout != DXIL::MatrixLayout::OuterProductOptimalTranspose)) + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrLinAlgMatrixScopeReqLayout2, + {MatrixScopeToString(MatLATT.Scope), "OuterProductOptimal", + "OuterProductOptimalTranspose"}); + + // Wave/ThreadGroup matrix must have layout RowMajor/ColMajor + if (MatLATT.Scope != DXIL::MatrixScope::Thread && !LayoutIsRowColMajor) + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrLinAlgMatrixScopeReqLayout2, + {MatrixScopeToString(MatLATT.Scope), "RowMajor", "ColumnMajor"}); + + // Stride must be an imm 0 if layout is not Row/Col Major + if (!LayoutIsRowColMajor) { + ConstantInt *StrideCI = dyn_cast(Op.get_stride()); + if (StrideCI) { + if (!StrideCI->isZero()) + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrLinAlgMatrixLayoutReqStride, + {MatrixLayoutToString(Layout)}); + } else + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrOpConst, + {"Stride", "LinAlgMatrixAccumulateToDescriptor"}); + } + + // Matrix must have Accumulator use + if (MatLATT.Use != DXIL::MatrixUse::Accumulator) + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrLinAlgMatrixUseMismatch, + {MatrixUseToString(MatLATT.Use), "Accumulator"}); + + // handle must be a UAV Raw buffer (RWByteAddressBuffer) + DXIL::ComponentType ResCompTy; + DXIL::ResourceClass ResClass; + DXIL::ResourceKind ResKind = + GetResourceKindAndCompTy(Op.get_handle(), ResCompTy, ResClass, ValCtx); + if (ResClass != DXIL::ResourceClass::UAV || + ResKind != DXIL::ResourceKind::RawBuffer) + ValCtx.EmitInstrError( + CI, ValidationRule::InstrLinAlgMatrixLoadThreadRequiresRWBAB); + + // Align must be an immediate constant that is a multiple of 128 greater than + // 0 + ConstantInt *AlignCI = dyn_cast(Op.get_align()); + if (AlignCI) { + unsigned Align = AlignCI->getLimitedValue(); + if (Align == 0) + ValCtx.EmitInstrFormatError(CI, ValidationRule::InstrParamMinimumValue, + {"Align", "0", std::to_string(Align)}); + if (Align % 128 != 0) + ValCtx.EmitInstrFormatError(CI, ValidationRule::InstrParamMultiple, + {"Align", "128", std::to_string(Align)}); + } else + ValCtx.EmitInstrFormatError( + CI, ValidationRule::InstrOpConst, + {"Align", "LinAlgMatrixAccumulateToDescriptor"}); } static void ValidateLinAlgMatrixAccumulateToMemory(CallInst *CI, diff --git a/tools/clang/lib/Headers/hlsl/dx/linalg.h b/tools/clang/lib/Headers/hlsl/dx/linalg.h index b0f6b30732..fa3c3857a9 100644 --- a/tools/clang/lib/Headers/hlsl/dx/linalg.h +++ b/tools/clang/lib/Headers/hlsl/dx/linalg.h @@ -438,12 +438,13 @@ class Matrix { return Result; } - template + template typename hlsl::enable_if::type InterlockedAccumulate(RWByteAddressBuffer Res, uint StartOffset) { __builtin_LinAlg_MatrixAccumulateToDescriptor( - __handle, Res, StartOffset, 0, MatrixLayout::OuterProductOptimal, 0); + __handle, Res, StartOffset, 0, MatrixLayout::OuterProductOptimal, + Align); } }; diff --git a/tools/clang/test/CodeGenDXIL/hlsl/linalg/api/matrix-class.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/linalg/api/matrix-class.hlsl index dddaff35d9..a17d03f098 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/linalg/api/matrix-class.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/linalg/api/matrix-class.hlsl @@ -215,7 +215,7 @@ void main(uint ID : SV_GroupID) // // CHECK: %[[TSACCUM:.*]] = call %dx.types.LinAlgMatrixC9M4N4U2S0 @dx.op.linAlgMatrixOuterProduct.mC9M4N4U2S0.v4f32.v4f32 // CHECK: call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC9M4N4U2S0(i32 -2147483621, -// CHECK-SAME: %dx.types.LinAlgMatrixC9M4N4U2S0 %[[TSACCUM]], %dx.types.Handle %{{[0-9]+}}, i32 0, i32 0, i32 4, i32 0) +// CHECK-SAME: %dx.types.LinAlgMatrixC9M4N4U2S0 %[[TSACCUM]], %dx.types.Handle %{{[0-9]+}}, i32 0, i32 0, i32 4, i32 128) // CHECK-SAME: ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) vector vec1 = 1.0f; vector vec2 = 2.0f; diff --git a/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixaccumulatetodescriptor/nominal.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixaccumulatetodescriptor/nominal.hlsl index 591eebf5e7..a1b8138a75 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixaccumulatetodescriptor/nominal.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixaccumulatetodescriptor/nominal.hlsl @@ -8,13 +8,15 @@ RWByteAddressBuffer outbuf; void main() { // CHECK-LABEL: define void @main() - // CHECK: call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U1S2(i32 -2147483621, - // CHECK-SAME: %dx.types.LinAlgMatrixC4M5N4U1S2 %{{.*}}, %dx.types.Handle %{{.*}}, i32 5, i32 5, i32 5, i32 4) + // CHECK: call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC9M4N4U2S0(i32 -2147483621, + // CHECK-SAME: %dx.types.LinAlgMatrixC9M4N4U2S0 %{{.*}}, %dx.types.Handle %{{.*}}, i32 0, i32 0, i32 4, i32 128) // CHECK-SAME: ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) - // CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC4M5N4U1S2, %dx.types.Handle, i32, i32, i32, i32)" - // CHECK2-SAME: (i32 415, %dx.types.LinAlgMatrixC4M5N4U1S2 %{{.*}}, %dx.types.Handle {{.*}}, i32 5, i32 5, i32 5, i32 4) - __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; + // CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC9M4N4U2S0, %dx.types.Handle, i32, i32, i32, i32)" + // CHECK2-SAME: (i32 415, %dx.types.LinAlgMatrixC9M4N4U2S0 %{{.*}}, %dx.types.Handle {{.*}}, i32 0, i32 0, i32 4, i32 128) + + // Matrix + __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(9, 4, 4, 2, 0)]] mat; __builtin_LinAlg_FillMatrix(mat, 1); - __builtin_LinAlg_MatrixAccumulateToDescriptor(mat, outbuf, 5, 5, 5, 4); + __builtin_LinAlg_MatrixAccumulateToDescriptor(mat, outbuf, 0, 0, 4, 128); } diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-as.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-as.ll index 173cabf600..8abe371cb2 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-as.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-as.ll @@ -41,6 +41,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } +%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.ByteAddressBuffer = type { i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -64,12 +65,14 @@ define void @mainAS() { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) ; dx.op.linAlgMatrixAccumulateToDescriptor - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) ; dx.op.linAlgMatrixLength %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) @@ -148,7 +151,7 @@ declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 @@ -162,6 +165,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; 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.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(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 @@ -219,7 +225,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, !13} +!dx.targetTypes = !{!0, !1, !2, !13, !16} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -243,3 +249,4 @@ attributes #1 = { nounwind readnone } !13 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} !14 = !{!15} !15 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!16 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll index 9b7b6d2ba3..8c5df55dfb 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll @@ -36,14 +36,14 @@ define void @mainCS() { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) - ; Matrix + ; Matrix %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; dx.op.linAlgMatrixAccumulate %v1 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixAccumulate.mC4M4N5U2S2.mC4M4N5U2S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) ; dx.op.linAlgMatrixAccumulateToDescriptor - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) ; dx.op.linAlgMatrixLength %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) @@ -119,7 +119,7 @@ declare %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixAccumulate.mC4M4N5U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ds.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ds.ll index 83a4d66ceb..1589d89769 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ds.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ds.ll @@ -42,6 +42,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } +%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.ByteAddressBuffer = type { i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -65,12 +66,14 @@ define void @MainDS() { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) ; dx.op.linAlgMatrixAccumulateToDescriptor - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) ; dx.op.linAlgMatrixLength %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) @@ -154,7 +157,7 @@ declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 @@ -168,6 +171,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; 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.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(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 @@ -228,7 +234,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, !18} +!dx.targetTypes = !{!0, !1, !2, !18, !21} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -258,3 +264,4 @@ attributes #1 = { nounwind readnone } !18 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} !19 = !{!20} !20 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!21 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-gs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-gs.ll index 7002ac3158..35d51bce73 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-gs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-gs.ll @@ -42,6 +42,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } +%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.ByteAddressBuffer = type { i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -65,12 +66,14 @@ define void @MainGS() { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) ; dx.op.linAlgMatrixAccumulateToDescriptor - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) ; dx.op.linAlgMatrixLength %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) @@ -153,7 +156,7 @@ declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 @@ -167,6 +170,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; 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.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(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 @@ -231,7 +237,7 @@ attributes #0 = { nounwind } attributes #1 = { nounwind readonly } attributes #2 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2, !20} +!dx.targetTypes = !{!0, !1, !2, !20, !23} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -263,3 +269,4 @@ attributes #2 = { nounwind readnone } !20 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} !21 = !{!22} !22 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!23 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-hs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-hs.ll index 8145e5cdb0..49348f1770 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-hs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-hs.ll @@ -41,6 +41,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } +%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.ByteAddressBuffer = type { i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -64,12 +65,14 @@ define void @MainHS() { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) ; dx.op.linAlgMatrixAccumulateToDescriptor - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) ; dx.op.linAlgMatrixLength %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) @@ -158,7 +161,7 @@ declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 @@ -172,6 +175,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; 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.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(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 @@ -233,7 +239,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, !24} +!dx.targetTypes = !{!0, !1, !2, !24, !27} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -269,3 +275,4 @@ attributes #1 = { nounwind readnone } !24 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} !25 = !{!26} !26 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!27 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetodescriptor.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetodescriptor.ll new file mode 100644 index 0000000000..e839602d05 --- /dev/null +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetodescriptor.ll @@ -0,0 +1,132 @@ +; 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.LinAlgMatrixC8M4N4U2S0 = type { i8* } +%dx.types.LinAlgMatrixC8M4N4U2S1 = type { i8* } +%dx.types.LinAlgMatrixC8M4N4U0S0 = type { i8* } +%dx.types.ResRet.i32 = type { i32, i32, i32, i32, i32 } +%struct.ByteAddressBuffer = type { i32 } +%struct.RWByteAddressBuffer = type { i32 } + +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) + %2 = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind zeroinitializer, i32 0, i1 false) ; CreateHandleFromBinding(bind,index,nonUniformIndex) + %3 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %4 = call %dx.types.LinAlgMatrixC8M4N4U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S0(i32 -2147483634, %dx.types.Handle %3, i32 0, i32 0, i32 4, i32 128) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + %5 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %6 = call %dx.types.LinAlgMatrixC8M4N4U2S1 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S1(i32 -2147483634, %dx.types.Handle %5, i32 0, i32 0, i32 0, i32 128) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + %7 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %8 = call %dx.types.LinAlgMatrixC8M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U0S0(i32 -2147483634, %dx.types.Handle %7, i32 0, i32 0, i32 0, i32 128) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) + %9 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + %10 = call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %9, i32 0, i32 undef, i8 1, i32 4) ; RawBufferLoad(srv,index,elementOffset,mask,alignment) + %11 = extractvalue %dx.types.ResRet.i32 %10, 0 + + ; CHECK: Function: main: error: Layout of LinAlgMatrixAccumulateToDescriptor must be an immediate constant. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0 + %12 = 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 + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0(i32 -2147483621, %dx.types.LinAlgMatrixC8M4N4U2S0 %4, %dx.types.Handle %12, i32 0, i32 0, i32 %11, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Matrix scope 'Thread' requires layout OuterProductOptimal or OuterProductOptimalTranspose. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0 + %13 = 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 + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0(i32 -2147483621, %dx.types.LinAlgMatrixC8M4N4U2S0 %4, %dx.types.Handle %13, i32 0, i32 0, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Stride of LinAlgMatrixAccumulateToDescriptor must be an immediate constant. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0 + %14 = 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 + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0(i32 -2147483621, %dx.types.LinAlgMatrixC8M4N4U2S0 %4, %dx.types.Handle %14, i32 0, i32 %11, i32 4, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Accumulating matrix requires RWByteAddressBuffer. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0 + %15 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0(i32 -2147483621, %dx.types.LinAlgMatrixC8M4N4U2S0 %4, %dx.types.Handle %15, i32 0, i32 0, i32 4, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Align of LinAlgMatrixAccumulateToDescriptor must be an immediate constant. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0 + %16 = 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 + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0(i32 -2147483621, %dx.types.LinAlgMatrixC8M4N4U2S0 %4, %dx.types.Handle %16, i32 0, i32 0, i32 4, i32 %11) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: parameter 'Align' must be greater than 0, got 0 + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0 + %17 = 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 + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0(i32 -2147483621, %dx.types.LinAlgMatrixC8M4N4U2S0 %4, %dx.types.Handle %17, i32 0, i32 0, i32 4, i32 0) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: parameter 'Align' must be a multiple of 128, got 215 + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0 + %18 = 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 + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0(i32 -2147483621, %dx.types.LinAlgMatrixC8M4N4U2S0 %4, %dx.types.Handle %18, i32 0, i32 0, i32 4, i32 215) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Matrix scope 'Wave' requires layout RowMajor or ColumnMajor. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S1 + %19 = 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 + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S1(i32 -2147483621, %dx.types.LinAlgMatrixC8M4N4U2S1 %6, %dx.types.Handle %19, i32 0, i32 0, i32 3, i32 256) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + + ; CHECK-NEXT: Function: main: error: Matrix Use 'A' does not match expected use Accumulator. + ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U0S0 + %20 = 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 + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U0S0(i32 -2147483621, %dx.types.LinAlgMatrixC8M4N4U0S0 %8, %dx.types.Handle %20, i32 0, i32 0, i32 4, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + + ; CHECK-NEXT: Validation failed. + ret void +} + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC8M4N4U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC8M4N4U2S1 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S1(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare %dx.types.LinAlgMatrixC8M4N4U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U0S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind readonly +declare %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32, %dx.types.Handle, i32, i32, i8, i32) #1 + +; Function Attrs: nounwind +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S0(i32, %dx.types.LinAlgMatrixC8M4N4U2S0, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U2S1(i32, %dx.types.LinAlgMatrixC8M4N4U2S1, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC8M4N4U0S0(i32, %dx.types.LinAlgMatrixC8M4N4U0S0, %dx.types.Handle, i32, i32, i32, i32) #0 + +; Function Attrs: nounwind readnone +declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #2 + +; Function Attrs: nounwind readnone +declare %dx.types.Handle @dx.op.createHandleFromBinding(i32, %dx.types.ResBind, i32, i1) #2 + +attributes #0 = { nounwind } +attributes #1 = { nounwind readonly } +attributes #2 = { nounwind readnone } + +!dx.targetTypes = !{!0, !1, !2} +!llvm.ident = !{!3} +!dx.version = !{!4} +!dx.valver = !{!4} +!dx.shaderModel = !{!5} +!dx.resources = !{!6} +!dx.entryPoints = !{!11} + +!0 = !{%dx.types.LinAlgMatrixC8M4N4U2S0 undef, i32 8, i32 4, i32 4, i32 2, i32 0} +!1 = !{%dx.types.LinAlgMatrixC8M4N4U2S1 undef, i32 8, i32 4, i32 4, i32 2, i32 1} +!2 = !{%dx.types.LinAlgMatrixC8M4N4U0S0 undef, i32 8, i32 4, i32 4, i32 0, i32 0} +!3 = !{!"dxc(private) 1.9.0.5433 (linalg-vali-matrixaccumtodescriptor, 60016e894-dirty)"} +!4 = !{i32 1, i32 10} +!5 = !{!"cs", i32 6, i32 10} +!6 = !{!7, !9, null, null} +!7 = !{!8} +!8 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!9 = !{!10} +!10 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i1 false, i1 false, i1 false, null} +!11 = !{void ()* @main, !"main", null, !6, !12} +!12 = !{i32 0, i64 8598323216, i32 4, !13} +!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 5e8181af18..2b8d3e6bf7 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ms.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ms.ll @@ -40,6 +40,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } +%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.ByteAddressBuffer = type { i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -64,12 +65,14 @@ define void @mainMeS() { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) ; dx.op.linAlgMatrixAccumulateToDescriptor - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) ; dx.op.linAlgMatrixLength %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) @@ -151,7 +154,7 @@ declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 @@ -165,6 +168,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; 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.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(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 @@ -228,7 +234,7 @@ declare void @dx.op.setMeshOutputCounts(i32, i32, i32) #1 attributes #0 = { nounwind } attributes #1 = { nounwind readnone } -!dx.targetTypes = !{!0, !1, !2, !19} +!dx.targetTypes = !{!0, !1, !2, !19, !22} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -259,3 +265,4 @@ attributes #1 = { nounwind readnone } !19 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} !20 = !{!21} !21 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!22 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-node.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-node.ll index 2035c7fe5c..405eff653a 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-node.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-node.ll @@ -41,6 +41,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } +%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.ByteAddressBuffer = type { i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -65,12 +66,14 @@ define void @mainNS() { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) ; dx.op.linAlgMatrixAccumulateToDescriptor - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) ; dx.op.linAlgMatrixLength %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) @@ -146,7 +149,7 @@ declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 @@ -160,6 +163,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; 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.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(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 @@ -215,7 +221,7 @@ attributes #0 = { nounwind } attributes #1 = { nounwind readnone } attributes #2 = { nounwind readonly } -!dx.targetTypes = !{!0, !1, !2, !21} +!dx.targetTypes = !{!0, !1, !2, !21, !24} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -248,3 +254,4 @@ attributes #2 = { nounwind readonly } !21 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} !22 = !{!23} !23 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!24 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ps.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ps.ll index d131353d89..696dce0f97 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ps.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ps.ll @@ -41,6 +41,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } +%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.ByteAddressBuffer = type { i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -64,12 +65,14 @@ define void @mainPS() { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) ; dx.op.linAlgMatrixAccumulateToDescriptor - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) ; dx.op.linAlgMatrixLength %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) @@ -150,7 +153,7 @@ declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 @@ -164,6 +167,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; 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.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(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 @@ -221,7 +227,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, !19} +!dx.targetTypes = !{!0, !1, !2, !19, !22} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -252,3 +258,4 @@ attributes #1 = { nounwind readnone } !19 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} !20 = !{!21} !21 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!22 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-raytracing.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-raytracing.ll index a6962cc721..7016ce8c3c 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-raytracing.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-raytracing.ll @@ -204,6 +204,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } +%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.Attribs = type { <2 x float> } %struct.RayPayload = type { float } @@ -231,9 +232,11 @@ define void @"\01?MainRG@@YAXXZ"() #0 { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) @@ -278,9 +281,11 @@ define void @"\01?MainIS@@YAXXZ"() #0 { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) @@ -325,9 +330,11 @@ define void @"\01?MainCL@@YAXUAttribs@@@Z"(%struct.Attribs* noalias nocapture %a %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) @@ -372,9 +379,11 @@ define void @"\01?MainAH@@YAXURayPayload@@UAttribs@@@Z"(%struct.RayPayload* noal %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) @@ -419,9 +428,11 @@ define void @"\01?MainCH@@YAXURayPayload@@UAttribs@@@Z"(%struct.RayPayload* noal %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) @@ -466,9 +477,11 @@ define void @"\01?MainMS@@YAXURayPayload@@@Z"(%struct.RayPayload* noalias nocapt %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) %v1 = call %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2S2.mC4M5N4U0S2.mC4M4N5U1S2(i32 -2147483624, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.LinAlgMatrixC4M4N5U1S2 %mC4M4N5U1S2) ; LinAlgMatrixAccumulate(matrixLHS,matrixRHS) - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) %v3 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) @@ -507,7 +520,7 @@ declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 @@ -521,6 +534,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; 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.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(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 @@ -576,7 +592,7 @@ attributes #0 = { nounwind } attributes #1 = { nounwind readnone } attributes #2 = { nounwind readonly } -!dx.targetTypes = !{!0, !1, !2, !35} +!dx.targetTypes = !{!0, !1, !2, !35, !38} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -624,3 +640,4 @@ attributes #2 = { nounwind readonly } !35 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} !36 = !{!37} !37 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!38 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} diff --git a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vs.ll b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vs.ll index 17cdb23f20..b21b752d5b 100644 --- a/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vs.ll +++ b/tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vs.ll @@ -42,6 +42,7 @@ target triple = "dxil-ms-dx" %dx.types.LinAlgMatrixC4M5N4U0S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N5U1S2 = type { i8* } %dx.types.LinAlgMatrixC4M4N4U0S0 = type { i8* } +%dx.types.LinAlgMatrixC4M4N5U2S2 = type { i8* } %dx.types.ResourceProperties = type { i32, i32 } %struct.ByteAddressBuffer = type { i32 } %struct.RWByteAddressBuffer = type { i32 } @@ -65,12 +66,14 @@ define void @mainVS() { %mC4M5N4U0S2 = call %dx.types.LinAlgMatrixC4M5N4U0S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M5N4U0S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; Matrix %mC4M4N5U1S2 = call %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U1S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) + ; Matrix + %mC4M4N5U2S2 = call %dx.types.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(i32 -2147483634, %dx.types.Handle %bab, i32 0, i32 0, i32 0, i32 128) ; 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) ; dx.op.linAlgMatrixAccumulateToDescriptor - call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 3, i32 4) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,targetType,offset,stride,layout) + call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32 -2147483621, %dx.types.LinAlgMatrixC4M4N5U2S2 %mC4M4N5U2S2, %dx.types.Handle %rwbab, i32 1, i32 2, i32 0, i32 128) ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align) ; dx.op.linAlgMatrixLength %v2 = call i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32 -2147483632, %dx.types.LinAlgMatrixC4M5N4U0S2 %mC4M5N4U0S2) ; LinAlgMatrixLength(matrix) @@ -151,7 +154,7 @@ declare %dx.types.LinAlgMatrixC4M5N4U2S2 @dx.op.linAlgMatrixAccumulate.mC4M5N4U2 declare void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind -declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2, %dx.types.Handle, i32, i32, i32, i32) #0 +declare void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M4N5U2S2(i32, %dx.types.LinAlgMatrixC4M4N5U2S2, %dx.types.Handle, i32, i32, i32, i32) #0 ; Function Attrs: nounwind declare i32 @dx.op.linAlgMatrixLength.mC4M5N4U0S2(i32, %dx.types.LinAlgMatrixC4M5N4U0S2) #0 @@ -165,6 +168,9 @@ declare %dx.types.LinAlgMatrixC4M4N5U1S2 @dx.op.linAlgMatrixLoadFromDescriptor.m ; 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.LinAlgMatrixC4M4N5U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC4M4N5U2S2(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 @@ -222,7 +228,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, !19} +!dx.targetTypes = !{!0, !1, !2, !19, !22} !llvm.ident = !{!3} !dx.version = !{!4} !dx.valver = !{!4} @@ -253,3 +259,4 @@ attributes #1 = { nounwind readnone } !19 = !{%dx.types.LinAlgMatrixC4M4N4U0S0 undef, i32 4, i32 4, i32 4, i32 0, i32 0} !20 = !{!21} !21 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} +!22 = !{%dx.types.LinAlgMatrixC4M4N5U2S2 undef, i32 4, i32 4, i32 5, i32 2, i32 2} diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 03343f99f0..a27504e963 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -8701,6 +8701,10 @@ def build_valrules(self): "Instr.LinAlgMatrixLoadThreadRequiresBAB", "Loading matrix with Thread scope requires ByteAddressBuffer.", ) + self.add_valrule( + "Instr.LinAlgMatrixLoadThreadRequiresRWBAB", + "Accumulating matrix requires RWByteAddressBuffer.", + ) # Some legacy rules: # - space is only supported for shader targets 5.1 and higher