已合并
Improve Conv3DV2 nullptr check and pointwise validations #4403
LiuZonggu创建于 4月29日
Improve Conv3DV2 nullptr check and pointwise validations #4403
已合并
共 20 个文件变更+319-225
| @@ -63,7 +63,7 @@ int64_t Conv3dTilingAlgorithm::GetL1Tiling() | |||
| 63 | BiasL1TilingDecision(); | 63 | BiasL1TilingDecision(); |
| 64 | // get kl0 tiling decision | 64 | // get kl0 tiling decision |
| 65 | GetKL0TilingDecision(); | 65 | GetKL0TilingDecision(); |
| 66 | - // get if weight can by pass in L1 | 66 | + // get if weight can bypass in L1 |
| 67 | WeightBypassDecision(); | 67 | WeightBypassDecision(); |
| 68 | SetL1TilingRes(); | 68 | SetL1TilingRes(); |
| 69 | 69 | ||
| @@ -393,12 +393,12 @@ int64_t Conv3dTilingAlgorithm::ProcessAllL1FullLoad() | |||
| 393 | 393 | ||
| 394 | int64_t Conv3dTilingAlgorithm::ProcessFmapL1FullLoad() | 394 | int64_t Conv3dTilingAlgorithm::ProcessFmapL1FullLoad() |
| 395 | { | 395 | { |
| 396 | - // when only fmap full load in L1, nfirset and iter kbl1 then nbl1 | 396 | + // when only fmap full load in L1, nfirst and iter kbl1 then nbl1 |
| 397 | this->l1TilingParams.kAL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * | 397 | this->l1TilingParams.kAL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * |
| 398 | this->l1TilingCalc.ci0HkWk; | 398 | this->l1TilingCalc.ci0HkWk; |
| 399 | this->l1TilingParams.mAL1Value = tilingIns_->cubeInfo.m0 * tilingIns_->shapeCalc.singleM1; | 399 | this->l1TilingParams.mAL1Value = tilingIns_->cubeInfo.m0 * tilingIns_->shapeCalc.singleM1; |
| 400 | this->l1TilingFlag.iterateMNOrder = IterateMNOrder::ITER_N_FST; | 400 | this->l1TilingFlag.iterateMNOrder = IterateMNOrder::ITER_N_FST; |
| 401 | - // speical case, when min weight can not load in L1, bypass | 401 | + // special case, when min weight can not load in L1, bypass |
| 402 | if (CoreL1TilingMinWeightBypass()) { | 402 | if (CoreL1TilingMinWeightBypass()) { |
| 403 | this->l1TilingFlag.isWeightBypass = true; | 403 | this->l1TilingFlag.isWeightBypass = true; |
| 404 | this->l1TilingParams.kBL1 = DISABLE_DOUBLE_BUFFER; | 404 | this->l1TilingParams.kBL1 = DISABLE_DOUBLE_BUFFER; |
| @@ -412,7 +412,7 @@ int64_t Conv3dTilingAlgorithm::ProcessFmapL1FullLoad() | |||
| 412 | 412 | ||
| 413 | int64_t Conv3dTilingAlgorithm::ProcessWeightL1FullLoad() | 413 | int64_t Conv3dTilingAlgorithm::ProcessWeightL1FullLoad() |
| 414 | { | 414 | { |
| 415 | - // when only weight full load in L1, mfirset and iter kal1 then mal1 | 415 | + // when only weight full load in L1, mfirst and iter kal1 then mal1 |
| 416 | this->l1TilingParams.kBL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * | 416 | this->l1TilingParams.kBL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * |
| 417 | this->l1TilingCalc.ci0HkWk; | 417 | this->l1TilingCalc.ci0HkWk; |
| 418 | this->l1TilingParams.nBL1Value = tilingIns_->cubeInfo.n0 * tilingIns_->shapeCalc.singleCo1; | 418 | this->l1TilingParams.nBL1Value = tilingIns_->cubeInfo.n0 * tilingIns_->shapeCalc.singleCo1; |
| @@ -761,9 +761,9 @@ void Conv3dTilingAlgorithm::WeightBypassDecision() | |||
| 761 | if (!this->l1TilingFlag.isWeightBypass) { | 761 | if (!this->l1TilingFlag.isWeightBypass) { |
| 762 | return; | 762 | return; |
| 763 | } | 763 | } |
| 764 | - // when weight can by pass, BL1 db set to default 1 | 764 | + // when weight can bypass, BL1 db set to default 1 |
| 765 | this->doubleBufferValue.pbBL1 = 1; | 765 | this->doubleBufferValue.pbBL1 = 1; |
| 766 | - // update L1 Tiling when weight by pass | 766 | + // update L1 Tiling when weight bypass |
| 767 | // iter kAL1 | 767 | // iter kAL1 |
| 768 | uint64_t tmpKAL1Idx = this->l1TilingIdx.kAL1Idx; | 768 | uint64_t tmpKAL1Idx = this->l1TilingIdx.kAL1Idx; |
| 769 | for (this->l1TilingIdx.kAL1Idx = this->l1TilingRange.kAL1Range.size() - 1; this->l1TilingIdx.kAL1Idx >= tmpKAL1Idx; | 769 | for (this->l1TilingIdx.kAL1Idx = this->l1TilingRange.kAL1Range.size() - 1; this->l1TilingIdx.kAL1Idx >= tmpKAL1Idx; |
| @@ -1004,13 +1004,13 @@ void Conv3dTilingAlgorithm::GetVecTiling() const | |||
| 1004 | 1004 | ||
| 1005 | uint32_t maxLoadSize = QUANT_VEC_MAX_LOAD; | 1005 | uint32_t maxLoadSize = QUANT_VEC_MAX_LOAD; |
| 1006 | uint64_t scaleAndBiasDTypeSize = this->scaleDTypeSize + this->biasDTypeSize; | 1006 | uint64_t scaleAndBiasDTypeSize = this->scaleDTypeSize + this->biasDTypeSize; |
| 1007 | - uint64_t scaleAndbiasLoadLength = INITIAL_SIZE; | 1007 | + uint64_t scaleAndBiasLoadLength = INITIAL_SIZE; |
| 1008 | if (scaleAndBiasDTypeSize * tilingIns_->shapeInfo.singleCo <= maxLoadSize) { | 1008 | if (scaleAndBiasDTypeSize * tilingIns_->shapeInfo.singleCo <= maxLoadSize) { |
| 1009 | tilingIns_->ubTilingInfo.scaleAndBiasLoadType = SINGLECO_LOAD; | 1009 | tilingIns_->ubTilingInfo.scaleAndBiasLoadType = SINGLECO_LOAD; |
| 1010 | - scaleAndbiasLoadLength = tilingIns_->shapeInfo.singleCo; | 1010 | + scaleAndBiasLoadLength = tilingIns_->shapeInfo.singleCo; |
| 1011 | } else if (scaleAndBiasDTypeSize * tilingIns_->l0TilingInfo.nL0 <= maxLoadSize) { | 1011 | } else if (scaleAndBiasDTypeSize * tilingIns_->l0TilingInfo.nL0 <= maxLoadSize) { |
| 1012 | tilingIns_->ubTilingInfo.scaleAndBiasLoadType = NL0_LOAD; | 1012 | tilingIns_->ubTilingInfo.scaleAndBiasLoadType = NL0_LOAD; |
| 1013 | - scaleAndbiasLoadLength = tilingIns_->l0TilingInfo.nL0; | 1013 | + scaleAndBiasLoadLength = tilingIns_->l0TilingInfo.nL0; |
| 1014 | } else { | 1014 | } else { |
| 1015 | tilingIns_->ubTilingInfo.scaleAndBiasLoadType = NUB_LOAD; | 1015 | tilingIns_->ubTilingInfo.scaleAndBiasLoadType = NUB_LOAD; |
| 1016 | } | 1016 | } |
| @@ -1023,12 +1023,12 @@ void Conv3dTilingAlgorithm::GetVecTiling() const | |||
| 1023 | uint64_t usedInSize = this->ubInDTypeSize * mUB * nUB; | 1023 | uint64_t usedInSize = this->ubInDTypeSize * mUB * nUB; |
| 1024 | uint64_t usedOutSize = this->outputDTypeSize * mUB * nUB; | 1024 | uint64_t usedOutSize = this->outputDTypeSize * mUB * nUB; |
| 1025 | if (tilingIns_->ubTilingInfo.scaleAndBiasLoadType == NUB_LOAD) { | 1025 | if (tilingIns_->ubTilingInfo.scaleAndBiasLoadType == NUB_LOAD) { |
| 1026 | - scaleAndbiasLoadLength = nUB; | 1026 | + scaleAndBiasLoadLength = nUB; |
| 1027 | } | 1027 | } |
| 1028 | - uint64_t usedScaleAndBiasSize = scaleAndBiasDTypeSize * scaleAndbiasLoadLength; | 1028 | + uint64_t usedScaleAndBiasSize = scaleAndBiasDTypeSize * scaleAndBiasLoadLength; |
| 1029 | if (tilingIns_->descInfo.biasType.dtype == ConvDtype::BF16 || // bf16 to fp32 | 1029 | if (tilingIns_->descInfo.biasType.dtype == ConvDtype::BF16 || // bf16 to fp32 |
| 1030 | tilingIns_->descInfo.biasType.dtype == ConvDtype::FLOAT16) { // fp16 to fp32 | 1030 | tilingIns_->descInfo.biasType.dtype == ConvDtype::FLOAT16) { // fp16 to fp32 |
| 1031 | - usedScaleAndBiasSize += g_dtypeSizeTab.at(ConvDtype::FLOAT32) * scaleAndbiasLoadLength; | 1031 | + usedScaleAndBiasSize += g_dtypeSizeTab.at(ConvDtype::FLOAT32) * scaleAndBiasLoadLength; |
| 1032 | } | 1032 | } |
| 1033 | uint64_t usedUBSize = usedInSize + usedOutSize + usedScaleAndBiasSize; | 1033 | uint64_t usedUBSize = usedInSize + usedOutSize + usedScaleAndBiasSize; |
| 1034 | 1034 | ||
| @@ -245,14 +245,14 @@ int64_t Conv3dTilingAlgorithmHwMode::ProcessAllL1FullLoad() | |||
| 245 | 245 | ||
| 246 | int64_t Conv3dTilingAlgorithmHwMode::ProcessFmapL1FullLoad() | 246 | int64_t Conv3dTilingAlgorithmHwMode::ProcessFmapL1FullLoad() |
| 247 | { | 247 | { |
| 248 | - // when only fmap full load in L1, nfirset and iter kbl1 then nbl1 | 248 | + // when only fmap full load in L1, nfirst and iter kbl1 then nbl1 |
| 249 | this->l1TilingParams.kAL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * | 249 | this->l1TilingParams.kAL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * |
| 250 | tilingIns_->shapeCalc.singleCi1 * this->l1TilingCalc.ci0HkWk; | 250 | tilingIns_->shapeCalc.singleCi1 * this->l1TilingCalc.ci0HkWk; |
| 251 | this->l1TilingParams.woAL1Value = static_cast<uint64_t>(tilingIns_->shapeInfo.singleWo) / | 251 | this->l1TilingParams.woAL1Value = static_cast<uint64_t>(tilingIns_->shapeInfo.singleWo) / |
| 252 | static_cast<uint64_t>(tilingIns_->cubeInfo.m0) * | 252 | static_cast<uint64_t>(tilingIns_->cubeInfo.m0) * |
| 253 | static_cast<uint64_t>(tilingIns_->cubeInfo.m0); | 253 | static_cast<uint64_t>(tilingIns_->cubeInfo.m0); |
| 254 | this->l1TilingFlag.iterateMNOrder = IterateMNOrder::ITER_N_FST; | 254 | this->l1TilingFlag.iterateMNOrder = IterateMNOrder::ITER_N_FST; |
| 255 | - // speical case, when min weight can not load in L1, bypass | 255 | + // special case, when min weight can not load in L1, bypass |
| 256 | if (CoreL1TilingMinWeightBypass()) { | 256 | if (CoreL1TilingMinWeightBypass()) { |
| 257 | this->l1TilingParams.kBL1 = INITIAL_SIZE; | 257 | this->l1TilingParams.kBL1 = INITIAL_SIZE; |
| 258 | this->l1TilingParams.nBL1Value = INITIAL_SIZE; | 258 | this->l1TilingParams.nBL1Value = INITIAL_SIZE; |
| @@ -70,10 +70,10 @@ int64_t Conv3dTilingAlgorithmPointWise::InitCalcL1Params() | |||
| 70 | static_cast<uint64_t>(tilingIns_->shapeInfo.orgkH * | 70 | static_cast<uint64_t>(tilingIns_->shapeInfo.orgkH * |
| 71 | tilingIns_->shapeInfo.orgkW * tilingIns_->shapeInfo.orgkD); | 71 | tilingIns_->shapeInfo.orgkW * tilingIns_->shapeInfo.orgkD); |
| 72 | // cal fmap weight full load in L1 size | 72 | // cal fmap weight full load in L1 size |
| 73 | - uint64_t fampSizeInL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * | 73 | + uint64_t fmapSizeInL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * |
| 74 | tilingIns_->shapeCalc.singleM1 * static_cast<uint64_t>(tilingIns_->cubeInfo.m0 * tilingIns_->cubeInfo.k0); | 74 | tilingIns_->shapeCalc.singleM1 * static_cast<uint64_t>(tilingIns_->cubeInfo.m0 * tilingIns_->cubeInfo.k0); |
| 75 | - if ((fampSizeInL1 * this->fMapDTypeSize) / this->fMapDTypeSize != fampSizeInL1) { | 75 | + if ((fmapSizeInL1 * this->fMapDTypeSize) / this->fMapDTypeSize != fmapSizeInL1) { |
| 76 | - TILING_ERROR_LOG("fmap size in l1 is overflow uint64, initcalc l1 params failed!"); | 76 | + TILING_ERROR_LOG("fmap size in l1 is overflow uint64, InitCalc l1 params failed!"); |
| 77 | return INVALID_VALUE; | 77 | return INVALID_VALUE; |
| 78 | } | 78 | } |
| 79 | this->l1TilingCalc.fmapFullLoadL1Size = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * | 79 | this->l1TilingCalc.fmapFullLoadL1Size = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * |
| @@ -82,7 +82,7 @@ int64_t Conv3dTilingAlgorithmPointWise::InitCalcL1Params() | |||
| 82 | uint64_t weightSizeInL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * | 82 | uint64_t weightSizeInL1 = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * |
| 83 | this->l1TilingCalc.ci0HkWk * tilingIns_->shapeCalc.singleCo1 * static_cast<uint64_t>(tilingIns_->cubeInfo.n0); | 83 | this->l1TilingCalc.ci0HkWk * tilingIns_->shapeCalc.singleCo1 * static_cast<uint64_t>(tilingIns_->cubeInfo.n0); |
| 84 | if ((weightSizeInL1 * this->weightDTypeSize) / weightDTypeSize != weightSizeInL1) { | 84 | if ((weightSizeInL1 * this->weightDTypeSize) / weightDTypeSize != weightSizeInL1) { |
| 85 | - TILING_ERROR_LOG("weight size in l1 is overflow uint64, initcalc l1 params failed!"); | 85 | + TILING_ERROR_LOG("weight size in l1 is overflow uint64, InitCalc l1 params failed!"); |
| 86 | return INVALID_VALUE; | 86 | return INVALID_VALUE; |
| 87 | } | 87 | } |
| 88 | this->l1TilingCalc.weightFullLoadL1Size = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * | 88 | this->l1TilingCalc.weightFullLoadL1Size = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * |
| @@ -98,7 +98,7 @@ int64_t Conv3dTilingAlgorithmPointWise::InitCalcL1Params() | |||
| 98 | this->l1TilingCalc.fmapKL1FullLoadSize = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * | 98 | this->l1TilingCalc.fmapKL1FullLoadSize = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * |
| 99 | static_cast<uint64_t>(tilingIns_->cubeInfo.k0) * this->l0TilingParams.mL0 * static_cast<uint64_t>(this->doubleBufferValue.pbAL1) * | 99 | static_cast<uint64_t>(tilingIns_->cubeInfo.k0) * this->l0TilingParams.mL0 * static_cast<uint64_t>(this->doubleBufferValue.pbAL1) * |
| 100 | this->fMapDTypeSize; | 100 | this->fMapDTypeSize; |
| 101 | - // cal min/kfullload weiht size in L1 | 101 | + // cal min/kfullload weight size in L1 |
| 102 | this->l1TilingCalc.weightMinLoadL1Size = this->l1TilingCalc.ci0HkWk * this->l0TilingParams.nL0 * | 102 | this->l1TilingCalc.weightMinLoadL1Size = this->l1TilingCalc.ci0HkWk * this->l0TilingParams.nL0 * |
| 103 | this->doubleBufferValue.pbBL1 * this->weightDTypeSize * multiK0; | 103 | this->doubleBufferValue.pbBL1 * this->weightDTypeSize * multiK0; |
| 104 | this->l1TilingCalc.weightKL1FullLoadSize = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * | 104 | this->l1TilingCalc.weightKL1FullLoadSize = static_cast<uint64_t>(tilingIns_->shapeInfo.singlekD) * tilingIns_->shapeCalc.singleCi1 * |
| @@ -191,9 +191,9 @@ void Conv3dTilingBase::SetHF32(bool hf32Enable, bool hf32TransMode = false) | |||
| 191 | bool Conv3dTilingBase::CalOptGroupParams(const Conv3DOriGroupInfo &oriGroupInfo, | 191 | bool Conv3dTilingBase::CalOptGroupParams(const Conv3DOriGroupInfo &oriGroupInfo, |
| 192 | Conv3DGroupOptInfo &groupOptInfo) const | 192 | Conv3DGroupOptInfo &groupOptInfo) const |
| 193 | { | 193 | { |
| 194 | - // user need to pass correct parms. | 194 | + // user need to pass correct params. |
| 195 | if (oriGroupInfo.groups < 1 || oriGroupInfo.cin < 1 || oriGroupInfo.cout < 1) { | 195 | if (oriGroupInfo.groups < 1 || oriGroupInfo.cin < 1 || oriGroupInfo.cout < 1) { |
| 196 | - TILING_DEBUG_LOG("Conv3D AscendC: unSupported parms in groupOpt:" \ | 196 | + TILING_DEBUG_LOG("Conv3D AscendC: Unsupported params in groupOpt:" \ |
| 197 | " groups: %ld, cin: %ld, cout: %ld, only support greater than zero", | 197 | " groups: %ld, cin: %ld, cout: %ld, only support greater than zero", |
| 198 | oriGroupInfo.groups, oriGroupInfo.cin, oriGroupInfo.cout); | 198 | oriGroupInfo.groups, oriGroupInfo.cin, oriGroupInfo.cout); |
| 199 | return false; | 199 | return false; |
| @@ -304,7 +304,7 @@ bool Conv3dTilingBase::CheckInputAttr() const | |||
| 304 | this->attrInfo.padHead < 0 || this->attrInfo.padTail < 0); | 304 | this->attrInfo.padHead < 0 || this->attrInfo.padTail < 0); |
| 305 | if (padInvalidFlag) { | 305 | if (padInvalidFlag) { |
| 306 | TILING_ERROR_LOG( | 306 | TILING_ERROR_LOG( |
| 307 | - "Illlegal attrs have set: padTop=%ld, padBottom=%ld, padLeft=%ld, padRight=%ld, padHead=%ld, padTail=%ld,\ | 307 | + "Illegal attrs have set: padTop=%ld, padBottom=%ld, padLeft=%ld, padRight=%ld, padHead=%ld, padTail=%ld,\ |
| 308 | which must >= 0.", this->attrInfo.padTop, this->attrInfo.padBottom, this->attrInfo.padLeft, | 308 | which must >= 0.", this->attrInfo.padTop, this->attrInfo.padBottom, this->attrInfo.padLeft, |
| 309 | this->attrInfo.padRight, this->attrInfo.padHead, this->attrInfo.padTail); | 309 | this->attrInfo.padRight, this->attrInfo.padHead, this->attrInfo.padTail); |
| 310 | return false; | 310 | return false; |
| @@ -333,7 +333,7 @@ bool Conv3dTilingBase::CheckInputAttrPointWise() const | |||
| 333 | { | 333 | { |
| 334 | if (this->attrInfo.groups != 1) { | 334 | if (this->attrInfo.groups != 1) { |
| 335 | TILING_ERROR_LOG( | 335 | TILING_ERROR_LOG( |
| 336 | - "[PointWise] Illlegal attrs have set: groups=%ld.", | 336 | + "[PointWise] Illegal attrs have set: groups=%ld.", |
| 337 | this->attrInfo.groups); | 337 | this->attrInfo.groups); |
| 338 | return false; | 338 | return false; |
| 339 | } | 339 | } |
| @@ -346,7 +346,7 @@ bool Conv3dTilingBase::CheckInputAttrPointWise() const | |||
| 346 | this->attrInfo.padTail != 0); | 346 | this->attrInfo.padTail != 0); |
| 347 | if (padInvalidFlag) { | 347 | if (padInvalidFlag) { |
| 348 | TILING_ERROR_LOG( | 348 | TILING_ERROR_LOG( |
| 349 | - "[PointWise] Illlegal attrs have set: padTop=%ld, padBottom=%ld, padLeft=%ld, padRight=%ld, padHead=%ld, padTail=%ld,\ | 349 | + "[PointWise] Illegal attrs have set: padTop=%ld, padBottom=%ld, padLeft=%ld, padRight=%ld, padHead=%ld, padTail=%ld,\ |
| 350 | which must = 0.", this->attrInfo.padTop, this->attrInfo.padBottom, this->attrInfo.padLeft, | 350 | which must = 0.", this->attrInfo.padTop, this->attrInfo.padBottom, this->attrInfo.padLeft, |
| 351 | this->attrInfo.padRight, this->attrInfo.padHead, this->attrInfo.padTail); | 351 | this->attrInfo.padRight, this->attrInfo.padHead, this->attrInfo.padTail); |
| 352 | return false; | 352 | return false; |
| @@ -528,13 +528,13 @@ bool Conv3dTilingBase::CheckInputShapePointWise() const | |||
| 528 | bool Conv3dTilingBase::CheckInputFormat() const | 528 | bool Conv3dTilingBase::CheckInputFormat() const |
| 529 | { | 529 | { |
| 530 | if (this->descInfo.weightType.format != ConvFormat::FRACTAL_Z_3D) { | 530 | if (this->descInfo.weightType.format != ConvFormat::FRACTAL_Z_3D) { |
| 531 | - TILING_ERROR_LOG("unSupported weight format: %s.", | 531 | + TILING_ERROR_LOG("Unsupported weight format: %s.", |
| 532 | g_formatToStr.at(this->descInfo.weightType.format).c_str()); | 532 | g_formatToStr.at(this->descInfo.weightType.format).c_str()); |
| 533 | return false; | 533 | return false; |
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | if (this->descInfo.fMapType.format != ConvFormat::NDC1HWC0) { | 536 | if (this->descInfo.fMapType.format != ConvFormat::NDC1HWC0) { |
| 537 | - TILING_ERROR_LOG("unSupported feature map format: %s.", | 537 | + TILING_ERROR_LOG("Unsupported feature map format: %s.", |
| 538 | g_formatToStr.at(this->descInfo.fMapType.format).c_str()); | 538 | g_formatToStr.at(this->descInfo.fMapType.format).c_str()); |
| 539 | return false; | 539 | return false; |
| 540 | } | 540 | } |
| @@ -571,7 +571,7 @@ bool Conv3dTilingBase::CheckParamsDtypeHasQuantScale() const | |||
| 571 | return true; | 571 | return true; |
| 572 | } | 572 | } |
| 573 | } | 573 | } |
| 574 | - TILING_ERROR_LOG("unSupported params data type [fmap, weight, bias, scale, output]: [%s, %s, %s, %s, %s].", | 574 | + TILING_ERROR_LOG("Unsupported params data type [fmap, weight, bias, scale, output]: [%s, %s, %s, %s, %s].", |
| 575 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), | 575 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), |
| 576 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), | 576 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), |
| 577 | g_dtypeToStr.at(this->descInfo.biasType.dtype).c_str(), | 577 | g_dtypeToStr.at(this->descInfo.biasType.dtype).c_str(), |
| @@ -592,7 +592,7 @@ bool Conv3dTilingBase::CheckParamsDtypeHasBias() const | |||
| 592 | return true; | 592 | return true; |
| 593 | } | 593 | } |
| 594 | } | 594 | } |
| 595 | - TILING_ERROR_LOG("unSupported params data type [fmap, weight, bias, output]: [%s, %s, %s, %s].", | 595 | + TILING_ERROR_LOG("Unsupported params data type [fmap, weight, bias, output]: [%s, %s, %s, %s].", |
| 596 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), | 596 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), |
| 597 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), | 597 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), |
| 598 | g_dtypeToStr.at(this->descInfo.biasType.dtype).c_str(), | 598 | g_dtypeToStr.at(this->descInfo.biasType.dtype).c_str(), |
| @@ -611,7 +611,7 @@ bool Conv3dTilingBase::CheckParamsDtypeEssential() const | |||
| 611 | return true; | 611 | return true; |
| 612 | } | 612 | } |
| 613 | } | 613 | } |
| 614 | - TILING_ERROR_LOG("unSupported params data type [fmap, weight, output]: [%s, %s, %s].", | 614 | + TILING_ERROR_LOG("Unsupported params data type [fmap, weight, output]: [%s, %s, %s].", |
| 615 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), | 615 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), |
| 616 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), | 616 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), |
| 617 | g_dtypeToStr.at(this->descInfo.outputType.dtype).c_str()); | 617 | g_dtypeToStr.at(this->descInfo.outputType.dtype).c_str()); |
| @@ -641,7 +641,7 @@ bool Conv3dTilingBase::CheckParamsDtypePointWise() const | |||
| 641 | return true; | 641 | return true; |
| 642 | } | 642 | } |
| 643 | } | 643 | } |
| 644 | - TILING_ERROR_LOG("[PointWise] unSupported params data type [fmap, weight, bias, output]: [%s, %s, %s, %s].", | 644 | + TILING_ERROR_LOG("[PointWise] Unsupported params data type [fmap, weight, bias, output]: [%s, %s, %s, %s].", |
| 645 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), | 645 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), |
| 646 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), | 646 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), |
| 647 | g_dtypeToStr.at(this->descInfo.biasType.dtype).c_str(), | 647 | g_dtypeToStr.at(this->descInfo.biasType.dtype).c_str(), |
| @@ -657,7 +657,7 @@ bool Conv3dTilingBase::CheckParamsDtypePointWise() const | |||
| 657 | return true; | 657 | return true; |
| 658 | } | 658 | } |
| 659 | } | 659 | } |
| 660 | - TILING_ERROR_LOG("[PointWise] unSupported params data type [fmap, weight, output]: [%s, %s, %s].", | 660 | + TILING_ERROR_LOG("[PointWise] Unsupported params data type [fmap, weight, output]: [%s, %s, %s].", |
| 661 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), | 661 | g_dtypeToStr.at(this->descInfo.fMapType.dtype).c_str(), |
| 662 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), | 662 | g_dtypeToStr.at(this->descInfo.weightType.dtype).c_str(), |
| 663 | g_dtypeToStr.at(this->descInfo.outputType.dtype).c_str()); | 663 | g_dtypeToStr.at(this->descInfo.outputType.dtype).c_str()); |
| @@ -56,31 +56,29 @@ ge::graphStatus Conv3dBaseTiling::GetPlatformInfo() | |||
| 56 | return ge::GRAPH_SUCCESS; | 56 | return ge::GRAPH_SUCCESS; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | -void Conv3dBaseTiling::GetAttrsInfo() | 59 | +bool Conv3dBaseTiling::SyncAttrInfoFromEngine() |
| 60 | { | 60 | { |
| 61 | - auto stridePtr = context_->GetAttrs()->GetListInt(ATTR_STRIDE_INDEX); | 61 | + if (engine_ == nullptr) { |
| 62 | - attrInfo_.strideH = static_cast<uint32_t>(stridePtr->GetData()[originalFormat_.FORMAT_DATA_H_INDEX]); | 62 | + OP_LOGE(context_->GetNodeName(), "Conv3D AscendC: engine is null when syncing attr info."); |
| 63 | - attrInfo_.strideW = static_cast<uint32_t>(stridePtr->GetData()[originalFormat_.FORMAT_DATA_W_INDEX]); | 63 | + return false; |
| 64 | - attrInfo_.strideD = static_cast<uint32_t>(stridePtr->GetData()[originalFormat_.FORMAT_DATA_D_INDEX]); | ||
| 65 | - | ||
| 66 | - auto padPtr = context_->GetAttrs()->GetListInt(ATTR_PAD_INDEX); | ||
| 67 | - attrInfo_.padh = static_cast<uint32_t>(padPtr->GetData()[PAD_HEAD_INDEX]); | ||
| 68 | - attrInfo_.padt = static_cast<uint32_t>(padPtr->GetData()[PAD_TAIL_INDEX]); | ||
| 69 | - attrInfo_.padu = static_cast<uint32_t>(padPtr->GetData()[PAD_UP_INDEX]); | ||
| 70 | - attrInfo_.padd = static_cast<uint32_t>(padPtr->GetData()[PAD_DOWN_INDEX]); | ||
| 71 | - attrInfo_.padl = static_cast<uint32_t>(padPtr->GetData()[PAD_LEFT_INDEX]); | ||
| 72 | - attrInfo_.padr = static_cast<uint32_t>(padPtr->GetData()[PAD_RIGHT_INDEX]); | ||
| 73 | - | ||
| 74 | - auto dilationPtr = context_->GetAttrs()->GetListInt(ATTR_DILATION_INDEX); | ||
| 75 | - if (dilationPtr != nullptr) { | ||
| 76 | - attrInfo_.dilationH = static_cast<uint32_t>(dilationPtr->GetData()[originalFormat_.FORMAT_DATA_H_INDEX]); | ||
| 77 | - attrInfo_.dilationW = static_cast<uint32_t>(dilationPtr->GetData()[originalFormat_.FORMAT_DATA_W_INDEX]); | ||
| 78 | - attrInfo_.dilationD = static_cast<uint32_t>(dilationPtr->GetData()[originalFormat_.FORMAT_DATA_D_INDEX]); | ||
| 79 | - } | ||
| 80 | - auto groupPtr = context_->GetAttrs()->GetInt(ATTR_GROUP_INDEX); | ||
| 81 | - if (groupPtr != nullptr) { | ||
| 82 | - attrInfo_.groups = static_cast<uint32_t>(*groupPtr); | ||
| 83 | } | 64 | } |
| 65 | + | ||
| 66 | + attrInfo_.strideH = static_cast<uint32_t>(engine_->attrInfo_.strideH); | ||
| 67 | + attrInfo_.strideW = static_cast<uint32_t>(engine_->attrInfo_.strideW); | ||
| 68 | + attrInfo_.strideD = static_cast<uint32_t>(engine_->attrInfo_.strideD); | ||
| 69 | + | ||
| 70 | + attrInfo_.padh = static_cast<uint32_t>(engine_->attrInfo_.padHead); | ||
| 71 | + attrInfo_.padt = static_cast<uint32_t>(engine_->attrInfo_.padTail); | ||
| 72 | + attrInfo_.padu = static_cast<uint32_t>(engine_->attrInfo_.padTop); | ||
| 73 | + attrInfo_.padd = static_cast<uint32_t>(engine_->attrInfo_.padBottom); | ||
| 74 | + attrInfo_.padl = static_cast<uint32_t>(engine_->attrInfo_.padLeft); | ||
| 75 | + attrInfo_.padr = static_cast<uint32_t>(engine_->attrInfo_.padRight); | ||
| 76 | + | ||
| 77 | + attrInfo_.dilationH = static_cast<uint32_t>(engine_->attrInfo_.dilationH); | ||
| 78 | + attrInfo_.dilationW = static_cast<uint32_t>(engine_->attrInfo_.dilationW); | ||
| 79 | + attrInfo_.dilationD = static_cast<uint32_t>(engine_->attrInfo_.dilationD); | ||
| 80 | + attrInfo_.groups = static_cast<uint32_t>(engine_->attrInfo_.groups); | ||
| 81 | + return true; | ||
| 84 | } | 82 | } |
| 85 | 83 | ||
| 86 | void Conv3dBaseTiling::GetConv3DParasHf32Mode(const uint32_t enableHf32Idx, uint32_t& hf32Mode) | 84 | void Conv3dBaseTiling::GetConv3DParasHf32Mode(const uint32_t enableHf32Idx, uint32_t& hf32Mode) |
| @@ -447,14 +445,6 @@ ge::graphStatus Conv3dBaseTiling::DoOpTiling() | |||
| 447 | return ge::GRAPH_SUCCESS; | 445 | return ge::GRAPH_SUCCESS; |
| 448 | } | 446 | } |
| 449 | 447 | ||
| 450 | -void Conv3dBaseTiling::InitPointWiseFlag() { | ||
| 451 | - auto fMapDesc = context_->GetInputDesc(INPUT_FMAP_INDEX); | ||
| 452 | - ge::Format storageFmapFormat = static_cast<ge::Format>(GetPrimaryFormat(fMapDesc->GetStorageFormat())); | ||
| 453 | - if (storageFmapFormat == ge::Format::FORMAT_NCDHW) { | ||
| 454 | - isPointWise = true; | ||
| 455 | - } | ||
| 456 | -} | ||
| 457 | - | ||
| 458 | bool Conv3dBaseTiling::ExtractAndPassParamsToEngine() | 448 | bool Conv3dBaseTiling::ExtractAndPassParamsToEngine() |
| 459 | { | 449 | { |
| 460 | // Set shapes | 450 | // Set shapes |
| @@ -512,7 +502,6 @@ ge::graphStatus Conv3dBaseTiling::GetShapeAttrsInfo() | |||
| 512 | 502 | ||
| 513 | // Step 2: Parse original format (NCDHW vs NDHWC index mapping) | 503 | // Step 2: Parse original format (NCDHW vs NDHWC index mapping) |
| 514 | InitConv3dOriginFormat(); | 504 | InitConv3dOriginFormat(); |
| 515 | - InitPointWiseFlag(); | ||
| 516 | 505 | ||
| 517 | // Step 3: Extract parameters from GE context and pass to Engine | 506 | // Step 3: Extract parameters from GE context and pass to Engine |
| 518 | if (!ExtractAndPassParamsToEngine()) { | 507 | if (!ExtractAndPassParamsToEngine()) { |
| @@ -520,14 +509,13 @@ ge::graphStatus Conv3dBaseTiling::GetShapeAttrsInfo() | |||
| 520 | } | 509 | } |
| 521 | 510 | ||
| 522 | // Step 4: Sync Base copies for legacy paths (AOE repo, PrintTilingInfo, GetTilingInputArgs) | 511 | // Step 4: Sync Base copies for legacy paths (AOE repo, PrintTilingInfo, GetTilingInputArgs) |
| 523 | - GetAttrsInfo(); | 512 | + if (!SyncAttrInfoFromEngine()) { |
| 513 | + return ge::GRAPH_FAILED; | ||
| 514 | + } | ||
| 524 | GetShapeInfo(); | 515 | GetShapeInfo(); |
| 525 | GetDescInfo(); | 516 | GetDescInfo(); |
| 526 | 517 | ||
| 527 | - // Step 5: Sync isPointWise flag to Engine | 518 | + // Step 5: Run Engine parameter validation (includes format, shape, dtype checks via CheckInputFormat()) |
| 528 | - engine_->isPointWise = isPointWise; | ||
| 529 | - | ||
| 530 | - // Step 6: Run Engine parameter validation (includes format, shape, dtype checks via CheckInputFormat()) | ||
| 531 | if (!engine_->CheckAllParams()) { | 519 | if (!engine_->CheckAllParams()) { |
| 532 | OP_LOGE(context_->GetNodeName(), "Conv3D AscendC: Engine parameter check failed in GetShapeAttrsInfo."); | 520 | OP_LOGE(context_->GetNodeName(), "Conv3D AscendC: Engine parameter check failed in GetShapeAttrsInfo."); |
| 533 | return ge::GRAPH_FAILED; | 521 | return ge::GRAPH_FAILED; |
| @@ -607,7 +595,7 @@ bool Conv3dBaseTiling::GetTilingInputArgs(std::shared_ptr<void> &inputArgs, size | |||
| 607 | 595 | ||
| 608 | bool Conv3dBaseTiling::TranslateAoeTiling(tuningtiling::TuningTilingDefPtr &tuningTiling) | 596 | bool Conv3dBaseTiling::TranslateAoeTiling(tuningtiling::TuningTilingDefPtr &tuningTiling) |
| 609 | { | 597 | { |
| 610 | - auto aoeTiling = std::static_pointer_cast<tuningtiling::Conv3DTunnerTiling>(tuningTiling); | 598 | + auto aoeTiling = std::static_pointer_cast<tuningtiling::Conv3DTunerTiling>(tuningTiling); |
| 611 | if (aoeTiling == nullptr) { | 599 | if (aoeTiling == nullptr) { |
| 612 | return false; | 600 | return false; |
| 613 | } | 601 | } |
| @@ -618,7 +606,7 @@ bool Conv3dBaseTiling::TranslateAoeTiling(tuningtiling::TuningTilingDefPtr &tuni | |||
| 618 | return true; | 606 | return true; |
| 619 | } | 607 | } |
| 620 | 608 | ||
| 621 | -void Conv3dBaseTiling::TranslateApiTiling(std::shared_ptr<tuningtiling::Conv3DTunnerTiling> aoeTiling) | 609 | +void Conv3dBaseTiling::TranslateApiTiling(std::shared_ptr<tuningtiling::Conv3DTunerTiling> aoeTiling) |
| 622 | { | 610 | { |
| 623 | tilingData_.convApiTiling.groups = aoeTiling->groups; | 611 | tilingData_.convApiTiling.groups = aoeTiling->groups; |
| 624 | tilingData_.convApiTiling.orgCi = aoeTiling->orgCi; | 612 | tilingData_.convApiTiling.orgCi = aoeTiling->orgCi; |
| @@ -664,7 +652,7 @@ void Conv3dBaseTiling::TranslateApiTiling(std::shared_ptr<tuningtiling::Conv3DTu | |||
| 664 | tilingData_.convApiTiling.offsetx = aoeTiling->offsetx; | 652 | tilingData_.convApiTiling.offsetx = aoeTiling->offsetx; |
| 665 | } | 653 | } |
| 666 | 654 | ||
| 667 | -void Conv3dBaseTiling::TranslateRunInfo(std::shared_ptr<tuningtiling::Conv3DTunnerTiling> aoeTiling) | 655 | +void Conv3dBaseTiling::TranslateRunInfo(std::shared_ptr<tuningtiling::Conv3DTunerTiling> aoeTiling) |
| 668 | { | 656 | { |
| 669 | tilingData_.convRunInfo.batch = shapeInfo_.batch; | 657 | tilingData_.convRunInfo.batch = shapeInfo_.batch; |
| 670 | tilingData_.convRunInfo.cin = aoeTiling->orgCi; | 658 | tilingData_.convRunInfo.cin = aoeTiling->orgCi; |
| @@ -61,7 +61,7 @@ struct Conv3DAttrInfo { | |||
| 61 | uint32_t hf32Mode = 0; | 61 | uint32_t hf32Mode = 0; |
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | -struct Conv3DOrignalFormat { | 64 | +struct Conv3DOriginalFormat { |
| 65 | // for fmap | 65 | // for fmap |
| 66 | uint32_t FORMAT_FMAP_N_INDEX = Conv3dApiTiling::INITIAL_INDEX; | 66 | uint32_t FORMAT_FMAP_N_INDEX = Conv3dApiTiling::INITIAL_INDEX; |
| 67 | uint32_t FORMAT_FMAP_C_INDEX = Conv3dApiTiling::INITIAL_INDEX; | 67 | uint32_t FORMAT_FMAP_C_INDEX = Conv3dApiTiling::INITIAL_INDEX; |
| @@ -156,8 +156,8 @@ protected: | |||
| 156 | 156 | ||
| 157 | bool GetTilingFromRepo(); | 157 | bool GetTilingFromRepo(); |
| 158 | bool TranslateAoeTiling(tuningtiling::TuningTilingDefPtr &tuningTiling); | 158 | bool TranslateAoeTiling(tuningtiling::TuningTilingDefPtr &tuningTiling); |
| 159 | - void TranslateApiTiling(std::shared_ptr<tuningtiling::Conv3DTunnerTiling> aoeTiling); | 159 | + void TranslateApiTiling(std::shared_ptr<tuningtiling::Conv3DTunerTiling> aoeTiling); |
| 160 | - void TranslateRunInfo(std::shared_ptr<tuningtiling::Conv3DTunnerTiling> aoeTiling); | 160 | + void TranslateRunInfo(std::shared_ptr<tuningtiling::Conv3DTunerTiling> aoeTiling); |
| 161 | bool GetTilingInputArgs(std::shared_ptr<void> &inputArgs, size_t &size); | 161 | bool GetTilingInputArgs(std::shared_ptr<void> &inputArgs, size_t &size); |
| 162 | void SetAdditionalTilingInfo(); | 162 | void SetAdditionalTilingInfo(); |
| 163 | 163 | ||
| @@ -170,21 +170,19 @@ private: | |||
| 170 | Ops::NN::Conv3dV2::Conv3DV2TilingData tilingData_; | 170 | Ops::NN::Conv3dV2::Conv3DV2TilingData tilingData_; |
| 171 | Conv3DDescInfo descInfo_; | 171 | Conv3DDescInfo descInfo_; |
| 172 | Conv3DTilingFlag flagInfo_; | 172 | Conv3DTilingFlag flagInfo_; |
| 173 | - Conv3DOrignalFormat originalFormat_; | 173 | + Conv3DOriginalFormat originalFormat_; |
| 174 | 174 | ||
| 175 | // numblocks decision | 175 | // numblocks decision |
| 176 | NumBlocksRes numBlocksRes; | 176 | NumBlocksRes numBlocksRes; |
| 177 | 177 | ||
| 178 | bool useTilingRepo_ = false; | 178 | bool useTilingRepo_ = false; |
| 179 | - bool isPointWise = false; | ||
| 180 | int8_t outputOrder_ = 0; | 179 | int8_t outputOrder_ = 0; |
| 181 | 180 | ||
| 182 | private: | 181 | private: |
| 183 | ge::graphStatus SetTilingKey(); | 182 | ge::graphStatus SetTilingKey(); |
| 184 | void InitConv3dOriginFormat(); | 183 | void InitConv3dOriginFormat(); |
| 185 | - void InitPointWiseFlag(); | ||
| 186 | void GetShapeInfo(); | 184 | void GetShapeInfo(); |
| 187 | - void GetAttrsInfo(); | 185 | + bool SyncAttrInfoFromEngine(); |
| 188 | void GetDescInfo(); | 186 | void GetDescInfo(); |
| 189 | void PrintTilingInfo(); | 187 | void PrintTilingInfo(); |
| 190 | void GetConv3DParasHf32Mode(const uint32_t enableHf32Idx, uint32_t& hf32Mode); | 188 | void GetConv3DParasHf32Mode(const uint32_t enableHf32Idx, uint32_t& hf32Mode); |
| @@ -39,6 +39,9 @@ Conv3dTilingEngine::Conv3dTilingEngine(const std::string &logTag) | |||
| 39 | numBlocksRes_.minCost = MAX_64_BIT_NUM; | 39 | numBlocksRes_.minCost = MAX_64_BIT_NUM; |
| 40 | 40 | ||
| 41 | isPointWise = false; | 41 | isPointWise = false; |
| 42 | + kernelPointWise_ = false; | ||
| 43 | + outputBatch_ = -1; | ||
| 44 | + outputCOut_ = -1; | ||
| 42 | outputOrder_ = static_cast<uint8_t>(Conv3dApiTiling::M_Mode); | 45 | outputOrder_ = static_cast<uint8_t>(Conv3dApiTiling::M_Mode); |
| 43 | 46 | ||
| 44 | OP_LOGD(logTag_.c_str(), "Conv3dTilingEngine constructed, call Init() to initialize platform info"); | 47 | OP_LOGD(logTag_.c_str(), "Conv3dTilingEngine constructed, call Init() to initialize platform info"); |
| @@ -71,6 +74,19 @@ uint8_t Conv3dTilingEngine::GetOutputOrder() const | |||
| 71 | return outputOrder_; | 74 | return outputOrder_; |
| 72 | } | 75 | } |
| 73 | 76 | ||
| 77 | +bool Conv3dTilingEngine::UsesPointWisePath() const | ||
| 78 | +{ | ||
| 79 | + return kernelPointWise_ && | ||
| 80 | + descInfo_.fMapFormat == Conv3dApiTiling::ConvFormat::NCDHW && | ||
| 81 | + descInfo_.weightFormat == Conv3dApiTiling::ConvFormat::NCDHW && | ||
| 82 | + descInfo_.outFormat == Conv3dApiTiling::ConvFormat::NCDHW; | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +void Conv3dTilingEngine::UpdatePointWiseMode() | ||
| 86 | +{ | ||
| 87 | + isPointWise = UsesPointWisePath(); | ||
| 88 | +} | ||
| 89 | + | ||
| 74 | bool Conv3dTilingEngine::InitPlatformInfoFromAscendC() | 90 | bool Conv3dTilingEngine::InitPlatformInfoFromAscendC() |
| 75 | { | 91 | { |
| 76 | OP_LOGD(logTag_.c_str(), "Initializing Conv3dTilingEngine with PlatformAscendCManager"); | 92 | OP_LOGD(logTag_.c_str(), "Initializing Conv3dTilingEngine with PlatformAscendCManager"); |
| @@ -145,8 +161,9 @@ void Conv3dTilingEngine::SetOrgWeightShape(const std::vector<int64_t> &orgWeight | |||
| 145 | shapeInfo_.kh = static_cast<uint32_t>(orgWeightShapeList[FORMAT_NCDHW_H_INDEX]); | 161 | shapeInfo_.kh = static_cast<uint32_t>(orgWeightShapeList[FORMAT_NCDHW_H_INDEX]); |
| 146 | shapeInfo_.kw = static_cast<uint32_t>(orgWeightShapeList[FORMAT_NCDHW_W_INDEX]); | 162 | shapeInfo_.kw = static_cast<uint32_t>(orgWeightShapeList[FORMAT_NCDHW_W_INDEX]); |
| 147 | 163 | ||
| 148 | - // Update pointwise flag - pointwise convolution has 1x1x1 kernel | 164 | + // Pointwise path is only valid when both kernel shape and tensor formats match the pointwise contract. |
| 149 | - isPointWise = (shapeInfo_.kd == 1 && shapeInfo_.kh == 1 && shapeInfo_.kw == 1); | 165 | + kernelPointWise_ = (shapeInfo_.kd == 1 && shapeInfo_.kh == 1 && shapeInfo_.kw == 1); |
| 166 | + UpdatePointWiseMode(); | ||
| 150 | } | 167 | } |
| 151 | 168 | ||
| 152 | void Conv3dTilingEngine::SetOrgFmapShape(const std::vector<int64_t> &orgFmapShapeList) | 169 | void Conv3dTilingEngine::SetOrgFmapShape(const std::vector<int64_t> &orgFmapShapeList) |
| @@ -174,6 +191,8 @@ void Conv3dTilingEngine::SetOrgOutputShape(const std::vector<int64_t> &orgOutput | |||
| 174 | return; | 191 | return; |
| 175 | } | 192 | } |
| 176 | 193 | ||
| 194 | + outputBatch_ = orgOutputShapeList[FORMAT_NCDHW_N_INDEX]; | ||
| 195 | + outputCOut_ = orgOutputShapeList[FORMAT_NCDHW_C_INDEX]; | ||
| 177 | shapeInfo_.dOut = static_cast<uint32_t>(orgOutputShapeList[FORMAT_NCDHW_D_INDEX]); | 196 | shapeInfo_.dOut = static_cast<uint32_t>(orgOutputShapeList[FORMAT_NCDHW_D_INDEX]); |
| 178 | shapeInfo_.ho = static_cast<uint64_t>(orgOutputShapeList[FORMAT_NCDHW_H_INDEX]); | 197 | shapeInfo_.ho = static_cast<uint64_t>(orgOutputShapeList[FORMAT_NCDHW_H_INDEX]); |
| 179 | shapeInfo_.wo = static_cast<uint64_t>(orgOutputShapeList[FORMAT_NCDHW_W_INDEX]); | 198 | shapeInfo_.wo = static_cast<uint64_t>(orgOutputShapeList[FORMAT_NCDHW_W_INDEX]); |
| @@ -257,6 +276,8 @@ void Conv3dTilingEngine::SetFormat(Conv3dApiTiling::ConvFormat fmapFormat, | |||
| 257 | Conv3dApiTiling::g_formatToStr.at(fmapFormat).c_str(), | 276 | Conv3dApiTiling::g_formatToStr.at(fmapFormat).c_str(), |
| 258 | Conv3dApiTiling::g_formatToStr.at(weightFormat).c_str(), | 277 | Conv3dApiTiling::g_formatToStr.at(weightFormat).c_str(), |
| 259 | Conv3dApiTiling::g_formatToStr.at(outFormat).c_str()); | 278 | Conv3dApiTiling::g_formatToStr.at(outFormat).c_str()); |
| 279 | + | ||
| 280 | + UpdatePointWiseMode(); | ||
| 260 | } | 281 | } |
| 261 | 282 | ||
| 262 | void Conv3dTilingEngine::SetBias(bool hasBias, Conv3dApiTiling::ConvDtype biasDtype) | 283 | void Conv3dTilingEngine::SetBias(bool hasBias, Conv3dApiTiling::ConvDtype biasDtype) |
| @@ -679,7 +700,7 @@ bool CheckPointWiseParamsDtypeWithBias(const char *logTag, const Conv3DEngineDes | |||
| 679 | } | 700 | } |
| 680 | 701 | ||
| 681 | OP_LOGE(logTag, | 702 | OP_LOGE(logTag, |
| 682 | - "[PointWise] unSupported params data type [fmap, weight, bias, output]: [%s, %s, %s, %s].", | 703 | + "[PointWise] Unsupported params data type [fmap, weight, bias, output]: [%s, %s, %s, %s].", |
| 683 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), | 704 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), |
| 684 | g_convDtypeToStr[descInfo.weightDtype].c_str(), | 705 | g_convDtypeToStr[descInfo.weightDtype].c_str(), |
| 685 | g_convDtypeToStr[descInfo.biasDtype].c_str(), | 706 | g_convDtypeToStr[descInfo.biasDtype].c_str(), |
| @@ -701,7 +722,7 @@ bool CheckPointWiseParamsDtypeWithoutBias(const char *logTag, const Conv3DEngine | |||
| 701 | return true; | 722 | return true; |
| 702 | } | 723 | } |
| 703 | 724 | ||
| 704 | - OP_LOGE(logTag, "[PointWise] unSupported params data type [fmap, weight, output]: [%s, %s, %s].", | 725 | + OP_LOGE(logTag, "[PointWise] Unsupported params data type [fmap, weight, output]: [%s, %s, %s].", |
| 705 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), | 726 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), |
| 706 | g_convDtypeToStr[descInfo.weightDtype].c_str(), | 727 | g_convDtypeToStr[descInfo.weightDtype].c_str(), |
| 707 | g_convDtypeToStr[descInfo.outDtype].c_str()); | 728 | g_convDtypeToStr[descInfo.outDtype].c_str()); |
| @@ -727,7 +748,7 @@ bool CheckParamsDtypeWithScale(const char *logTag, const Conv3DEngineDescInfo &d | |||
| 727 | } | 748 | } |
| 728 | 749 | ||
| 729 | OP_LOGE(logTag, | 750 | OP_LOGE(logTag, |
| 730 | - "unSupported params data type [fmap, weight, bias, scale, output]: [%s, %s, %s, %s, %s].", | 751 | + "Unsupported params data type [fmap, weight, bias, scale, output]: [%s, %s, %s, %s, %s].", |
| 731 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), | 752 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), |
| 732 | g_convDtypeToStr[descInfo.weightDtype].c_str(), | 753 | g_convDtypeToStr[descInfo.weightDtype].c_str(), |
| 733 | g_convDtypeToStr[descInfo.biasDtype].c_str(), | 754 | g_convDtypeToStr[descInfo.biasDtype].c_str(), |
| @@ -752,7 +773,7 @@ bool CheckParamsDtypeWithBias(const char *logTag, const Conv3DEngineDescInfo &de | |||
| 752 | return true; | 773 | return true; |
| 753 | } | 774 | } |
| 754 | 775 | ||
| 755 | - OP_LOGE(logTag, "unSupported params data type [fmap, weight, bias, output]: [%s, %s, %s, %s].", | 776 | + OP_LOGE(logTag, "Unsupported params data type [fmap, weight, bias, output]: [%s, %s, %s, %s].", |
| 756 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), | 777 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), |
| 757 | g_convDtypeToStr[descInfo.weightDtype].c_str(), | 778 | g_convDtypeToStr[descInfo.weightDtype].c_str(), |
| 758 | g_convDtypeToStr[descInfo.biasDtype].c_str(), | 779 | g_convDtypeToStr[descInfo.biasDtype].c_str(), |
| @@ -774,7 +795,7 @@ bool CheckParamsDtypeWithoutBias(const char *logTag, const Conv3DEngineDescInfo | |||
| 774 | return true; | 795 | return true; |
| 775 | } | 796 | } |
| 776 | 797 | ||
| 777 | - OP_LOGE(logTag, "unSupported params data type [fmap, weight, output]: [%s, %s, %s].", | 798 | + OP_LOGE(logTag, "Unsupported params data type [fmap, weight, output]: [%s, %s, %s].", |
| 778 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), | 799 | g_convDtypeToStr[descInfo.fMapDtype].c_str(), |
| 779 | g_convDtypeToStr[descInfo.weightDtype].c_str(), | 800 | g_convDtypeToStr[descInfo.weightDtype].c_str(), |
| 780 | g_convDtypeToStr[descInfo.outDtype].c_str()); | 801 | g_convDtypeToStr[descInfo.outDtype].c_str()); |
| @@ -831,7 +852,7 @@ bool Conv3dTilingEngine::CheckInputFormat() | |||
| 831 | isPointWise ? "Pointwise" : (flagInfo_.hasScale ? "Quant" : "Regular")); | 852 | isPointWise ? "Pointwise" : (flagInfo_.hasScale ? "Quant" : "Regular")); |
| 832 | 853 | ||
| 833 | // Validate based on pointwise mode | 854 | // Validate based on pointwise mode |
| 834 | - if (isPointWise) { | 855 | + if (isPointWise) { |
| 835 | // Pointwise mode: all tensors must be NCDHW | 856 | // Pointwise mode: all tensors must be NCDHW |
| 836 | if(!CheckValidFormatCombo( | 857 | if(!CheckValidFormatCombo( |
| 837 | Conv3dApiTiling::ConvFormat::NCDHW, | 858 | Conv3dApiTiling::ConvFormat::NCDHW, |
| @@ -984,6 +1005,39 @@ bool Conv3dTilingEngine::CheckInputShapeWithPad() | |||
| 984 | return true; | 1005 | return true; |
| 985 | } | 1006 | } |
| 986 | 1007 | ||
| 1008 | +bool Conv3dTilingEngine::CheckOutputShapeConsistency() | ||
| 1009 | +{ | ||
| 1010 | + int64_t expectDo = (static_cast<int64_t>(shapeInfo_.di) + | ||
| 1011 | + attrInfo_.padHead + attrInfo_.padTail - | ||
| 1012 | + attrInfo_.dilationD * (static_cast<int64_t>(shapeInfo_.kd) - 1LL) - 1LL) / | ||
| 1013 | + attrInfo_.strideD + 1LL; | ||
| 1014 | + int64_t expectHo = (static_cast<int64_t>(shapeInfo_.hi) + | ||
| 1015 | + attrInfo_.padTop + attrInfo_.padBottom - | ||
| 1016 | + attrInfo_.dilationH * (static_cast<int64_t>(shapeInfo_.kh) - 1LL) - 1LL) / | ||
| 1017 | + attrInfo_.strideH + 1LL; | ||
| 1018 | + int64_t expectWo = (static_cast<int64_t>(shapeInfo_.wi) + | ||
| 1019 | + attrInfo_.padLeft + attrInfo_.padRight - | ||
| 1020 | + attrInfo_.dilationW * (static_cast<int64_t>(shapeInfo_.kw) - 1LL) - 1LL) / | ||
| 1021 | + attrInfo_.strideW + 1LL; | ||
| 1022 | + | ||
| 1023 | + if (outputBatch_ != static_cast<int64_t>(shapeInfo_.batch) || | ||
| 1024 | + outputCOut_ != static_cast<int64_t>(shapeInfo_.cOut) || | ||
| 1025 | + expectDo != static_cast<int64_t>(shapeInfo_.dOut) || | ||
| 1026 | + expectHo != static_cast<int64_t>(shapeInfo_.ho) || | ||
| 1027 | + expectWo != static_cast<int64_t>(shapeInfo_.wo)) { | ||
| 1028 | + OP_LOGE(logTag_.c_str(), | ||
| 1029 | + "Conv3D AscendC: output shape mismatch. expect [N,C,D,H,W]=[%ld,%ld,%ld,%ld,%ld], " | ||
| 1030 | + "actual [%ld,%ld,%ld,%ld,%ld].", | ||
| 1031 | + static_cast<int64_t>(shapeInfo_.batch), static_cast<int64_t>(shapeInfo_.cOut), | ||
| 1032 | + expectDo, expectHo, expectWo, | ||
| 1033 | + outputBatch_, outputCOut_, static_cast<int64_t>(shapeInfo_.dOut), | ||
| 1034 | + static_cast<int64_t>(shapeInfo_.ho), static_cast<int64_t>(shapeInfo_.wo)); | ||
| 1035 | + return false; | ||
| 1036 | + } | ||
| 1037 | + | ||
| 1038 | + return true; | ||
| 1039 | +} | ||
| 1040 | + | ||
| 987 | bool Conv3dTilingEngine::CheckBiasShape() | 1041 | bool Conv3dTilingEngine::CheckBiasShape() |
| 988 | { | 1042 | { |
| 989 | if (!flagInfo_.hasBias) { | 1043 | if (!flagInfo_.hasBias) { |
| @@ -1197,6 +1251,8 @@ bool Conv3dTilingEngine::CheckAllParams() | |||
| 1197 | // Cross-parameter consistency + hardware limit checks. | 1251 | // Cross-parameter consistency + hardware limit checks. |
| 1198 | {&Conv3dTilingEngine::CheckInputShapeWithPad, | 1252 | {&Conv3dTilingEngine::CheckInputShapeWithPad, |
| 1199 | "CheckAllParams failed: input shape incompatible with pad/dilation/stride."}, | 1253 | "CheckAllParams failed: input shape incompatible with pad/dilation/stride."}, |
| 1254 | + {&Conv3dTilingEngine::CheckOutputShapeConsistency, | ||
| 1255 | + "CheckAllParams failed: output shape is inconsistent with input/weight/attrs."}, | ||
| 1200 | {&Conv3dTilingEngine::CheckLoad3DLimits, | 1256 | {&Conv3dTilingEngine::CheckLoad3DLimits, |
| 1201 | "CheckAllParams failed: configuration violates LOAD3D hardware limits."}, | 1257 | "CheckAllParams failed: configuration violates LOAD3D hardware limits."}, |
| 1202 | }; | 1258 | }; |
| @@ -1376,11 +1432,11 @@ void Conv3dTilingEngine::CoreNumBlocksDecision() | |||
| 1376 | numBlocksRes_ = numBlocksResTmp; | 1432 | numBlocksRes_ = numBlocksResTmp; |
| 1377 | 1433 | ||
| 1378 | /** | 1434 | /** |
| 1379 | - * An optimized core partitioning logic is implemented here to ensure that the dout axis partitioning (doDim) is | 1435 | + * An optimized core partitioning logic is implemented here to ensure that the dout axis partitioning (doDim) is |
| 1380 | * used as fully as possible on the kernel side. | 1436 | * used as fully as possible on the kernel side. |
| 1381 | * In order to ensure that part of the logic entering this optimized core partitioning does not degrade performance, | 1437 | * In order to ensure that part of the logic entering this optimized core partitioning does not degrade performance, |
| 1382 | * the following two constraints are implemented: | 1438 | * the following two constraints are implemented: |
| 1383 | - * ** 1. This logic only updates the inter-core allocation for different axes (such as doDim) and the amount of | 1439 | + * ** 1. This logic only updates the inter-core allocation for different axes (such as doDim) and the amount of |
| 1384 | * data that each core needs to process (such as singleCoreDo) | 1440 | * data that each core needs to process (such as singleCoreDo) |
| 1385 | * ** 2. Optimized core partitioning is only performed for cases that meet DO_DIM_FILTER_THRESHOLD | 1441 | * ** 2. Optimized core partitioning is only performed for cases that meet DO_DIM_FILTER_THRESHOLD |
| 1386 | */ | 1442 | */ |
| @@ -1390,11 +1446,11 @@ void Conv3dTilingEngine::CoreNumBlocksDecision() | |||
| 1390 | allRanges[NUMBLOCKS_DO_IDX] = numBlocksRanges_.doRange; | 1446 | allRanges[NUMBLOCKS_DO_IDX] = numBlocksRanges_.doRange; |
| 1391 | NumBlocksDecisionBackTrack(numBlocksResTmp, allRanges, NUMBLOCKS_BATCH_IDX, dimsRecord); | 1447 | NumBlocksDecisionBackTrack(numBlocksResTmp, allRanges, NUMBLOCKS_BATCH_IDX, dimsRecord); |
| 1392 | if (numBlocksRes_.doDim > DO_DIM_FILTER_THRESHOLD) { | 1448 | if (numBlocksRes_.doDim > DO_DIM_FILTER_THRESHOLD) { |
| 1393 | - OP_LOGD(logTag_.c_str(), "Using original block dimensions: doDim (%u) > threshold (%u), keeping original block dimensions", | 1449 | + OP_LOGD(logTag_.c_str(), "Using original block dimensions: doDim (%u) > threshold (%u), keeping original block dimensions", |
| 1394 | numBlocksRes_.doDim, DO_DIM_FILTER_THRESHOLD); | 1450 | numBlocksRes_.doDim, DO_DIM_FILTER_THRESHOLD); |
| 1395 | numBlocksResOpt_ = numBlocksRes_; | 1451 | numBlocksResOpt_ = numBlocksRes_; |
| 1396 | } else { | 1452 | } else { |
| 1397 | - OP_LOGD(logTag_.c_str(), "Entering block dimension optimization logic: original doDim (%u) <= threshold (%u), using filtered optimized doDim (%u)", | 1453 | + OP_LOGD(logTag_.c_str(), "Entering block dimension optimization logic: original doDim (%u) <= threshold (%u), using filtered optimized doDim (%u)", |
| 1398 | numBlocksRes_.doDim, DO_DIM_FILTER_THRESHOLD, numBlocksResTmp.doDim); | 1454 | numBlocksRes_.doDim, DO_DIM_FILTER_THRESHOLD, numBlocksResTmp.doDim); |
| 1399 | numBlocksResOpt_ = numBlocksResTmp; | 1455 | numBlocksResOpt_ = numBlocksResTmp; |
| 1400 | } | 1456 | } |
| @@ -166,10 +166,15 @@ public: | |||
| 166 | private: | 166 | private: |
| 167 | std::string logTag_ {"Conv3DV2"}; | 167 | std::string logTag_ {"Conv3DV2"}; |
| 168 | bool initOk_ = false; | 168 | bool initOk_ = false; |
| 169 | + bool kernelPointWise_ = false; | ||
| 170 | + int64_t outputBatch_ = -1; | ||
| 171 | + int64_t outputCOut_ = -1; | ||
| 169 | std::vector<int64_t> biasShape_; | 172 | std::vector<int64_t> biasShape_; |
| 170 | std::vector<int64_t> scaleShape_; | 173 | std::vector<int64_t> scaleShape_; |
| 171 | 174 | ||
| 172 | bool InitPlatformInfoFromAscendC(); | 175 | bool InitPlatformInfoFromAscendC(); |
| 176 | + void UpdatePointWiseMode(); | ||
| 177 | + bool UsesPointWisePath() const; | ||
| 173 | 178 | ||
| 174 | public: | 179 | public: |
| 175 | bool CheckStrideLegal(); | 180 | bool CheckStrideLegal(); |
| @@ -182,6 +187,7 @@ public: | |||
| 182 | bool CheckPointWiseParams(); | 187 | bool CheckPointWiseParams(); |
| 183 | bool CheckLoad3DLimits(); | 188 | bool CheckLoad3DLimits(); |
| 184 | bool CheckInputShapeWithPad(); | 189 | bool CheckInputShapeWithPad(); |
| 190 | + bool CheckOutputShapeConsistency(); | ||
| 185 | bool CheckBiasShape(); | 191 | bool CheckBiasShape(); |
| 186 | bool CheckScaleShape(); | 192 | bool CheckScaleShape(); |
| 187 | bool CheckParamsOverflow(); | 193 | bool CheckParamsOverflow(); |
| @@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | -// sizeof(TConv3DTiling) must algin with 8Byte, type sort | 24 | +// sizeof(TConv3DTiling) must align with 8Byte, type sort |
| 25 | namespace optiling { | 25 | namespace optiling { |
| 26 | } // namespace optiling | 26 | } // namespace optiling |
| 27 | 27 | ||
| @@ -17,5 +17,5 @@ DECLARE_STRUCT_RELATE_WITH_OP_V2(Conv3D, Conv3DInputArgs, aDtype, bDtype, cDtype | |||
| 17 | strideH, strideW, dilationD, dilationH, dilationW, padHead, padTail, padTop, | 17 | strideH, strideW, dilationD, dilationH, dilationW, padHead, padTail, padTop, |
| 18 | padBottom, padLeft, padRight, biasFlag); | 18 | padBottom, padLeft, padRight, biasFlag); |
| 19 | 19 | ||
| 20 | -REGISTER_TUNING_TILING_CLASS(Conv3D, Conv3DTunnerTiling); | 20 | +REGISTER_TUNING_TILING_CLASS(Conv3D, Conv3DTunerTiling); |
| 21 | } // namespace tuningtiling | 21 | } // namespace tuningtiling |
| @@ -52,7 +52,7 @@ struct Conv3DInputArgs { | |||
| 52 | bool biasFlag; | 52 | bool biasFlag; |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | -BEGIN_TUNING_TILING_DEF(Conv3DTunnerTiling) | 55 | +BEGIN_TUNING_TILING_DEF(Conv3DTunerTiling) |
| 56 | TUNING_TILING_DATA_FIELD_DEF(uint64_t, groups); | 56 | TUNING_TILING_DATA_FIELD_DEF(uint64_t, groups); |
| 57 | TUNING_TILING_DATA_FIELD_DEF(uint64_t, singleCoreDo); | 57 | TUNING_TILING_DATA_FIELD_DEF(uint64_t, singleCoreDo); |
| 58 | TUNING_TILING_DATA_FIELD_DEF(uint64_t, singleCoreCo); | 58 | TUNING_TILING_DATA_FIELD_DEF(uint64_t, singleCoreCo); |
| @@ -105,57 +105,57 @@ TUNING_TILING_DATA_FIELD_DEF(uint8_t, groupDim); | |||
| 105 | TUNING_TILING_DATA_FIELD_DEF(uint8_t, reserved1); | 105 | TUNING_TILING_DATA_FIELD_DEF(uint8_t, reserved1); |
| 106 | TUNING_TILING_DATA_FIELD_DEF(uint8_t, reserved2); | 106 | TUNING_TILING_DATA_FIELD_DEF(uint8_t, reserved2); |
| 107 | END_TUNING_TILING_DEF | 107 | END_TUNING_TILING_DEF |
| 108 | -DECLARE_SCHEMA(Conv3DTunnerTiling, | 108 | +DECLARE_SCHEMA(Conv3DTunerTiling, |
| 109 | - FIELD(Conv3DTunnerTiling, groups), | 109 | + FIELD(Conv3DTunerTiling, groups), |
| 110 | - FIELD(Conv3DTunnerTiling, singleCoreDo), | 110 | + FIELD(Conv3DTunerTiling, singleCoreDo), |
| 111 | - FIELD(Conv3DTunnerTiling, singleCoreCo), | 111 | + FIELD(Conv3DTunerTiling, singleCoreCo), |
| 112 | - FIELD(Conv3DTunnerTiling, singleCoreM), | 112 | + FIELD(Conv3DTunerTiling, singleCoreM), |
| 113 | - FIELD(Conv3DTunnerTiling, orgDo), | 113 | + FIELD(Conv3DTunerTiling, orgDo), |
| 114 | - FIELD(Conv3DTunnerTiling, orgCo), | 114 | + FIELD(Conv3DTunerTiling, orgCo), |
| 115 | - FIELD(Conv3DTunnerTiling, orgHo), | 115 | + FIELD(Conv3DTunerTiling, orgHo), |
| 116 | - FIELD(Conv3DTunnerTiling, orgWo), | 116 | + FIELD(Conv3DTunerTiling, orgWo), |
| 117 | - FIELD(Conv3DTunnerTiling, orgCi), | 117 | + FIELD(Conv3DTunerTiling, orgCi), |
| 118 | - FIELD(Conv3DTunnerTiling, orgDi), | 118 | + FIELD(Conv3DTunerTiling, orgDi), |
| 119 | - FIELD(Conv3DTunnerTiling, orgHi), | 119 | + FIELD(Conv3DTunerTiling, orgHi), |
| 120 | - FIELD(Conv3DTunnerTiling, orgWi), | 120 | + FIELD(Conv3DTunerTiling, orgWi), |
| 121 | - FIELD(Conv3DTunnerTiling, kernelD), | 121 | + FIELD(Conv3DTunerTiling, kernelD), |
| 122 | - FIELD(Conv3DTunnerTiling, kernelH), | 122 | + FIELD(Conv3DTunerTiling, kernelH), |
| 123 | - FIELD(Conv3DTunnerTiling, kernelW), | 123 | + FIELD(Conv3DTunerTiling, kernelW), |
| 124 | - FIELD(Conv3DTunnerTiling, strideD), | 124 | + FIELD(Conv3DTunerTiling, strideD), |
| 125 | - FIELD(Conv3DTunnerTiling, strideH), | 125 | + FIELD(Conv3DTunerTiling, strideH), |
| 126 | - FIELD(Conv3DTunnerTiling, strideW), | 126 | + FIELD(Conv3DTunerTiling, strideW), |
| 127 | - FIELD(Conv3DTunnerTiling, dilationD), | 127 | + FIELD(Conv3DTunerTiling, dilationD), |
| 128 | - FIELD(Conv3DTunnerTiling, dilationH), | 128 | + FIELD(Conv3DTunerTiling, dilationH), |
| 129 | - FIELD(Conv3DTunnerTiling, dilationW), | 129 | + FIELD(Conv3DTunerTiling, dilationW), |
| 130 | - FIELD(Conv3DTunnerTiling, padHead), | 130 | + FIELD(Conv3DTunerTiling, padHead), |
| 131 | - FIELD(Conv3DTunnerTiling, padTail), | 131 | + FIELD(Conv3DTunerTiling, padTail), |
| 132 | - FIELD(Conv3DTunnerTiling, padTop), | 132 | + FIELD(Conv3DTunerTiling, padTop), |
| 133 | - FIELD(Conv3DTunnerTiling, padBottom), | 133 | + FIELD(Conv3DTunerTiling, padBottom), |
| 134 | - FIELD(Conv3DTunnerTiling, padLeft), | 134 | + FIELD(Conv3DTunerTiling, padLeft), |
| 135 | - FIELD(Conv3DTunnerTiling, padRight), | 135 | + FIELD(Conv3DTunerTiling, padRight), |
| 136 | - FIELD(Conv3DTunnerTiling, mL0), | 136 | + FIELD(Conv3DTunerTiling, mL0), |
| 137 | - FIELD(Conv3DTunnerTiling, kL0), | 137 | + FIELD(Conv3DTunerTiling, kL0), |
| 138 | - FIELD(Conv3DTunnerTiling, nL0), | 138 | + FIELD(Conv3DTunerTiling, nL0), |
| 139 | - FIELD(Conv3DTunnerTiling, kAL1), | 139 | + FIELD(Conv3DTunerTiling, kAL1), |
| 140 | - FIELD(Conv3DTunnerTiling, kBL1), | 140 | + FIELD(Conv3DTunerTiling, kBL1), |
| 141 | - FIELD(Conv3DTunnerTiling, nBL1), | 141 | + FIELD(Conv3DTunerTiling, nBL1), |
| 142 | - FIELD(Conv3DTunnerTiling, mAL1), | 142 | + FIELD(Conv3DTunerTiling, mAL1), |
| 143 | - FIELD(Conv3DTunnerTiling, pBufferFlag), | 143 | + FIELD(Conv3DTunerTiling, pBufferFlag), |
| 144 | - FIELD(Conv3DTunnerTiling, offsetx), | 144 | + FIELD(Conv3DTunerTiling, offsetx), |
| 145 | - FIELD(Conv3DTunnerTiling, bl1FullLoad), | 145 | + FIELD(Conv3DTunerTiling, bl1FullLoad), |
| 146 | - FIELD(Conv3DTunnerTiling, al1FullLoad), | 146 | + FIELD(Conv3DTunerTiling, al1FullLoad), |
| 147 | - FIELD(Conv3DTunnerTiling, bl1BypassFlag), | 147 | + FIELD(Conv3DTunerTiling, bl1BypassFlag), |
| 148 | - FIELD(Conv3DTunnerTiling, iterateMNOrder), | 148 | + FIELD(Conv3DTunerTiling, iterateMNOrder), |
| 149 | - FIELD(Conv3DTunnerTiling, biasFullLoadFlag), | 149 | + FIELD(Conv3DTunerTiling, biasFullLoadFlag), |
| 150 | - FIELD(Conv3DTunnerTiling, fixpParamsFullLoadFlag), | 150 | + FIELD(Conv3DTunerTiling, fixpParamsFullLoadFlag), |
| 151 | - FIELD(Conv3DTunnerTiling, hf32Enable), | 151 | + FIELD(Conv3DTunerTiling, hf32Enable), |
| 152 | - FIELD(Conv3DTunnerTiling, hf32TransMode), | 152 | + FIELD(Conv3DTunerTiling, hf32TransMode), |
| 153 | - FIELD(Conv3DTunnerTiling, batchDim), | 153 | + FIELD(Conv3DTunerTiling, batchDim), |
| 154 | - FIELD(Conv3DTunnerTiling, nDim), | 154 | + FIELD(Conv3DTunerTiling, nDim), |
| 155 | - FIELD(Conv3DTunnerTiling, mDim), | 155 | + FIELD(Conv3DTunerTiling, mDim), |
| 156 | - FIELD(Conv3DTunnerTiling, doDim), | 156 | + FIELD(Conv3DTunerTiling, doDim), |
| 157 | - FIELD(Conv3DTunnerTiling, groupDim), | 157 | + FIELD(Conv3DTunerTiling, groupDim), |
| 158 | - FIELD(Conv3DTunnerTiling, reserved1), | 158 | + FIELD(Conv3DTunerTiling, reserved1), |
| 159 | - FIELD(Conv3DTunnerTiling, reserved2)); | 159 | + FIELD(Conv3DTunerTiling, reserved2)); |
| 160 | } // namespace tuningtiling | 160 | } // namespace tuningtiling |
| 161 | 161 | ||
| @@ -698,9 +698,40 @@ TEST(TestConv3dTilingEngine, CheckAttrLimits_MixedBoundaryValues) | |||
| 698 | EXPECT_TRUE(engine.CheckDilationLegal()); | 698 | EXPECT_TRUE(engine.CheckDilationLegal()); |
| 699 | } | 699 | } |
| 700 | 700 | ||
| 701 | -// Note about CheckOutputShape: | 701 | +TEST(TestConv3dTilingEngine, CheckOutputShapeConsistency_Positive) |
| 702 | -// CheckOutputShape is declared in the header file but not implemented in the cpp file. | 702 | +{ |
| 703 | -// Unit tests for this method are skipped to avoid linking issues or relying on dead declarations. | 703 | + Conv3dTilingEngine engine; |
| 704 | + InitSimpleConv3dEngine(engine); | ||
| 705 | + | ||
| 706 | + EXPECT_TRUE(engine.CheckOutputShapeConsistency()); | ||
| 707 | +} | ||
| 708 | + | ||
| 709 | +TEST(TestConv3dTilingEngine, CheckOutputShapeConsistency_DimensionMismatch) | ||
| 710 | +{ | ||
| 711 | + Conv3dTilingEngine engine; | ||
| 712 | + InitSimpleConv3dEngine(engine); | ||
| 713 | + | ||
| 714 | + engine.SetOrgOutputShape({1, 16, 2, 1, 1}); | ||
| 715 | + EXPECT_FALSE(engine.CheckOutputShapeConsistency()); | ||
| 716 | +} | ||
| 717 | + | ||
| 718 | +TEST(TestConv3dTilingEngine, CheckOutputShapeConsistency_BatchOrChannelMismatch) | ||
| 719 | +{ | ||
| 720 | + Conv3dTilingEngine engine; | ||
| 721 | + InitSimpleConv3dEngine(engine); | ||
| 722 | + | ||
| 723 | + engine.SetOrgOutputShape({2, 8, 1, 1, 1}); | ||
| 724 | + EXPECT_FALSE(engine.CheckOutputShapeConsistency()); | ||
| 725 | +} | ||
| 726 | + | ||
| 727 | +TEST(TestConv3dTilingEngine, CheckAllParams_FailsOnOutputShapeMismatch) | ||
| 728 | +{ | ||
| 729 | + Conv3dTilingEngine engine; | ||
| 730 | + InitSimpleConv3dEngine(engine); | ||
| 731 | + | ||
| 732 | + engine.SetOrgOutputShape({1, 16, 2, 1, 1}); | ||
| 733 | + EXPECT_FALSE(engine.CheckAllParams()); | ||
| 734 | +} | ||
| 704 | 735 | ||
| 705 | TEST(TestConv3dTilingEngine, CheckParameterConsistency_GroupChannelMismatch) | 736 | TEST(TestConv3dTilingEngine, CheckParameterConsistency_GroupChannelMismatch) |
| 706 | { | 737 | { |
| @@ -1539,6 +1570,19 @@ TEST(TestConv3dTilingEngine, CheckInputFormat_PointwiseModeDetection) | |||
| 1539 | EXPECT_TRUE(engine.CheckInputFormat()); | 1570 | EXPECT_TRUE(engine.CheckInputFormat()); |
| 1540 | } | 1571 | } |
| 1541 | 1572 | ||
| 1573 | +TEST(TestConv3dTilingEngine, CheckInputFormat_OneByOneByOneRegularFormatsStaysRegularMode) | ||
| 1574 | +{ | ||
| 1575 | + using Conv3dApiTiling::ConvFormat; | ||
| 1576 | + | ||
| 1577 | + Conv3dTilingEngine engine; | ||
| 1578 | + InitSimpleConv3dEngine(engine); | ||
| 1579 | + | ||
| 1580 | + engine.SetFormat(ConvFormat::NDC1HWC0, ConvFormat::FRACTAL_Z_3D, ConvFormat::NDC1HWC0); | ||
| 1581 | + | ||
| 1582 | + EXPECT_FALSE(engine.isPointWise); | ||
| 1583 | + EXPECT_TRUE(engine.CheckInputFormat()); | ||
| 1584 | +} | ||
| 1585 | + | ||
| 1542 | TEST(TestConv3dTilingEngine, CheckInputFormat_AllFormatCombinations) | 1586 | TEST(TestConv3dTilingEngine, CheckInputFormat_AllFormatCombinations) |
| 1543 | { | 1587 | { |
| 1544 | using Conv3dApiTiling::ConvFormat; | 1588 | using Conv3dApiTiling::ConvFormat; |
| @@ -569,7 +569,6 @@ TEST_F(Conv3DV2TilingRuntime, TestConv3DV2CheckPointWiseSuccess) | |||
| 569 | gert::TilingContext *tilingContext = holder.GetContext<gert::TilingContext>(); | 569 | gert::TilingContext *tilingContext = holder.GetContext<gert::TilingContext>(); |
| 570 | 570 | ||
| 571 | optiling::Conv3dOpsTiling::Conv3dBaseTiling conv3dBT(tilingContext); | 571 | optiling::Conv3dOpsTiling::Conv3dBaseTiling conv3dBT(tilingContext); |
| 572 | - conv3dBT.isPointWise = true; | ||
| 573 | conv3dBT.shapeInfo_.kh = 1; | 572 | conv3dBT.shapeInfo_.kh = 1; |
| 574 | conv3dBT.shapeInfo_.kw = 1; | 573 | conv3dBT.shapeInfo_.kw = 1; |
| 575 | conv3dBT.shapeInfo_.kd = 1; | 574 | conv3dBT.shapeInfo_.kd = 1; |
| @@ -1331,7 +1330,8 @@ static Conv3dTilingEngine BuildEngineFromBase(const optiling::Conv3dOpsTiling::C | |||
| 1331 | engine.attrInfo_.groups = static_cast<int64_t>(base.attrInfo_.groups); | 1330 | engine.attrInfo_.groups = static_cast<int64_t>(base.attrInfo_.groups); |
| 1332 | engine.attrInfo_.groupOpt = static_cast<int64_t>(base.attrInfo_.groupOpt); | 1331 | engine.attrInfo_.groupOpt = static_cast<int64_t>(base.attrInfo_.groupOpt); |
| 1333 | engine.outputOrder_ = base.outputOrder_; | 1332 | engine.outputOrder_ = base.outputOrder_; |
| 1334 | - engine.isPointWise = base.isPointWise; | 1333 | + engine.outputBatch_ = static_cast<int64_t>(base.shapeInfo_.batch); |
| 1334 | + engine.outputCOut_ = static_cast<int64_t>(base.shapeInfo_.cOut); | ||
| 1335 | 1335 | ||
| 1336 | // Default dtype/format for tests (align with BF16 NCDHW setup) | 1336 | // Default dtype/format for tests (align with BF16 NCDHW setup) |
| 1337 | engine.descInfo_.fMapDtype = Conv3dApiTiling::ConvDtype::BF16; | 1337 | engine.descInfo_.fMapDtype = Conv3dApiTiling::ConvDtype::BF16; |
| @@ -1340,6 +1340,8 @@ static Conv3dTilingEngine BuildEngineFromBase(const optiling::Conv3dOpsTiling::C | |||
| 1340 | engine.descInfo_.fMapFormat = Conv3dApiTiling::ConvFormat::NCDHW; | 1340 | engine.descInfo_.fMapFormat = Conv3dApiTiling::ConvFormat::NCDHW; |
| 1341 | engine.descInfo_.weightFormat = Conv3dApiTiling::ConvFormat::NCDHW; | 1341 | engine.descInfo_.weightFormat = Conv3dApiTiling::ConvFormat::NCDHW; |
| 1342 | engine.descInfo_.outFormat = Conv3dApiTiling::ConvFormat::NCDHW; | 1342 | engine.descInfo_.outFormat = Conv3dApiTiling::ConvFormat::NCDHW; |
| 1343 | + engine.kernelPointWise_ = engine.shapeInfo_.kd == 1 && engine.shapeInfo_.kh == 1 && engine.shapeInfo_.kw == 1; | ||
| 1344 | + engine.UpdatePointWiseMode(); | ||
| 1343 | return engine; | 1345 | return engine; |
| 1344 | } | 1346 | } |
| 1345 | 1347 | ||
| @@ -1449,12 +1449,12 @@ private: | |||
| 1449 | FVector<int64_t>& padding, bool transposed) | 1449 | FVector<int64_t>& padding, bool transposed) |
| 1450 | { | 1450 | { |
| 1451 | FVector<int64_t> inputShape, weightShape; | 1451 | FVector<int64_t> inputShape, weightShape; |
| 1452 | - bool inputChannleLast, weightChannleLast; | 1452 | + bool inputChannelLast, weightChannelLast; |
| 1453 | int64_t inputSpaceDimIndex, weightSpaceDimIndex; | 1453 | int64_t inputSpaceDimIndex, weightSpaceDimIndex; |
| 1454 | size_t inputSpaceDimNum, weightSpaceDimNum; | 1454 | size_t inputSpaceDimNum, weightSpaceDimNum; |
| 1455 | 1455 | ||
| 1456 | - GetSpatialDimInfo(input, inputChannleLast, inputSpaceDimIndex, inputSpaceDimNum, inputShape); | 1456 | + GetSpatialDimInfo(input, inputChannelLast, inputSpaceDimIndex, inputSpaceDimNum, inputShape); |
| 1457 | - GetSpatialDimInfo(weight, weightChannleLast, weightSpaceDimIndex, weightSpaceDimNum, weightShape); | 1457 | + GetSpatialDimInfo(weight, weightChannelLast, weightSpaceDimIndex, weightSpaceDimNum, weightShape); |
| 1458 | 1458 | ||
| 1459 | auto newpad = ConstructPad(padding, inputShape); | 1459 | auto newpad = ConstructPad(padding, inputShape); |
| 1460 | for (size_t i = 0; i < inputSpaceDimNum; ++i) { | 1460 | for (size_t i = 0; i < inputSpaceDimNum; ++i) { |
| @@ -1480,7 +1480,7 @@ private: | |||
| 1480 | if (inputShapeValueAfterPad < 0) { | 1480 | if (inputShapeValueAfterPad < 0) { |
| 1481 | OP_LOGE( | 1481 | OP_LOGE( |
| 1482 | ACLNN_ERR_PARAM_INVALID, | 1482 | ACLNN_ERR_PARAM_INVALID, |
| 1483 | - "after pad and dilation, expect input shape[%zu] should be greater than kernerl shape[%zu], " | 1483 | + "after pad and dilation, expect input shape[%zu] should be greater than kernel shape[%zu], " |
| 1484 | "(input + pad - dilation * (weight - 1) - 1) should >= 0, actual get: %ld", | 1484 | "(input + pad - dilation * (weight - 1) - 1) should >= 0, actual get: %ld", |
| 1485 | i, i, inputShapeValueAfterPad); | 1485 | i, i, inputShapeValueAfterPad); |
| 1486 | return ACLNN_ERR_PARAM_INVALID; | 1486 | return ACLNN_ERR_PARAM_INVALID; |
| @@ -1583,13 +1583,13 @@ private: | |||
| 1583 | 1583 | ||
| 1584 | // check space(d h w or l) | 1584 | // check space(d h w or l) |
| 1585 | FVector<int64_t> inputShape = input.shape; | 1585 | FVector<int64_t> inputShape = input.shape; |
| 1586 | - bool inputChannleLast = input.ChannelLast(); | 1586 | + bool inputChannelLast = input.ChannelLast(); |
| 1587 | - int64_t inputSpaceDimIndex = inputChannleLast ? 1 : 2; // 空间维度在shape中的起始位置,C维度后置时为1,否则为2 | 1587 | + int64_t inputSpaceDimIndex = inputChannelLast ? 1 : 2; // 空间维度在shape中的起始位置,C维度后置时为1,否则为2 |
| 1588 | size_t inputSpaceDimNum = input.shape.size() - 2; // 空间维度大小,1d卷积时为1,2d为2,3d为3 | 1588 | size_t inputSpaceDimNum = input.shape.size() - 2; // 空间维度大小,1d卷积时为1,2d为2,3d为3 |
| 1589 | 1589 | ||
| 1590 | FVector<int64_t> weightShape = weight.shape; | 1590 | FVector<int64_t> weightShape = weight.shape; |
| 1591 | - bool weightChannleLast = weight.ChannelLast(); | 1591 | + bool weightChannelLast = weight.ChannelLast(); |
| 1592 | - int64_t weightSpaceDimIndex = weightChannleLast ? 1 : 2; // 空间维度在shape中的起始位置,C维度后置时为1,否则为2 | 1592 | + int64_t weightSpaceDimIndex = weightChannelLast ? 1 : 2; // 空间维度在shape中的起始位置,C维度后置时为1,否则为2 |
| 1593 | 1593 | ||
| 1594 | // 假设是NCL,判断L的值。假设是NCHW,判断HW的值 | 1594 | // 假设是NCL,判断L的值。假设是NCHW,判断HW的值 |
| 1595 | for (size_t i = 0; i < inputSpaceDimNum; ++i) { | 1595 | for (size_t i = 0; i < inputSpaceDimNum; ++i) { |
| @@ -1649,7 +1649,7 @@ public: | |||
| 1649 | 1649 | ||
| 1650 | private: | 1650 | private: |
| 1651 | /* | 1651 | /* |
| 1652 | - input weight output 的shape均瑶大于等于0 | 1652 | + input weight output 的shape均需大于等于0 |
| 1653 | bias(一维)的值要等于channel_out | 1653 | bias(一维)的值要等于channel_out |
| 1654 | */ | 1654 | */ |
| 1655 | aclnnStatus CheckShapeTbc(TensorMeta& input, TensorMeta& weight, TensorMeta& output) const | 1655 | aclnnStatus CheckShapeTbc(TensorMeta& input, TensorMeta& weight, TensorMeta& output) const |
| @@ -1769,12 +1769,12 @@ private: | |||
| 1769 | 1769 | ||
| 1770 | // check space(d h w or l) | 1770 | // check space(d h w or l) |
| 1771 | FVector<int64_t> inputShape, weightShape; | 1771 | FVector<int64_t> inputShape, weightShape; |
| 1772 | - bool inputChannleLast, weightChannleLast; | 1772 | + bool inputChannelLast, weightChannelLast; |
| 1773 | int64_t inputSpaceDimIndex, weightSpaceDimIndex; | 1773 | int64_t inputSpaceDimIndex, weightSpaceDimIndex; |
| 1774 | size_t inputSpaceDimNum, weightSpaceDimNum; | 1774 | size_t inputSpaceDimNum, weightSpaceDimNum; |
| 1775 | 1775 | ||
| 1776 | - GetSpatialDimInfo(input, inputChannleLast, inputSpaceDimIndex, inputSpaceDimNum, inputShape); | 1776 | + GetSpatialDimInfo(input, inputChannelLast, inputSpaceDimIndex, inputSpaceDimNum, inputShape); |
| 1777 | - GetSpatialDimInfo(weight, weightChannleLast, weightSpaceDimIndex, weightSpaceDimNum, weightShape); | 1777 | + GetSpatialDimInfo(weight, weightChannelLast, weightSpaceDimIndex, weightSpaceDimNum, weightShape); |
| 1778 | for (size_t i = 0; i < inputSpaceDimNum; ++i) { | 1778 | for (size_t i = 0; i < inputSpaceDimNum; ++i) { |
| 1779 | int64_t inputShapeSpace = inputShape[i + inputSpaceDimIndex]; // 空间维度的值 | 1779 | int64_t inputShapeSpace = inputShape[i + inputSpaceDimIndex]; // 空间维度的值 |
| 1780 | if (inputShapeSpace < 0) { | 1780 | if (inputShapeSpace < 0) { |
| @@ -1810,12 +1810,12 @@ private: | |||
| 1810 | const FVector<int64_t>& padding, bool transposed) | 1810 | const FVector<int64_t>& padding, bool transposed) |
| 1811 | { | 1811 | { |
| 1812 | FVector<int64_t> inputShape, weightShape; | 1812 | FVector<int64_t> inputShape, weightShape; |
| 1813 | - bool inputChannleLast, weightChannleLast; | 1813 | + bool inputChannelLast, weightChannelLast; |
| 1814 | int64_t inputSpaceDimIndex, weightSpaceDimIndex; | 1814 | int64_t inputSpaceDimIndex, weightSpaceDimIndex; |
| 1815 | size_t inputSpaceDimNum, weightSpaceDimNum; | 1815 | size_t inputSpaceDimNum, weightSpaceDimNum; |
| 1816 | 1816 | ||
| 1817 | - GetSpatialDimInfo(input, inputChannleLast, inputSpaceDimIndex, inputSpaceDimNum, inputShape); | 1817 | + GetSpatialDimInfo(input, inputChannelLast, inputSpaceDimIndex, inputSpaceDimNum, inputShape); |
| 1818 | - GetSpatialDimInfo(weight, weightChannleLast, weightSpaceDimIndex, weightSpaceDimNum, weightShape); | 1818 | + GetSpatialDimInfo(weight, weightChannelLast, weightSpaceDimIndex, weightSpaceDimNum, weightShape); |
| 1819 | 1819 | ||
| 1820 | for (size_t i = 0; i < inputSpaceDimNum; ++i) { | 1820 | for (size_t i = 0; i < inputSpaceDimNum; ++i) { |
| 1821 | auto inputShapeValue = inputShape[i + inputSpaceDimIndex]; | 1821 | auto inputShapeValue = inputShape[i + inputSpaceDimIndex]; |
| @@ -3553,12 +3553,12 @@ aclIntArray* ViewValueAs1d(const int64_t value, aclOpExecutor* executor) | |||
| 3553 | 3553 | ||
| 3554 | const aclTensor* View1dAs4d(const aclTensor* input, aclOpExecutor* executor) | 3554 | const aclTensor* View1dAs4d(const aclTensor* input, aclOpExecutor* executor) |
| 3555 | { | 3555 | { |
| 3556 | - // input NCL->contigious->unsqueeze(2)->reformat NCHW | 3556 | + // input NCL->contiguous->unsqueeze(2)->reformat NCHW |
| 3557 | - // 非连续转连续contigious | 3557 | + // 非连续转连续contiguous |
| 3558 | auto contiguousInput = l0op::Contiguous(input, executor); | 3558 | auto contiguousInput = l0op::Contiguous(input, executor); |
| 3559 | CHECK_RET(contiguousInput != nullptr, nullptr); | 3559 | CHECK_RET(contiguousInput != nullptr, nullptr); |
| 3560 | 3560 | ||
| 3561 | - // unsqeeze(2) | 3561 | + // unsqueeze(2) |
| 3562 | constexpr int64_t appendDim[] = {0, 2, 3}; | 3562 | constexpr int64_t appendDim[] = {0, 2, 3}; |
| 3563 | aclIntArray* dim = executor->AllocIntArray(appendDim, 3); | 3563 | aclIntArray* dim = executor->AllocIntArray(appendDim, 3); |
| 3564 | auto unsqueezedInput = l0op::UnsqueezeNd(contiguousInput, dim, executor); | 3564 | auto unsqueezedInput = l0op::UnsqueezeNd(contiguousInput, dim, executor); |
| @@ -3573,12 +3573,12 @@ const aclTensor* View1dAs4d(const aclTensor* input, aclOpExecutor* executor) | |||
| 3573 | 3573 | ||
| 3574 | static const aclTensor* View3dAs4d(const aclTensor* input, aclOpExecutor* executor) | 3574 | static const aclTensor* View3dAs4d(const aclTensor* input, aclOpExecutor* executor) |
| 3575 | { | 3575 | { |
| 3576 | - // input NCL->contigious->unsqueeze(2)->reformat NCHW | 3576 | + // input NCL->contiguous->unsqueeze(2)->reformat NCHW |
| 3577 | - // 非连续转连续contigious | 3577 | + // 非连续转连续contiguous |
| 3578 | auto contiguousInput = l0op::Contiguous(input, executor); | 3578 | auto contiguousInput = l0op::Contiguous(input, executor); |
| 3579 | CHECK_RET(contiguousInput != nullptr, nullptr); | 3579 | CHECK_RET(contiguousInput != nullptr, nullptr); |
| 3580 | 3580 | ||
| 3581 | - // unsqeeze(2) | 3581 | + // unsqueeze(2) |
| 3582 | constexpr int64_t appendDim[] = {2}; | 3582 | constexpr int64_t appendDim[] = {2}; |
| 3583 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); | 3583 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); |
| 3584 | auto unsqueezedInput = l0op::UnsqueezeNd(contiguousInput, dim, executor); | 3584 | auto unsqueezedInput = l0op::UnsqueezeNd(contiguousInput, dim, executor); |
| @@ -3593,12 +3593,12 @@ static const aclTensor* View3dAs4d(const aclTensor* input, aclOpExecutor* execut | |||
| 3593 | 3593 | ||
| 3594 | static const aclTensor* View3dAs4dw(const aclTensor* input, aclOpExecutor* executor) | 3594 | static const aclTensor* View3dAs4dw(const aclTensor* input, aclOpExecutor* executor) |
| 3595 | { | 3595 | { |
| 3596 | - // input NCL->contigious->unsqueeze(2)->reshape->reformat NCHW | 3596 | + // input NCL->contiguous->unsqueeze(2)->reshape->reformat NCHW |
| 3597 | - // 非连续转连续contigious | 3597 | + // 非连续转连续contiguous |
| 3598 | auto contiguousInput = l0op::Contiguous(input, executor); | 3598 | auto contiguousInput = l0op::Contiguous(input, executor); |
| 3599 | CHECK_RET(contiguousInput != nullptr, nullptr); | 3599 | CHECK_RET(contiguousInput != nullptr, nullptr); |
| 3600 | 3600 | ||
| 3601 | - // unsqeeze(2) 扩w维度 | 3601 | + // unsqueeze(2) 扩w维度 |
| 3602 | constexpr int64_t appendDim[] = {2}; | 3602 | constexpr int64_t appendDim[] = {2}; |
| 3603 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); | 3603 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); |
| 3604 | auto unsqueezedInput = l0op::UnsqueezeNd(contiguousInput, dim, executor); | 3604 | auto unsqueezedInput = l0op::UnsqueezeNd(contiguousInput, dim, executor); |
| @@ -3622,11 +3622,11 @@ static const aclTensor* View3dAs4dw(const aclTensor* input, aclOpExecutor* execu | |||
| 3622 | 3622 | ||
| 3623 | static const aclTensor* View4dAs3d(const aclTensor* input, aclOpExecutor* executor) | 3623 | static const aclTensor* View4dAs3d(const aclTensor* input, aclOpExecutor* executor) |
| 3624 | { | 3624 | { |
| 3625 | - // input NCL->contigious->unsqueeze(2)->reformat NCHW | 3625 | + // input NCL->contiguous->unsqueeze(2)->reformat NCHW |
| 3626 | - // 非连续转连续contigious | 3626 | + // 非连续转连续contiguous |
| 3627 | auto contiguousInput = l0op::Contiguous(input, executor); | 3627 | auto contiguousInput = l0op::Contiguous(input, executor); |
| 3628 | CHECK_RET(contiguousInput != nullptr, nullptr); | 3628 | CHECK_RET(contiguousInput != nullptr, nullptr); |
| 3629 | - // sqeeze(2) | 3629 | + // squeeze(2) |
| 3630 | constexpr int64_t appendDim[] = {2}; | 3630 | constexpr int64_t appendDim[] = {2}; |
| 3631 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); | 3631 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); |
| 3632 | CHECK_RET(dim != nullptr, nullptr); | 3632 | CHECK_RET(dim != nullptr, nullptr); |
| @@ -3642,8 +3642,8 @@ static const aclTensor* View4dAs3d(const aclTensor* input, aclOpExecutor* execut | |||
| 3642 | 3642 | ||
| 3643 | static const aclTensor* View4dAs3dw(const aclTensor* input, aclOpExecutor* executor) | 3643 | static const aclTensor* View4dAs3dw(const aclTensor* input, aclOpExecutor* executor) |
| 3644 | { | 3644 | { |
| 3645 | - // input NCL->contigious->Reshape->unsqueeze(2)->reformat NCHW | 3645 | + // input NCL->contiguous->Reshape->unsqueeze(2)->reformat NCHW |
| 3646 | - // 非连续转连续contigious | 3646 | + // 非连续转连续contiguous |
| 3647 | auto contiguousInput = l0op::Contiguous(input, executor); | 3647 | auto contiguousInput = l0op::Contiguous(input, executor); |
| 3648 | CHECK_RET(contiguousInput != nullptr, nullptr); | 3648 | CHECK_RET(contiguousInput != nullptr, nullptr); |
| 3649 | 3649 | ||
| @@ -3655,7 +3655,7 @@ static const aclTensor* View4dAs3dw(const aclTensor* input, aclOpExecutor* execu | |||
| 3655 | CHECK_RET(shapeArray != nullptr, nullptr); | 3655 | CHECK_RET(shapeArray != nullptr, nullptr); |
| 3656 | contiguousInput = l0op::Reshape(contiguousInput, shapeArray, executor); | 3656 | contiguousInput = l0op::Reshape(contiguousInput, shapeArray, executor); |
| 3657 | CHECK_RET(contiguousInput != nullptr, nullptr); | 3657 | CHECK_RET(contiguousInput != nullptr, nullptr); |
| 3658 | - // sqeeze(3) | 3658 | + // squeeze(3) |
| 3659 | constexpr int64_t appendDim[] = {2}; | 3659 | constexpr int64_t appendDim[] = {2}; |
| 3660 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); | 3660 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); |
| 3661 | CHECK_RET(dim != nullptr, nullptr); | 3661 | CHECK_RET(dim != nullptr, nullptr); |
| @@ -3671,7 +3671,7 @@ static const aclTensor* View4dAs3dw(const aclTensor* input, aclOpExecutor* execu | |||
| 3671 | 3671 | ||
| 3672 | static const aclTensor* Permute(const aclTensor* input, FVector<int64_t> dims, aclOpExecutor* executor) | 3672 | static const aclTensor* Permute(const aclTensor* input, FVector<int64_t> dims, aclOpExecutor* executor) |
| 3673 | { | 3673 | { |
| 3674 | - // contigious | 3674 | + // contiguous |
| 3675 | auto contiguousInput = l0op::Contiguous(input, executor); | 3675 | auto contiguousInput = l0op::Contiguous(input, executor); |
| 3676 | CHECK_RET(contiguousInput != nullptr, nullptr); | 3676 | CHECK_RET(contiguousInput != nullptr, nullptr); |
| 3677 | // Transpose | 3677 | // Transpose |
| @@ -357,8 +357,8 @@ private: | |||
| 357 | FVector<int64_t> weightShape = meta.weight.shape; | 357 | FVector<int64_t> weightShape = meta.weight.shape; |
| 358 | 358 | ||
| 359 | auto newPad = ConstructPadding(meta.padding, inputShape); | 359 | auto newPad = ConstructPadding(meta.padding, inputShape); |
| 360 | - int64_t inferedShapeSize = inputShape.size() - 2; | 360 | + int64_t inferredShapeSize = inputShape.size() - 2; |
| 361 | - for (int64_t i = 0; i < inferedShapeSize; ++i) { | 361 | + for (int64_t i = 0; i < inferredShapeSize; ++i) { |
| 362 | int64_t xOut = (inputShape[i + INPUT_C_INDEX + 1] + newPad[i] - meta.dilation[i] * | 362 | int64_t xOut = (inputShape[i + INPUT_C_INDEX + 1] + newPad[i] - meta.dilation[i] * |
| 363 | (weightShape[i + INPUT_C_INDEX + 1] - 1) - 1) / meta.stride[i] + 1; | 363 | (weightShape[i + INPUT_C_INDEX + 1] - 1) - 1) / meta.stride[i] + 1; |
| 364 | output.push_back(xOut); | 364 | output.push_back(xOut); |
| @@ -657,17 +657,17 @@ public: | |||
| 657 | return ACLNN_ERR_PARAM_INVALID; | 657 | return ACLNN_ERR_PARAM_INVALID; |
| 658 | } | 658 | } |
| 659 | private: | 659 | private: |
| 660 | - bool QuantConvDtypesMatch(const std::vector<DataType>& matchedList, const std::vector<DataType>& supporedList, | 660 | + bool QuantConvDtypesMatch(const std::vector<DataType>& matchedList, const std::vector<DataType>& supportedList, |
| 661 | size_t checkedLength) const | 661 | size_t checkedLength) const |
| 662 | { | 662 | { |
| 663 | - if (matchedList.size() > supporedList.size()) { | 663 | + if (matchedList.size() > supportedList.size()) { |
| 664 | return false; | 664 | return false; |
| 665 | } | 665 | } |
| 666 | - if (checkedLength > supporedList.size()) { | 666 | + if (checkedLength > supportedList.size()) { |
| 667 | return false; | 667 | return false; |
| 668 | } | 668 | } |
| 669 | for (size_t i = 0; i < checkedLength; i++) { | 669 | for (size_t i = 0; i < checkedLength; i++) { |
| 670 | - if (matchedList[i] != supporedList[i]) { | 670 | + if (matchedList[i] != supportedList[i]) { |
| 671 | return false; | 671 | return false; |
| 672 | } | 672 | } |
| 673 | } | 673 | } |
| @@ -721,7 +721,7 @@ private: | |||
| 721 | return ACLNN_SUCCESS; | 721 | return ACLNN_SUCCESS; |
| 722 | } | 722 | } |
| 723 | 723 | ||
| 724 | - static aclnnStatus CheckVaildString(const string &inputStr) | 724 | + static aclnnStatus CheckValidString(const string &inputStr) |
| 725 | { | 725 | { |
| 726 | if (inputStr.empty()) { | 726 | if (inputStr.empty()) { |
| 727 | return ACLNN_SUCCESS; | 727 | return ACLNN_SUCCESS; |
| @@ -771,7 +771,7 @@ private: | |||
| 771 | } | 771 | } |
| 772 | OP_LOGW("the input roundMode is suggested to be set as a nullptr"); | 772 | OP_LOGW("the input roundMode is suggested to be set as a nullptr"); |
| 773 | roundModeStr = std::string(engine.params.roundMode); | 773 | roundModeStr = std::string(engine.params.roundMode); |
| 774 | - if (CheckVaildString(roundModeStr) != ACLNN_SUCCESS) { | 774 | + if (CheckValidString(roundModeStr) != ACLNN_SUCCESS) { |
| 775 | OP_LOGE(ACLNN_ERR_PARAM_INVALID, "the input roundMode has invalid str"); | 775 | OP_LOGE(ACLNN_ERR_PARAM_INVALID, "the input roundMode has invalid str"); |
| 776 | return ACLNN_ERR_PARAM_INVALID; | 776 | return ACLNN_ERR_PARAM_INVALID; |
| 777 | } | 777 | } |
| @@ -830,7 +830,7 @@ private: | |||
| 830 | static aclnnStatus CheckShapeValue(QuantConvEngine &engine) | 830 | static aclnnStatus CheckShapeValue(QuantConvEngine &engine) |
| 831 | { | 831 | { |
| 832 | int64_t inputDimN = engine.meta.input.N(); | 832 | int64_t inputDimN = engine.meta.input.N(); |
| 833 | - int64_t iuputDimC = engine.meta.input.C(); | 833 | + int64_t inputDimC = engine.meta.input.C(); |
| 834 | int64_t inputDimD = engine.meta.input.D(); | 834 | int64_t inputDimD = engine.meta.input.D(); |
| 835 | int64_t inputDimH = engine.meta.input.H(); | 835 | int64_t inputDimH = engine.meta.input.H(); |
| 836 | int64_t inputDimW = engine.meta.input.W(); | 836 | int64_t inputDimW = engine.meta.input.W(); |
| @@ -840,14 +840,14 @@ private: | |||
| 840 | int64_t weightDimH = engine.meta.weight.H(); | 840 | int64_t weightDimH = engine.meta.weight.H(); |
| 841 | int64_t weightDimW = engine.meta.weight.W(); | 841 | int64_t weightDimW = engine.meta.weight.W(); |
| 842 | 842 | ||
| 843 | - // enbale empty tensor | 843 | + // enable empty tensor |
| 844 | CHECK_PARAMS_GT(inputDimN, 0L); | 844 | CHECK_PARAMS_GT(inputDimN, 0L); |
| 845 | CHECK_PARAMS_GT(inputDimD, 0L); | 845 | CHECK_PARAMS_GT(inputDimD, 0L); |
| 846 | CHECK_PARAMS_GT(inputDimH, 0L); | 846 | CHECK_PARAMS_GT(inputDimH, 0L); |
| 847 | CHECK_PARAMS_GT(inputDimW, 0L); | 847 | CHECK_PARAMS_GT(inputDimW, 0L); |
| 848 | CHECK_PARAMS_GT(weightDimN, 0L); | 848 | CHECK_PARAMS_GT(weightDimN, 0L); |
| 849 | 849 | ||
| 850 | - CHECK_PARAMS_GT(iuputDimC, 0L); | 850 | + CHECK_PARAMS_GT(inputDimC, 0L); |
| 851 | CHECK_PARAMS_GT(weightDimC, 0L); | 851 | CHECK_PARAMS_GT(weightDimC, 0L); |
| 852 | CHECK_PARAMS_GT(weightDimD, 0L); | 852 | CHECK_PARAMS_GT(weightDimD, 0L); |
| 853 | CHECK_PARAMS_GT(weightDimH, 0L); | 853 | CHECK_PARAMS_GT(weightDimH, 0L); |
| @@ -932,11 +932,11 @@ private: | |||
| 932 | OP_LOGE(ACLNN_ERR_PARAM_INVALID, "check output value greater than 0 failed"); | 932 | OP_LOGE(ACLNN_ERR_PARAM_INVALID, "check output value greater than 0 failed"); |
| 933 | return ACLNN_ERR_PARAM_INVALID; | 933 | return ACLNN_ERR_PARAM_INVALID; |
| 934 | } | 934 | } |
| 935 | - auto inferedOutputShape = engine.CalcOutputShape(); | 935 | + auto inferredOutputShape = engine.CalcOutputShape(); |
| 936 | - for (size_t i = 0; i < inferedOutputShape.size(); i++) { | 936 | + for (size_t i = 0; i < inferredOutputShape.size(); i++) { |
| 937 | - if (inferedOutputShape[i] != outputShape[i]) { | 937 | + if (inferredOutputShape[i] != outputShape[i]) { |
| 938 | OP_LOGE(ACLNN_ERR_PARAM_INVALID, "expected output %zuth dim equal %ld, get %ld", i + 1, | 938 | OP_LOGE(ACLNN_ERR_PARAM_INVALID, "expected output %zuth dim equal %ld, get %ld", i + 1, |
| 939 | - inferedOutputShape[i], outputShape[i]); | 939 | + inferredOutputShape[i], outputShape[i]); |
| 940 | return ACLNN_ERR_PARAM_INVALID; | 940 | return ACLNN_ERR_PARAM_INVALID; |
| 941 | } | 941 | } |
| 942 | } | 942 | } |
| @@ -74,7 +74,7 @@ ACLNN_API aclnnStatus aclnnQuantConvolutionGetWorkspaceSize(const aclTensor* inp | |||
| 74 | const char* roundMode, aclTensor* output, | 74 | const char* roundMode, aclTensor* output, |
| 75 | uint64_t* workspaceSize, aclOpExecutor** executor); | 75 | uint64_t* workspaceSize, aclOpExecutor** executor); |
| 76 | /** | 76 | /** |
| 77 | - * @brief quant convolution接口,进行kernellaunch | 77 | + * @brief quant convolution接口,进行kernel launch |
| 78 | * | 78 | * |
| 79 | * @param [in] workspace: 在npu device侧申请的workspace内存起址。 | 79 | * @param [in] workspace: 在npu device侧申请的workspace内存起址。 |
| 80 | * @param [in] workspaceSize: 在npu device侧申请的workspace大小,由aclnnQuantConvolutionGetWorkspaceSize获取。 | 80 | * @param [in] workspaceSize: 在npu device侧申请的workspace大小,由aclnnQuantConvolutionGetWorkspaceSize获取。 |
| @@ -101,7 +101,7 @@ ACLNN_API aclnnStatus aclnnQuantConvolutionWeightNzGetWorkspaceSize(const aclTen | |||
| 101 | const char* roundMode, aclTensor* output, | 101 | const char* roundMode, aclTensor* output, |
| 102 | uint64_t* workspaceSize, aclOpExecutor** executor); | 102 | uint64_t* workspaceSize, aclOpExecutor** executor); |
| 103 | /** | 103 | /** |
| 104 | - * @brief quant convolution weightNz接口,进行kernellaunch | 104 | + * @brief quant convolution weightNz接口,进行kernel launch |
| 105 | * | 105 | * |
| 106 | * @param [in] workspace: 在npu device侧申请的workspace内存起址。 | 106 | * @param [in] workspace: 在npu device侧申请的workspace内存起址。 |
| 107 | * @param [in] workspaceSize: 在npu device侧申请的workspace大小,由aclnnQuantConvolutionWeightNzGetWorkspaceSize获取。 | 107 | * @param [in] workspaceSize: 在npu device侧申请的workspace大小,由aclnnQuantConvolutionWeightNzGetWorkspaceSize获取。 |
| @@ -102,7 +102,7 @@ const vector<vector<int64_t>> CONV2D_TRANSPOSE_V2_WHITE_LIST = | |||
| 102 | 4, 320, 80, 80, // input shape | 102 | 4, 320, 80, 80, // input shape |
| 103 | 320, 320, 3, 3, // filter shape | 103 | 320, 320, 3, 3, // filter shape |
| 104 | 4, 320, 80, 80, // outBackprop shape | 104 | 4, 320, 80, 80, // outBackprop shape |
| 105 | - 1, 1, // stide | 105 | + 1, 1, // stride |
| 106 | 1, 1, // padding | 106 | 1, 1, // padding |
| 107 | 1, 1, // dilation | 107 | 1, 1, // dilation |
| 108 | 0, 0, // output padding | 108 | 0, 0, // output padding |
| @@ -117,7 +117,7 @@ const vector<vector<int64_t>> CONV3D_TRANSPOSE_V2_WHITE_LIST = | |||
| 117 | 1, 256, 62, 66, 66, // input shape | 117 | 1, 256, 62, 66, 66, // input shape |
| 118 | 256, 256, 4, 4, 4, // filter shape | 118 | 256, 256, 4, 4, 4, // filter shape |
| 119 | 1, 256, 120, 128, 128, // outBackprop shape | 119 | 1, 256, 120, 128, 128, // outBackprop shape |
| 120 | - 2, 2, 2, // stide | 120 | + 2, 2, 2, // stride |
| 121 | 3, 3, 3, // padding | 121 | 3, 3, 3, // padding |
| 122 | 1, 1, 1, // dilation | 122 | 1, 1, 1, // dilation |
| 123 | 0, 0, 0, // output padding | 123 | 0, 0, 0, // output padding |
| @@ -473,17 +473,17 @@ static aclIntArray* ConstructConv2DNewStride(const aclTensor *input, const aclIn | |||
| 473 | 473 | ||
| 474 | static aclIntArray* ConstructConv2DNewDilation(const aclTensor *input, const aclIntArray *dilation, aclOpExecutor *executor) | 474 | static aclIntArray* ConstructConv2DNewDilation(const aclTensor *input, const aclIntArray *dilation, aclOpExecutor *executor) |
| 475 | { | 475 | { |
| 476 | - FVector<int64_t> newDalition; | 476 | + FVector<int64_t> newDilation; |
| 477 | if (dilation->Size() < DIM_2) { | 477 | if (dilation->Size() < DIM_2) { |
| 478 | - newDalition = {0}; | 478 | + newDilation = {0}; |
| 479 | - return executor->AllocIntArray(newDalition.data(), newDalition.size()); | 479 | + return executor->AllocIntArray(newDilation.data(), newDilation.size()); |
| 480 | } | 480 | } |
| 481 | if (input->GetOriginalFormat() == op::Format::FORMAT_NCHW) { | 481 | if (input->GetOriginalFormat() == op::Format::FORMAT_NCHW) { |
| 482 | - newDalition = {1, 1, (*dilation)[0], (*dilation)[1]}; | 482 | + newDilation = {1, 1, (*dilation)[0], (*dilation)[1]}; |
| 483 | } else { | 483 | } else { |
| 484 | - newDalition = {1, (*dilation)[0], (*dilation)[1], 1}; | 484 | + newDilation = {1, (*dilation)[0], (*dilation)[1], 1}; |
| 485 | } | 485 | } |
| 486 | - return executor->AllocIntArray(newDalition.data(), conv2dDimNum); | 486 | + return executor->AllocIntArray(newDilation.data(), conv2dDimNum); |
| 487 | } | 487 | } |
| 488 | 488 | ||
| 489 | static aclnnStatus Conv2dV2InferShapeAndAddLauncher(const aclTensor *input, const aclTensor *weight, | 489 | static aclnnStatus Conv2dV2InferShapeAndAddLauncher(const aclTensor *input, const aclTensor *weight, |
| @@ -632,14 +632,14 @@ static aclnnStatus Conv3dWithFlag(const aclTensor *input, const aclTensor *weigh | |||
| 632 | aclIntArray *dilation5; | 632 | aclIntArray *dilation5; |
| 633 | if (input->GetOriginalFormat() == op::Format::FORMAT_NCDHW) { | 633 | if (input->GetOriginalFormat() == op::Format::FORMAT_NCDHW) { |
| 634 | FVector<int64_t> newStrides{1, 1, (*stride)[0], (*stride)[1], (*stride)[2]}; | 634 | FVector<int64_t> newStrides{1, 1, (*stride)[0], (*stride)[1], (*stride)[2]}; |
| 635 | - FVector<int64_t> newDalition{1, 1, (*dilation)[0], (*dilation)[1], (*dilation)[2]}; | 635 | + FVector<int64_t> newDilation{1, 1, (*dilation)[0], (*dilation)[1], (*dilation)[2]}; |
| 636 | stride5 = executor->AllocIntArray(newStrides.data(), conv3dDimNum); | 636 | stride5 = executor->AllocIntArray(newStrides.data(), conv3dDimNum); |
| 637 | - dilation5 = executor->AllocIntArray(newDalition.data(), conv3dDimNum); | 637 | + dilation5 = executor->AllocIntArray(newDilation.data(), conv3dDimNum); |
| 638 | } else { | 638 | } else { |
| 639 | FVector<int64_t> newStrides{1, (*stride)[0], (*stride)[1], (*stride)[2], 1}; | 639 | FVector<int64_t> newStrides{1, (*stride)[0], (*stride)[1], (*stride)[2], 1}; |
| 640 | - FVector<int64_t> newDalition{1, (*dilation)[0], (*dilation)[1], (*dilation)[2], 1}; | 640 | + FVector<int64_t> newDilation{1, (*dilation)[0], (*dilation)[1], (*dilation)[2], 1}; |
| 641 | stride5 = executor->AllocIntArray(newStrides.data(), conv3dDimNum); | 641 | stride5 = executor->AllocIntArray(newStrides.data(), conv3dDimNum); |
| 642 | - dilation5 = executor->AllocIntArray(newDalition.data(), conv3dDimNum); | 642 | + dilation5 = executor->AllocIntArray(newDilation.data(), conv3dDimNum); |
| 643 | } | 643 | } |
| 644 | 644 | ||
| 645 | FVector<int64_t> newPad{(*padding)[0], (*padding)[0], (*padding)[1], (*padding)[1], (*padding)[2], (*padding)[2]}; | 645 | FVector<int64_t> newPad{(*padding)[0], (*padding)[0], (*padding)[1], (*padding)[1], (*padding)[2], (*padding)[2]}; |
| @@ -731,9 +731,9 @@ static aclnnStatus Conv3dv2WithFlag(const aclTensor *input, const aclTensor *wei | |||
| 731 | return ACLNN_ERR_INNER; | 731 | return ACLNN_ERR_INNER; |
| 732 | } | 732 | } |
| 733 | FVector<int64_t> newStrides{1, 1, (*stride)[0], (*stride)[1], (*stride)[2]}; | 733 | FVector<int64_t> newStrides{1, 1, (*stride)[0], (*stride)[1], (*stride)[2]}; |
| 734 | - FVector<int64_t> newDalition{1, 1, (*dilation)[0], (*dilation)[1], (*dilation)[2]}; | 734 | + FVector<int64_t> newDilation{1, 1, (*dilation)[0], (*dilation)[1], (*dilation)[2]}; |
| 735 | stride5 = executor->AllocIntArray(newStrides.data(), conv3dDimNum); | 735 | stride5 = executor->AllocIntArray(newStrides.data(), conv3dDimNum); |
| 736 | - dilation5 = executor->AllocIntArray(newDalition.data(), conv3dDimNum); | 736 | + dilation5 = executor->AllocIntArray(newDilation.data(), conv3dDimNum); |
| 737 | 737 | ||
| 738 | aclIntArray *pad6 = ConstructConv3DNewPad(padding, executor); | 738 | aclIntArray *pad6 = ConstructConv3DNewPad(padding, executor); |
| 739 | if (pad6->Size() != PAD_DIM_6) { | 739 | if (pad6->Size() != PAD_DIM_6) { |
| @@ -224,7 +224,7 @@ bool Conv2DSplitWInfo::CheckLoadL1InSplitW(const aclTensor* bias, aclTensor* out | |||
| 224 | return true; | 224 | return true; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | -aclIntArray* View2dAs3dForAttr(const aclIntArray* intArray, int64_t expendValue, aclOpExecutor* executor, bool isPad) | 227 | +aclIntArray* View2dAs3dForAttr(const aclIntArray* intArray, int64_t expandValue, aclOpExecutor* executor, bool isPad) |
| 228 | { | 228 | { |
| 229 | int64_t data[SplitWInfo::CONV3D_ATTR_NUM]; | 229 | int64_t data[SplitWInfo::CONV3D_ATTR_NUM]; |
| 230 | uint64_t size = intArray->Size(); | 230 | uint64_t size = intArray->Size(); |
| @@ -232,7 +232,7 @@ aclIntArray* View2dAs3dForAttr(const aclIntArray* intArray, int64_t expendValue, | |||
| 232 | if (!isPad && (size != static_cast<uint64_t>(SplitWInfo::CONV3D_ATTR_NUM - 1))) { | 232 | if (!isPad && (size != static_cast<uint64_t>(SplitWInfo::CONV3D_ATTR_NUM - 1))) { |
| 233 | return nullptr; | 233 | return nullptr; |
| 234 | } | 234 | } |
| 235 | - data[0] = expendValue; | 235 | + data[0] = expandValue; |
| 236 | data[1] = (*intArray)[0]; | 236 | data[1] = (*intArray)[0]; |
| 237 | if (isPad) { | 237 | if (isPad) { |
| 238 | data[SplitWInfo::W_INDEX_ATTR_CONV3D] = (*intArray)[SplitWInfo::LEFT_INDEX_ATTR]; | 238 | data[SplitWInfo::W_INDEX_ATTR_CONV3D] = (*intArray)[SplitWInfo::LEFT_INDEX_ATTR]; |
| @@ -272,12 +272,12 @@ const aclTensor* View4DSwapHWForTensor(const aclTensor* input, aclOpExecutor* ex | |||
| 272 | 272 | ||
| 273 | const aclTensor* View4dAs5dForInput(const aclTensor* input, aclOpExecutor* executor) | 273 | const aclTensor* View4dAs5dForInput(const aclTensor* input, aclOpExecutor* executor) |
| 274 | { | 274 | { |
| 275 | - // input NCHW->contigious->unsqueeze(2)->reformat NCDHW | 275 | + // input NCHW->contiguous->unsqueeze(2)->reformat NCDHW |
| 276 | - // 非连续转连续contigious | 276 | + // 非连续转连续contiguous |
| 277 | auto contiguousInput = l0op::Contiguous(input, executor); | 277 | auto contiguousInput = l0op::Contiguous(input, executor); |
| 278 | CHECK_RET(contiguousInput != nullptr, nullptr); | 278 | CHECK_RET(contiguousInput != nullptr, nullptr); |
| 279 | 279 | ||
| 280 | - // unsqeeze(2) | 280 | + // unsqueeze(2) |
| 281 | const int64_t appendDim[] = {SplitWInfo::HI_INDEX}; | 281 | const int64_t appendDim[] = {SplitWInfo::HI_INDEX}; |
| 282 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); | 282 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); |
| 283 | CHECK_RET(dim != nullptr, nullptr); | 283 | CHECK_RET(dim != nullptr, nullptr); |
| @@ -314,11 +314,11 @@ aclnnStatus ChangeConv2dInputToConv3d(const aclTensor* &input, const aclTensor* | |||
| 314 | 314 | ||
| 315 | const aclTensor* View5dAs4dForOutput(const aclTensor* input, aclOpExecutor* executor) | 315 | const aclTensor* View5dAs4dForOutput(const aclTensor* input, aclOpExecutor* executor) |
| 316 | { | 316 | { |
| 317 | - // input NCDHW->contigious->squeeze(2)->reformat NCHW | 317 | + // input NCDHW->contiguous->squeeze(2)->reformat NCHW |
| 318 | - // 非连续转连续contigious | 318 | + // 非连续转连续contiguous |
| 319 | auto contiguousInput = l0op::Contiguous(input, executor); | 319 | auto contiguousInput = l0op::Contiguous(input, executor); |
| 320 | CHECK_RET(contiguousInput != nullptr, nullptr); | 320 | CHECK_RET(contiguousInput != nullptr, nullptr); |
| 321 | - // sqeeze(2) | 321 | + // squeeze(2) |
| 322 | const int64_t appendDim[] = {SplitWInfo::HI_INDEX}; | 322 | const int64_t appendDim[] = {SplitWInfo::HI_INDEX}; |
| 323 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); | 323 | aclIntArray* dim = executor->AllocIntArray(appendDim, 1); |
| 324 | CHECK_RET(dim != nullptr, nullptr); | 324 | CHECK_RET(dim != nullptr, nullptr); |
| @@ -78,7 +78,7 @@ aclnnStatus ChangeConv2dAttrToConv3d(const aclIntArray* &stride, const aclIntArr | |||
| 78 | aclnnStatus ChangeConv2dInputToConv3d(const aclTensor* &input, const aclTensor* &weight, aclOpExecutor* executor); | 78 | aclnnStatus ChangeConv2dInputToConv3d(const aclTensor* &input, const aclTensor* &weight, aclOpExecutor* executor); |
| 79 | const aclTensor* View4dAs5dForInput(const aclTensor* input, aclOpExecutor* executor); | 79 | const aclTensor* View4dAs5dForInput(const aclTensor* input, aclOpExecutor* executor); |
| 80 | const aclTensor* View5dAs4dForOutput(const aclTensor* input, aclOpExecutor* executor); | 80 | const aclTensor* View5dAs4dForOutput(const aclTensor* input, aclOpExecutor* executor); |
| 81 | -aclIntArray* View2dAs3dForAttr(const aclIntArray* intArray, int64_t expendValue, aclOpExecutor* executor, bool isPad); | 81 | +aclIntArray* View2dAs3dForAttr(const aclIntArray* intArray, int64_t expandValue, aclOpExecutor* executor, bool isPad); |
| 82 | aclIntArray* View2DSwapHWForAttr(const aclIntArray* intArray, aclOpExecutor* executor); | 82 | aclIntArray* View2DSwapHWForAttr(const aclIntArray* intArray, aclOpExecutor* executor); |
| 83 | const aclTensor* View4DSwapHWForTensor(const aclTensor* input, aclOpExecutor* executor); | 83 | const aclTensor* View4DSwapHWForTensor(const aclTensor* input, aclOpExecutor* executor); |
| 84 | bool CheckDisContinuousStride(const aclTensor* input, const std::vector<int64_t>& newStrides, uint32_t dims); | 84 | bool CheckDisContinuousStride(const aclTensor* input, const std::vector<int64_t>& newStrides, uint32_t dims); |
| @@ -92,10 +92,10 @@ static aclnnStatus ExtendConv2dL0Inner(const aclTensor *input, const aclTensor * | |||
| 92 | aclIntArray *dilation4; | 92 | aclIntArray *dilation4; |
| 93 | aclIntArray *pad4; | 93 | aclIntArray *pad4; |
| 94 | FVector<int64_t> newStrides{1, 1, (*stride)[0], (*stride)[1]}; | 94 | FVector<int64_t> newStrides{1, 1, (*stride)[0], (*stride)[1]}; |
| 95 | - FVector<int64_t> newDilaition{1, 1, (*dilation)[0], (*dilation)[1]}; | 95 | + FVector<int64_t> newDilation{1, 1, (*dilation)[0], (*dilation)[1]}; |
| 96 | 96 | ||
| 97 | stride4 = executor->AllocIntArray(newStrides.data(), QUANT_CONV2D_DIM); | 97 | stride4 = executor->AllocIntArray(newStrides.data(), QUANT_CONV2D_DIM); |
| 98 | - dilation4 = executor->AllocIntArray(newDilaition.data(), QUANT_CONV2D_DIM); | 98 | + dilation4 = executor->AllocIntArray(newDilation.data(), QUANT_CONV2D_DIM); |
| 99 | pad4 = ConstructQuantConvNewPad(padding, executor); | 99 | pad4 = ConstructQuantConvNewPad(padding, executor); |
| 100 | if (pad4->Size() != QUANT_CONV2D_PAD_DIM_4) { | 100 | if (pad4->Size() != QUANT_CONV2D_PAD_DIM_4) { |
| 101 | OP_LOGE(ACLNN_ERR_INNER, "L0 func construct quant conv2d new pad failed."); | 101 | OP_LOGE(ACLNN_ERR_INNER, "L0 func construct quant conv2d new pad failed."); |
| @@ -147,9 +147,9 @@ static aclnnStatus QuantConv3dL0Inner(const aclTensor *input, const aclTensor *w | |||
| 147 | aclIntArray *dilation5; | 147 | aclIntArray *dilation5; |
| 148 | aclIntArray *pad6; | 148 | aclIntArray *pad6; |
| 149 | FVector<int64_t> newStrides{1, 1, (*stride)[0], (*stride)[1], (*stride)[2]}; | 149 | FVector<int64_t> newStrides{1, 1, (*stride)[0], (*stride)[1], (*stride)[2]}; |
| 150 | - FVector<int64_t> newDilaition{1, 1, (*dilation)[0], (*dilation)[1], (*dilation)[2]}; | 150 | + FVector<int64_t> newDilation{1, 1, (*dilation)[0], (*dilation)[1], (*dilation)[2]}; |
| 151 | stride5 = executor->AllocIntArray(newStrides.data(), QUANT_CONV3D_DIM); | 151 | stride5 = executor->AllocIntArray(newStrides.data(), QUANT_CONV3D_DIM); |
| 152 | - dilation5 = executor->AllocIntArray(newDilaition.data(), QUANT_CONV3D_DIM); | 152 | + dilation5 = executor->AllocIntArray(newDilation.data(), QUANT_CONV3D_DIM); |
| 153 | pad6 = ConstructQuantConvNewPad(padding, executor); | 153 | pad6 = ConstructQuantConvNewPad(padding, executor); |
| 154 | if (pad6->Size() != QUANT_CONV3D_PAD_DIM_6) { | 154 | if (pad6->Size() != QUANT_CONV3D_PAD_DIM_6) { |
| 155 | OP_LOGE(ACLNN_ERR_INNER, "L0 func construct quant conv3d new pad failed."); | 155 | OP_LOGE(ACLNN_ERR_INNER, "L0 func construct quant conv3d new pad failed."); |