/** * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! * \file kernel_check.h * \brief */ #ifndef ASCENDC_MODULE_CHECK_H #define ASCENDC_MODULE_CHECK_H #if __CCE_KT_TEST__ #include "tikcpp_check_util.h" namespace AscendC { template bool CheckFuncCopy(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const uint64_t mask, const uint8_t repeatTimes, const CopyRepeatParams& repeatParams, const char* intriName) { check::CopyApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstStride), static_cast(repeatParams.srcStride), static_cast(repeatParams.dstRepeatSize), static_cast(repeatParams.srcRepeatSize), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFuncCopyImpl(chkParams, mask, intriName); } template bool CheckFuncCopy(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const uint64_t mask[2], const uint8_t repeatTimes, const CopyRepeatParams& repeatParams, const char* intriName) { check::CopyApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstStride), static_cast(repeatParams.srcStride), static_cast(repeatParams.dstRepeatSize), static_cast(repeatParams.srcRepeatSize), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFuncCopyImplForMaskArray(chkParams, mask, intriName); } template bool CheckFuncDataCopy(const LocalTensor &dstLocal, const LocalTensor &srcLocal, const DataCopyParams &repeatParams, const char *intriName) { check::DataCopyApiParams chkParams{ static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), repeatParams.blockCount, repeatParams.blockLen, repeatParams.srcStride, repeatParams.dstStride}; return CheckFuncDataCopyImpl(chkParams, intriName); } template bool CheckFuncDataCopy(const LocalTensor &dstLocal, const GlobalTensor &srcGlobal, const DataCopyParams &repeatParams, const char *intriName) { check::DataCopyApiParams chkParams{ static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcGlobal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(Hardware::GM), repeatParams.blockCount, repeatParams.blockLen, repeatParams.srcStride, repeatParams.dstStride}; return CheckFuncDataCopyImpl(chkParams, intriName); } template bool CheckFuncDataCopyPad(const LocalTensor &dstLocal, const GlobalTensor &srcGlobal, const DataCopyParams &dataCopyParams, const DataCopyPadParams &padParams, const char *intriName) { check::DataCopyPadApiParams chkParams{ static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcGlobal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(Hardware::GM), dataCopyParams.blockCount, dataCopyParams.blockLen, dataCopyParams.srcStride, dataCopyParams.dstStride, padParams.isPad, padParams.leftPadding, padParams.rightPadding, padParams.paddingValue}; return CheckFuncDataCopyPadImpl(chkParams, intriName); } template bool CheckFuncDataCopyPad(const LocalTensor &dstLocal, const GlobalTensor &srcGlobal, const DataCopyExtParams &dataCopyParams, const DataCopyPadExtParams &padParams, const char *intriName) { check::DataCopyPadApiParams chkParams{ static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcGlobal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(Hardware::GM), dataCopyParams.blockCount, dataCopyParams.blockLen, dataCopyParams.srcStride, dataCopyParams.dstStride, padParams.isPad, padParams.leftPadding, padParams.rightPadding, GetScalarBitcodeValue(padParams.paddingValue)}; return CheckFuncDataCopyPadImpl(chkParams, intriName); } template bool CheckFuncDataCopy(const GlobalTensor &dstGlobal, const LocalTensor &srcLocal, const DataCopyParams &repeatParams, const char *intriName) { check::DataCopyApiParams chkParams{ static_cast(reinterpret_cast(dstGlobal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(Hardware::GM), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), repeatParams.blockCount, repeatParams.blockLen, repeatParams.srcStride, repeatParams.dstStride}; return CheckFuncDataCopyImpl(chkParams, intriName); } template bool CheckFuncDataCopySlice(const LocalTensor& dstLocal, const GlobalTensor& srcGlobal, const SliceInfo dstSliceInfo[], const SliceInfo srcSliceInfo[], const uint32_t dimValue, const char* intriName) { bool isGM2UB = true; uint32_t srcShapeInfo[K_MAX_SHAPE_DIM]; uint32_t dstShapeInfo[K_MAX_SHAPE_DIM]; bool useShapeValue = !(srcSliceInfo[0].shapeValue == 0); for (int i = 0; i < dimValue; i++) { srcShapeInfo[i] = useShapeValue ? srcSliceInfo[i].shapeValue : srcGlobal.GetShapeInfo().shape[i]; dstShapeInfo[i] = useShapeValue ? dstSliceInfo[i].shapeValue : dstLocal.GetShapeInfo().shape[i]; } check::DataCopySliceApiParams chkParams{ static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcGlobal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), dimValue, dstShapeInfo, srcShapeInfo, dstSliceInfo, srcSliceInfo, isGM2UB }; return CheckFuncDataCopySliceImpl(chkParams, intriName); } template bool CheckFuncDataCopySlice(const GlobalTensor& dstGlobal, const LocalTensor& srcLocal, const SliceInfo dstSliceInfo[], const SliceInfo srcSliceInfo[], const uint32_t dimValue, const char* intriName) { bool isGM2UB = false; uint32_t srcShapeInfo[K_MAX_SHAPE_DIM]; uint32_t dstShapeInfo[K_MAX_SHAPE_DIM]; bool useShapeValue = !(srcSliceInfo[0].shapeValue == 0); for (int i = 0; i < dimValue; i++) { srcShapeInfo[i] = useShapeValue ? srcSliceInfo[i].shapeValue : srcLocal.GetShapeInfo().shape[i]; dstShapeInfo[i] = useShapeValue ? dstSliceInfo[i].shapeValue : dstGlobal.GetShapeInfo().shape[i]; } check::DataCopySliceApiParams chkParams{ static_cast(reinterpret_cast(dstGlobal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), dimValue, dstShapeInfo, srcShapeInfo, dstSliceInfo, srcSliceInfo, isGM2UB }; return CheckFuncDataCopySliceImpl(chkParams, intriName); } template bool CheckFuncVecBinary(const LocalTensor& dstLocal, const LocalTensor& src0Local, const LocalTensor& src1Local, const uint64_t mask[2], const uint8_t repeatTimes, const BinaryRepeatParams& repeatParams, const char* intriName) { check::VecBinaryApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(reinterpret_cast(src1Local.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.src0BlkStride), static_cast(repeatParams.src1BlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.src0RepStride), static_cast(repeatParams.src1RepStride), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(src1Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(GetPhyType(static_cast(src1Local.GetPosition()))) }; return CheckFuncVecBinaryImplForMaskArray(chkParams, mask, intriName); } template bool CheckFuncVecBinary(const LocalTensor& dstLocal, const LocalTensor& src0Local, const LocalTensor& src1Local, const uint64_t mask, const uint8_t repeatTimes, const BinaryRepeatParams& repeatParams, const char* intriName) { check::VecBinaryApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(reinterpret_cast(src1Local.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.src0BlkStride), static_cast(repeatParams.src1BlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.src0RepStride), static_cast(repeatParams.src1RepStride), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(src1Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(GetPhyType(static_cast(src1Local.GetPosition()))) }; return CheckFuncVecBinaryImpl(chkParams, mask, intriName); } template bool CheckFuncVecBinary(const LocalTensor& dstLocal, const LocalTensor& src0Local, const LocalTensor& src1Local, const int32_t& calCount, const char* intriName) { check::VecBinaryApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(reinterpret_cast(src1Local.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(src1Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(GetPhyType(static_cast(src1Local.GetPosition()))), static_cast(calCount) }; return CheckFuncVecBinaryImpl(chkParams, intriName); } template bool CheckFuncVecBinaryCmp(const LocalTensor& dstLocal, const LocalTensor& src0Local, const LocalTensor& src1Local, const uint64_t mask[2], const uint8_t repeatTimes, const BinaryRepeatParams& repeatParams, const char* intriName) { check::VecBinaryApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(reinterpret_cast(src1Local.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.src0BlkStride), static_cast(repeatParams.src1BlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.src0RepStride), static_cast(repeatParams.src1RepStride), static_cast(sizeof(U)), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(U)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(src1Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(GetPhyType(static_cast(src1Local.GetPosition()))) }; return CheckFuncVecBinaryCmpImplForMaskArray(chkParams, mask, intriName); } template bool CheckFuncVecBinaryCmp(const LocalTensor& dstLocal, const LocalTensor& src0Local, const LocalTensor& src1Local, const uint64_t mask, const uint8_t repeatTimes, const BinaryRepeatParams& repeatParams, const char* intriName) { check::VecBinaryApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(reinterpret_cast(src1Local.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.src0BlkStride), static_cast(repeatParams.src1BlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.src0RepStride), static_cast(repeatParams.src1RepStride), static_cast(sizeof(U)), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(U)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(src1Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(GetPhyType(static_cast(src1Local.GetPosition()))) }; return CheckFuncVecBinaryCmpImpl(chkParams, mask, intriName); } template bool CheckFuncVecBinaryCmp(const LocalTensor& dstLocal, const LocalTensor& src0Local, const LocalTensor& src1Local, const int32_t& calCount, const char* intriName) { check::VecBinaryApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(reinterpret_cast(src1Local.GetPhyAddr())), static_cast(sizeof(U)), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(U)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(src1Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(GetPhyType(static_cast(src1Local.GetPosition()))), static_cast(calCount) }; return CheckFuncVecBinaryCmpImpl(chkParams, intriName); } template bool CheckFuncVecBinaryScalarCmp(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const T& scalarValue, const uint64_t mask, const uint8_t repeatTimes, const UnaryRepeatParams& repeatParams, const char* intriName) { (void)(scalarValue); check::VecBinaryScalarApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.srcBlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.srcRepStride), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(U)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFuncVecBinaryScalarCmpImpl(chkParams, mask, intriName); } template bool CheckFuncVecBinaryScalarCmp(const LocalTensor& dstLocal, const LocalTensor& src0Local, T src1Scalar, const int32_t& calCount, const char* intriName) { check::VecBinaryScalarApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(sizeof(U)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(U)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(calCount) }; return CheckFuncVecBinaryScalarCmpImpl(chkParams, intriName); } template bool CheckFunVecBinaryScalar(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const T& scalarValue, const uint64_t mask[2], const uint8_t repeatTimes, const UnaryRepeatParams& repeatParams, const char* intriName) { (void)(scalarValue); check::VecBinaryScalarApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.srcBlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.srcRepStride), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFunVecBinaryScalarImplForMaskArray(chkParams, mask, intriName); } template bool CheckFunVecBinaryScalar(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const T& scalarValue, const uint64_t mask[2], const uint8_t repeatTimes, const BinaryRepeatParams& repeatParams, const char* intriName) { (void)(scalarValue); check::VecBinaryScalarApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.src0BlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.src0RepStride), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFunVecBinaryScalarImplForMaskArray(chkParams, mask, intriName); } template bool CheckFunVecBinaryScalar(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const T& scalarValue, const uint64_t mask, const uint8_t repeatTimes, const UnaryRepeatParams& repeatParams, const char* intriName) { (void)(scalarValue); check::VecBinaryScalarApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.srcBlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.srcRepStride), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFunVecBinaryScalarImpl(chkParams, mask, intriName); } template bool CheckFunVecBinaryScalar(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const T& scalarValue, const uint64_t mask, const uint8_t repeatTimes, const BinaryRepeatParams& repeatParams, const char* intriName) { (void)(scalarValue); check::VecBinaryScalarApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.src0BlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.src0RepStride), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFunVecBinaryScalarImpl(chkParams, mask, intriName); } template bool CheckFunVecBinaryScalar(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const T& scalarValue, const int32_t& calCount, const char* intriName) { (void)(scalarValue); check::VecBinaryScalarApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), static_cast(calCount) }; return CheckFunVecBinaryScalarImpl(chkParams, intriName); } template bool CheckFunVecBinaryScalarDiffType(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const U& scalarValue, const uint64_t mask[2], const uint8_t repeatTimes, const UnaryRepeatParams& repeatParams, const char* intriName) { (void)(scalarValue); check::VecBinaryScalarApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.srcBlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.srcRepStride), static_cast(sizeof(T)), static_cast(sizeof(U)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(U)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFunVecBinaryScalarImplForMaskArray(chkParams, mask, intriName); } template bool CheckFunVecBinaryScalarDiffType(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const U& scalarValue, const uint64_t mask, const uint8_t repeatTimes, const UnaryRepeatParams& repeatParams, const char* intriName) { (void)(scalarValue); check::VecBinaryScalarApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.srcBlkStride), static_cast(repeatParams.dstRepStride), static_cast(repeatParams.srcRepStride), static_cast(sizeof(T)), static_cast(sizeof(U)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(U)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFunVecBinaryScalarImpl(chkParams, mask, intriName); } template bool CheckFunVecBinaryScalarDiffType(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const U& scalarValue, const int32_t& calCount, const char* intriName) { (void)(scalarValue); check::VecBinaryScalarApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(U)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(U)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), static_cast(calCount) }; return CheckFunVecBinaryScalarImpl(chkParams, intriName); } template void CheckMmadBiasDtype() { // v220 mmad bias support: (1) dst_T: fp32, bias: fp32 (2) dst_T: fp32, bias_T:fp16 (3) dst_T: s32, bias_T: s32 bool res = std::is_same::value && std::is_same::value; res = res || (std::is_same::value && std::is_same::value); res = res || (std::is_same::value && std::is_same::value); ASSERT(res && "check mmad bias data type failed"); } template bool CheckMmadParams(const LocalTensor& dstLocal, const LocalTensor& fmLocal, const LocalTensor& filterLocal, const LocalTensor& biasLocal, const MmadParams& mmadParams, const char* intriName) { CheckMmadBiasDtype(); check::MmadApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(fmLocal.GetPhyAddr())), static_cast(reinterpret_cast(filterLocal.GetPhyAddr())), static_cast(reinterpret_cast(biasLocal.GetPhyAddr())), static_cast(sizeof(dst_T)), static_cast(sizeof(src0_T)), static_cast(sizeof(src1_T)), static_cast(sizeof(bias_T)), static_cast(dstLocal.GetSize() * sizeof(dst_T)), static_cast(fmLocal.GetSize() * sizeof(src0_T)), static_cast(filterLocal.GetSize() * sizeof(src1_T)), static_cast(biasLocal.GetSize() * sizeof(bias_T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(fmLocal.GetPosition()))), static_cast(GetPhyType(static_cast(filterLocal.GetPosition()))), static_cast(GetPhyType(static_cast(biasLocal.GetPosition()))), mmadParams.m, mmadParams.n, mmadParams.k, mmadParams.isBias, mmadParams.fmOffset, mmadParams.enSsparse, mmadParams.enWinogradA, mmadParams.enWinogradB }; return CheckFuncMmadImpl(chkParams, intriName); } template bool CheckMmadParams(const LocalTensor& dstLocal, const LocalTensor& fmLocal, const LocalTensor& filterLocal, const MmadParams& mmadParams, const char* intriName) { check::MmadApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(fmLocal.GetPhyAddr())), static_cast(reinterpret_cast(filterLocal.GetPhyAddr())), static_cast(sizeof(dst_T)), static_cast(sizeof(src0_T)), static_cast(sizeof(src1_T)), static_cast(dstLocal.GetSize() * sizeof(dst_T)), static_cast(fmLocal.GetSize() * sizeof(src0_T)), static_cast(filterLocal.GetSize() * sizeof(src1_T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(fmLocal.GetPosition()))), static_cast(GetPhyType(static_cast(filterLocal.GetPosition()))), mmadParams.m, mmadParams.n, mmadParams.k, mmadParams.isBias, mmadParams.fmOffset, mmadParams.enSsparse, mmadParams.enWinogradA, mmadParams.enWinogradB }; return CheckFuncMmadImpl(chkParams, intriName); } template bool CheckFuncBroadCastToMM(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const int32_t blockCount, const uint8_t blockLen, const uint8_t srcGap, const uint8_t dstGap, const char* intriName) { check::VecBroadCastToMMApiParams chkParams { static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(U)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(U)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), static_cast(blockCount), static_cast(blockLen), static_cast(srcGap), static_cast(dstGap) }; return CheckFuncBroadCastToMMImpl(chkParams, intriName); } template bool CheckFunVecReduceOther(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const int32_t repeatTimes, const int32_t maskCount, const int32_t dstRepStride, const int32_t srcBlkStride, const int32_t srcRepStride, const char* intriName) { check::VecReduceApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), repeatTimes, static_cast(dstRepStride), static_cast(srcBlkStride), static_cast(srcRepStride), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFunReduceOtherImpl(chkParams, maskCount, intriName); } template bool CheckFunVecReduceOther(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const int32_t repeatTimes, const uint64_t mask[2], const int32_t dstRepStride, const int32_t srcBlkStride, const int32_t srcRepStride, const char* intriName) { check::VecReduceApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), repeatTimes, static_cast(dstRepStride), static_cast(srcBlkStride), static_cast(srcRepStride), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFunReduceOtherImplForMaskArray(chkParams, mask, intriName); } template bool CheckFunVecReduce(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LocalTensor& workLocal, const int32_t repeatTimes, const int32_t mask, bool calIndex, const int32_t srcRepStride, const char* intriName) { // max or min level0 check::VecReduceApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(reinterpret_cast(workLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(T)), repeatTimes, calIndex, static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(workLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), static_cast(GetPhyType(static_cast(workLocal.GetPosition()))), static_cast(srcRepStride) }; return CheckFunReduceImpl(chkParams, mask, intriName); } template bool CheckFunVecReduce(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LocalTensor& workLocal, const int32_t repeatTimes, const uint64_t mask[2], bool calIndex, const int32_t srcRepStride, const char* intriName) { // max or min level0 check::VecReduceApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(reinterpret_cast(workLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(T)), repeatTimes, calIndex, static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(workLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), static_cast(GetPhyType(static_cast(workLocal.GetPosition()))), static_cast(srcRepStride) }; return CheckFunReduceImplForMaskArray(chkParams, mask, intriName); } template bool CheckFunVecReduce(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LocalTensor& workLocal, const int32_t repeatTimes, const int32_t mask, const int32_t srcRepStride, const char* intriName) { check::VecReduceApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(reinterpret_cast(workLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(T)), repeatTimes, static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(workLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), static_cast(GetPhyType(static_cast(workLocal.GetPosition()))), static_cast(srcRepStride) }; return CheckFunReduceImpl(chkParams, mask, intriName); } template bool CheckFunVecReduce(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LocalTensor& workLocal, const int32_t repeatTimes, const uint64_t mask[2], const int32_t srcRepStride, const char* intriName) { // sum level0 check::VecReduceApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(reinterpret_cast(workLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(T)), repeatTimes, static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(workLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), static_cast(GetPhyType(static_cast(workLocal.GetPosition()))), static_cast(srcRepStride) }; return CheckFunReduceImplForMaskArray(chkParams, mask, intriName); } template bool CheckFunVecReduce(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LocalTensor& workLocal, int32_t repeatTimes, const int32_t count, bool calIndex, const char* intriName) { // max or min level2 check::VecReduceApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(reinterpret_cast(workLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(T)), repeatTimes, static_cast(count), calIndex, static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(workLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), static_cast(GetPhyType(static_cast(workLocal.GetPosition()))) }; return CheckFunReduceImpl(chkParams, intriName); } template bool CheckFunVecReduce(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LocalTensor& workLocal, const int32_t count, int32_t repeatTimes, const char* intriName) { // sum level 2 check::VecReduceApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(reinterpret_cast(workLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(T)), repeatTimes, static_cast(count), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(workLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))), static_cast(GetPhyType(static_cast(workLocal.GetPosition()))) }; return CheckFunReduceImpl(chkParams, intriName); } template bool CheckFunDup(const LocalTensor& dstLocal, const uint64_t mask, const uint8_t repeatTimes, const uint16_t dstBlockStride, const uint8_t dstRepeatStride, const char* intriName) { check::VecDupApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), repeatTimes, static_cast(dstBlockStride), static_cast(dstRepeatStride), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))) }; return CheckFunDupImpl(chkParams, mask, intriName); } template bool CheckFunDup(const LocalTensor& dstLocal, const uint64_t mask[2], const uint8_t repeatTimes, const uint16_t dstBlockStride, const uint8_t dstRepeatStride, const char* intriName) { check::VecDupApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), repeatTimes, static_cast(dstBlockStride), static_cast(dstRepeatStride), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))) }; return CheckFunDupImplForMaskArray(chkParams, mask, intriName); } template bool CheckFunDup(const LocalTensor& dstLocal, const int32_t& calCount, const char* intriName) { check::VecDupApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(calCount) }; return CheckFunDupImpl(chkParams, intriName); } template bool CheckFunBcB(const LocalTensor& dstLocal, const LocalTensor& src0Local, const uint8_t repeatTimes, const BrcbRepeatParams& repeatParams, const char* intriName) { check::VecBroadCastApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.dstRepStride), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))) }; return CheckFunBcBImpl(chkParams, sizeof(T), intriName); } template bool CheckFunGather(const LocalTensor& dstLocal, const LocalTensor& src0Local, const LocalTensor& offsetLocal, const uint8_t repeatTimes, const GatherRepeatParams& repeatParams, const char* intriName) { check::VecGatherApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(reinterpret_cast(offsetLocal.GetPhyAddr())), repeatTimes, static_cast(repeatParams.dstBlkStride), static_cast(repeatParams.dstRepStride), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(U)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(offsetLocal.GetSize() * sizeof(U)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(GetPhyType(static_cast(offsetLocal.GetPosition()))) }; return CheckFunGatherImpl(chkParams, sizeof(T), intriName); } template bool CheckFunTranspose(const LocalTensor& dstLocal, const LocalTensor& src0Local, const char* intriName) { const uint16_t defualtStride = 16; check::VecTransposeApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), 1, defualtStride, defualtStride, static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))) }; return CheckFunTransposeImpl(chkParams, intriName); } template bool CheckFunTransDataTo5HD(const LocalTensor (&dstLocal)[16], const LocalTensor (&src0Local)[16], const TransDataTo5HDParams& nchwconvParams, const char* intriName) { const uint32_t dataNum = 16; for (size_t i = 0; i < dataNum; i++) { check::VecTransposeApiParams chkParams { static_cast( reinterpret_cast(dstLocal[i].GetPhyAddr())), static_cast(reinterpret_cast(src0Local[i].GetPhyAddr())), nchwconvParams.repeatTimes, nchwconvParams.dstRepStride, nchwconvParams.srcRepStride, static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal[i].GetSize() * sizeof(T)), static_cast(src0Local[i].GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal[i].GetPosition()))), static_cast(GetPhyType(static_cast(src0Local[i].GetPosition()))) }; if (!CheckFunTransposeImpl(chkParams, intriName)) { return false; } } return true; } template bool CheckFunProposal(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const int32_t repeatTimes, const char* intriName) { check::VecProposalApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(repeatTimes), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFunProposalImpl(chkParams, intriName); } template bool CheckFunProposal(const LocalTensor& dstLocal, const LocalTensor& src0Local, const LocalTensor& src1Local, const int32_t repeatTimes, const char* intriName) { check::VecProposalApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(reinterpret_cast(src1Local.GetPhyAddr())), static_cast(repeatTimes), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(U)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(src1Local.GetSize() * sizeof(U)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(GetPhyType(static_cast(src1Local.GetPosition()))) }; return CheckFunProposalImpl(chkParams, intriName); } template bool CheckFunProposal(const LocalTensor& dstLocal, const MrgSortSrcList& srcLocal, const MrgSort4Info& params, const char* intriName) { check::VecProposalApiParams chkParams1 { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.src1.GetPhyAddr())), static_cast(params.repeatTimes), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.src1.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.src1.GetPosition()))), params.validBit, params.elementLengths, 0 }; check::VecProposalApiParams chkParams2 { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.src2.GetPhyAddr())), static_cast(params.repeatTimes), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.src2.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.src2.GetPosition()))), params.validBit, params.elementLengths, 1 }; check::VecProposalApiParams chkParams3 { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.src3.GetPhyAddr())), static_cast(params.repeatTimes), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.src3.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.src3.GetPosition()))), params.validBit, params.elementLengths, 2 }; check::VecProposalApiParams chkParams4 { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.src4.GetPhyAddr())), static_cast(params.repeatTimes), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.src4.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.src4.GetPosition()))), params.validBit, params.elementLengths, 3 }; bool res = CheckFunProposalImpl(chkParams1, intriName); res = res && CheckFunProposalImpl(chkParams2, intriName); res = res && CheckFunProposalImpl(chkParams3, intriName); res = res && CheckFunProposalImpl(chkParams4, intriName); return res; } template bool CheckFuncLoadData2d(const LocalTensor& dstLocal, const GlobalTensor& srcLocal, const LoadData2DParams& loadDataParams, const char* intriName) { uint64_t dstLocalLen; if constexpr (IsSameType::value) { dstLocalLen = dstLocal.GetSize() / INT4_TWO; } else { dstLocalLen = dstLocal.GetSize() * sizeof(T); } check::LoadData2dApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(loadDataParams.startIndex), static_cast(loadDataParams.repeatTimes), static_cast(loadDataParams.srcStride), static_cast(loadDataParams.sid), static_cast(loadDataParams.dstGap), static_cast(loadDataParams.ifTranspose), static_cast(loadDataParams.addrMode), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocalLen), static_cast(1024 * 1024), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(0))) }; return CheckFuncLoadData2dImpl(chkParams, intriName); } template bool CheckFuncLoadData2d(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LoadData2DParams& loadDataParams, const char* intriName) { uint64_t dstLocalLen = 0; uint64_t srcLocalLen = 0; if constexpr (IsSameType::value) { dstLocalLen = dstLocal.GetSize() / INT4_TWO; srcLocalLen = srcLocal.GetSize() / INT4_TWO; } else { dstLocalLen = dstLocal.GetSize() * sizeof(T); srcLocalLen = srcLocal.GetSize() * sizeof(T); } check::LoadData2dApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(loadDataParams.startIndex), static_cast(loadDataParams.repeatTimes), static_cast(loadDataParams.srcStride), static_cast(loadDataParams.sid), static_cast(loadDataParams.dstGap), static_cast(loadDataParams.ifTranspose), static_cast(loadDataParams.addrMode), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocalLen), static_cast(srcLocalLen), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return CheckFuncLoadData2dImpl(chkParams, intriName); } template bool CheckFuncLoadData3dv1(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LoadData3DParamsV1& loadDataParams, const char* intriName) { check::LoadData3dv1ApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), loadDataParams.padList, static_cast(loadDataParams.l1H), static_cast(loadDataParams.l1W), static_cast(loadDataParams.c1Index), static_cast(loadDataParams.fetchFilterW), static_cast(loadDataParams.fetchFilterH), static_cast(loadDataParams.leftTopW), static_cast(loadDataParams.leftTopH), static_cast(loadDataParams.strideW), static_cast(loadDataParams.strideH), static_cast(loadDataParams.filterW), static_cast(loadDataParams.filterH), static_cast(loadDataParams.dilationFilterW), static_cast(loadDataParams.dilationFilterH), static_cast(loadDataParams.jumpStride), static_cast(loadDataParams.repeatMode), static_cast(loadDataParams.repeatTime), static_cast(loadDataParams.cSize), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return check::CheckFuncLoadData3dv1Impl(chkParams, intriName); } template bool CheckFuncLoadData3dv2(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LoadData3DParamsV2& loadDataParams, const char* intriName) { check::LoadData3dv2ApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), loadDataParams.padList, static_cast(loadDataParams.l1H), static_cast(loadDataParams.l1W), static_cast(loadDataParams.channelSize), static_cast(loadDataParams.kExtension), static_cast(loadDataParams.mExtension), static_cast(loadDataParams.kStartPt), static_cast(loadDataParams.mStartPt), static_cast(loadDataParams.strideW), static_cast(loadDataParams.strideH), static_cast(loadDataParams.filterW), static_cast(loadDataParams.filterH), static_cast(loadDataParams.dilationFilterW), static_cast(loadDataParams.dilationFilterH), static_cast(loadDataParams.enTranspose), static_cast(loadDataParams.enSmallK), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(srcLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return check::CheckFuncLoadData3dv2Impl(chkParams, intriName); } template bool CheckFuncLoadData3dv2Pro(const LocalTensor& dstLocal, const LocalTensor& srcLocal, const LoadData3DParamsV2Pro& loadDataParams, const char* intriName) { check::LoadData3dv2ProApiParams chkParams{ static_cast( reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(srcLocal.GetPhyAddr())), static_cast(loadDataParams.channelSize), static_cast(loadDataParams.extConfig), static_cast(loadDataParams.extConfig >> LOAD_M_EXTENSION), static_cast(loadDataParams.extConfig >> LOAD_K_START_POSITION), static_cast(loadDataParams.extConfig >> LOAD_M_START_POSITION), static_cast(loadDataParams.filterConfig), static_cast(loadDataParams.filterConfig >> LOAD_STRIDE_H), static_cast(loadDataParams.filterConfig >> LOAD_FILTER_W), static_cast(loadDataParams.filterConfig >> LOAD_FILTER_H), static_cast(loadDataParams.filterConfig >> LOAD_DILATION_FILTER_W), static_cast(loadDataParams.filterConfig >> LOAD_DILATION_FILTER_H), static_cast(loadDataParams.enTranspose), static_cast(loadDataParams.enSmallK), static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetLength()), static_cast(srcLocal.GetLength()), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(srcLocal.GetPosition()))) }; return check::CheckFuncLoadData3dv2ProImpl(chkParams, intriName); } template bool CheckFuncLoadImageToL1(const LocalTensor& dstLocal, const LoadImageToL1Params& loadDataParams, const char* intriName) { check::LoadImageToL1ApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(loadDataParams.horSize), static_cast(loadDataParams.verSize), static_cast(loadDataParams.horStartP), static_cast(loadDataParams.verStartP), static_cast(loadDataParams.sHorRes), static_cast(loadDataParams.topPadSize), static_cast(loadDataParams.botPadSize), static_cast(loadDataParams.lPadSize), static_cast(loadDataParams.rPadSize), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))) }; return CheckFuncLoadImageToL1Impl(chkParams, intriName); } template bool CheckFuncVecGatherMask(const LocalTensor& dstLocal, const LocalTensor& src0Local, const LocalTensor& src1Pattern, const bool reduceMode, uint32_t mask, const GatherMaskParams& reducev2Params, uint64_t& rsvdCnt, const char* intriName) { check::VecGatherMaskApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), static_cast(reinterpret_cast(src1Pattern.GetPhyAddr())), reduceMode, reducev2Params.src0BlockStride, reducev2Params.repeatTimes, reducev2Params.src0RepeatStride, reducev2Params.src1RepeatStride, rsvdCnt, static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(sizeof(U)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(src1Pattern.GetSize() * sizeof(U)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))), static_cast(GetPhyType(static_cast(src1Pattern.GetPosition()))) }; return CheckFuncVecGatherMaskImpl(chkParams, mask, intriName); } template bool CheckFuncVecGatherMask(const LocalTensor& dstLocal, const LocalTensor& src0Local, const uint8_t src1Pattern, const bool reduceMode, uint32_t mask, const GatherMaskParams& reducev2Params, uint64_t& rsvdCnt, const char* intriName) { check::VecGatherMaskApiParams chkParams { static_cast(reinterpret_cast(dstLocal.GetPhyAddr())), static_cast(reinterpret_cast(src0Local.GetPhyAddr())), src1Pattern, reduceMode, reducev2Params.src0BlockStride, reducev2Params.repeatTimes, reducev2Params.src0RepeatStride, reducev2Params.src1RepeatStride, rsvdCnt, static_cast(sizeof(T)), static_cast(sizeof(T)), static_cast(dstLocal.GetSize() * sizeof(T)), static_cast(src0Local.GetSize() * sizeof(T)), static_cast(GetPhyType(static_cast(dstLocal.GetPosition()))), static_cast(GetPhyType(static_cast(src0Local.GetPosition()))) }; return CheckFuncVecGatherMaskImpl(chkParams, mask, intriName); } } // namespace AscendC #endif #endif