@@ -7226,6 +7226,53 @@ Value *TranslateLinAlgCopyConvertMatrix(CallInst *CI, IntrinsicOp IOP,
72267226 return nullptr ;
72277227}
72287228
7229+ Value *TranslateLinAlgMatrixLoadFromMemory (
7230+ CallInst *CI, IntrinsicOp IOP, OP::OpCode OpCode,
7231+ HLOperationLowerHelper &Helper, HLObjectOperationLowerHelper *ObjHelper,
7232+ bool &Translated) {
7233+ hlsl::OP *HlslOp = &Helper.hlslOP ;
7234+ IRBuilder<> Builder (CI);
7235+
7236+ Value *MatrixPtr = CI->getArgOperand (1 );
7237+ DXASSERT_NOMSG (isa<PointerType>(MatrixPtr->getType ()));
7238+ Type *MatrixType = MatrixPtr->getType ()->getPointerElementType ();
7239+
7240+ Value *Arr = CI->getArgOperand (2 );
7241+ Value *Offset = CI->getArgOperand (3 );
7242+ Value *Stride = CI->getArgOperand (4 );
7243+ Value *Layout = CI->getArgOperand (5 );
7244+
7245+ Constant *OpArg = HlslOp->GetU32Const ((unsigned )OpCode);
7246+ Function *DxilFunc = HlslOp->GetOpFunc (OpCode, {MatrixType, Arr->getType ()});
7247+
7248+ Value *Matrix =
7249+ Builder.CreateCall (DxilFunc, {OpArg, Arr, Offset, Stride, Layout});
7250+ Builder.CreateStore (Matrix, MatrixPtr);
7251+
7252+ return nullptr ;
7253+ }
7254+
7255+ Value *TranslateLinAlgMatrixAccumStoreToMemory (
7256+ CallInst *CI, IntrinsicOp IOP, OP::OpCode OpCode,
7257+ HLOperationLowerHelper &Helper, HLObjectOperationLowerHelper *ObjHelper,
7258+ bool &Translated) {
7259+ hlsl::OP *HlslOp = &Helper.hlslOP ;
7260+ IRBuilder<> Builder (CI);
7261+
7262+ Value *Matrix = CI->getArgOperand (1 );
7263+ Value *Arr = CI->getArgOperand (2 );
7264+ Value *Offset = CI->getArgOperand (3 );
7265+ Value *Stride = CI->getArgOperand (4 );
7266+ Value *Layout = CI->getArgOperand (5 );
7267+
7268+ Constant *OpArg = HlslOp->GetU32Const ((unsigned )OpCode);
7269+ Function *DxilFunc =
7270+ HlslOp->GetOpFunc (OpCode, {Matrix->getType (), Arr->getType ()});
7271+
7272+ return Builder.CreateCall (DxilFunc,
7273+ {OpArg, Matrix, Arr, Offset, Stride, Layout});
7274+ }
7275+
72297276} // namespace
72307277
72317278// Lower table.
@@ -7989,14 +8036,16 @@ constexpr IntrinsicLower gLowerTable[] = {
79898036 {IntrinsicOp::IOP___builtin_LinAlg_MatrixLoadFromDescriptor,
79908037 TranslateLinAlgMatrixLoadFromDescriptor,
79918038 DXIL::OpCode::LinAlgMatrixLoadFromDescriptor},
7992- {IntrinsicOp::IOP___builtin_LinAlg_MatrixLoadFromMemory, EmptyLower,
8039+ {IntrinsicOp::IOP___builtin_LinAlg_MatrixLoadFromMemory,
8040+ TranslateLinAlgMatrixLoadFromMemory,
79938041 DXIL::OpCode::LinAlgMatrixLoadFromMemory},
79948042 {IntrinsicOp::IOP___builtin_LinAlg_MatrixSetElement,
79958043 TranslateLinAlgMatrixSetElement, DXIL::OpCode::LinAlgMatrixSetElement},
79968044 {IntrinsicOp::IOP___builtin_LinAlg_MatrixStoreToDescriptor,
79978045 TranslateLinAlgMatrixAccumStoreToDescriptor,
79988046 DXIL::OpCode::LinAlgMatrixStoreToDescriptor},
7999- {IntrinsicOp::IOP___builtin_LinAlg_MatrixStoreToMemory, EmptyLower,
8047+ {IntrinsicOp::IOP___builtin_LinAlg_MatrixStoreToMemory,
8048+ TranslateLinAlgMatrixAccumStoreToMemory,
80008049 DXIL::OpCode::LinAlgMatrixStoreToMemory},
80018050 {IntrinsicOp::IOP___builtin_LinAlg_MatrixAccumulate,
80028051 TranslateLinAlgMatrixAccumulate, DXIL::OpCode::LinAlgMatrixAccumulate},
@@ -8010,7 +8059,8 @@ constexpr IntrinsicLower gLowerTable[] = {
80108059 {IntrinsicOp::IOP___builtin_LinAlg_MatrixAccumulateToDescriptor,
80118060 TranslateLinAlgMatrixAccumStoreToDescriptor,
80128061 DXIL::OpCode::LinAlgMatrixAccumulateToDescriptor},
8013- {IntrinsicOp::IOP___builtin_LinAlg_MatrixAccumulateToMemory, EmptyLower,
8062+ {IntrinsicOp::IOP___builtin_LinAlg_MatrixAccumulateToMemory,
8063+ TranslateLinAlgMatrixAccumStoreToMemory,
80148064 DXIL::OpCode::LinAlgMatrixAccumulateToMemory},
80158065 {IntrinsicOp::IOP___builtin_LinAlg_MatrixOuterProduct,
80168066 TranslateLinAlgMatrixOuterProduct, DXIL::OpCode::LinAlgMatrixOuterProduct},
0 commit comments