已合并
adaptivemaxpool3dgradxA5上性能问题修复 #6799
胡一航创建于 6月30日
adaptivemaxpool3dgradxA5上性能问题修复 #6799
已合并
共 1 个文件变更+2-4
| @@ -19,7 +19,6 @@ using namespace AdaptiveMaxPool3dGradOp; | |||
| 19 | namespace optiling { | 19 | namespace optiling { |
| 20 | 20 | ||
| 21 | static constexpr uint64_t DCACHE_SIZE = 128 * 1024UL; | 21 | static constexpr uint64_t DCACHE_SIZE = 128 * 1024UL; |
| 22 | -static constexpr int64_t MAX_THREAD_NUM = 1024; | ||
| 23 | 22 | ||
| 24 | bool AdaptiveMaxPool3dGradTilingSimt::IsCapable() | 23 | bool AdaptiveMaxPool3dGradTilingSimt::IsCapable() |
| 25 | { | 24 | { |
| @@ -51,11 +50,10 @@ ge::graphStatus AdaptiveMaxPool3dGradTilingSimt::PostTiling() | |||
| 51 | blockNum = Ops::Base::CeilDiv(totalNC, detThreadDim); | 50 | blockNum = Ops::Base::CeilDiv(totalNC, detThreadDim); |
| 52 | } else { | 51 | } else { |
| 53 | int64_t outDataCount = inputData.nX * inputData.cX * inputData.dGrad * inputData.hGrad * inputData.wGrad; | 52 | int64_t outDataCount = inputData.nX * inputData.cX * inputData.dGrad * inputData.hGrad * inputData.wGrad; |
| 54 | - int64_t threads = std::min(outDataCount, MAX_THREAD_NUM); | 53 | + blockNum = (outDataCount == 0) ? 1 : std::min(outDataCount, static_cast<int64_t>(coreNum_)); |
| 55 | - blockNum = Ops::Base::CeilDiv(outDataCount, threads); | ||
| 56 | } | 54 | } |
| 57 | - blockNum = std::max(blockNum, static_cast<int64_t>(1)); | ||
| 58 | blockNum = std::min(blockNum, static_cast<int64_t>(coreNum_)); | 55 | blockNum = std::min(blockNum, static_cast<int64_t>(coreNum_)); |
| 56 | + blockNum = std::max(blockNum, static_cast<int64_t>(1)); | ||
| 59 | context_->SetBlockDim(blockNum); | 57 | context_->SetBlockDim(blockNum); |
| 60 | context_->SetLocalMemorySize(ubSize_ - DCACHE_SIZE); | 58 | context_->SetLocalMemorySize(ubSize_ - DCACHE_SIZE); |
| 61 | return ge::GRAPH_SUCCESS; | 59 | return ge::GRAPH_SUCCESS; |