已合并
【bugfix】清理cleancode问题 #3968
majiajian_hw创建于 7月10日
【bugfix】清理cleancode问题 #3968
已合并
majiajian_hw创建于 7月10日
3 个文件变更+7-5
@@ -60,7 +60,9 @@ static constexpr int64_t BLOCK_SIZE = 32;
60static constexpr size_t FRACTAL_NZ_C0_4B = 64;60static constexpr size_t FRACTAL_NZ_C0_4B = 64;
61static constexpr int64_t C0_SIZE = 16;61static constexpr int64_t C0_SIZE = 16;
62static constexpr int64_t N0_SIZE = 16;62static constexpr int64_t N0_SIZE = 16;
63+static constexpr int64_t NUM_ONE = 1;
63static constexpr int64_t NUM_SIXTEEN = 16;64static constexpr int64_t NUM_SIXTEEN = 16;
65+static constexpr int NUM_FOUR = 4;
64static constexpr const char* ACLNN_NAME = "aclnnNpuFormatCast";66static constexpr const char* ACLNN_NAME = "aclnnNpuFormatCast";
65 67 
66const std::set<std::pair<op::Format, op::Format>> kTransdataForwardFormatPairsRegBase = {68const std::set<std::pair<op::Format, op::Format>> kTransdataForwardFormatPairsRegBase = {
@@ -1196,8 +1198,8 @@ aclnnStatus aclnnNpuFormatCastGetWorkspaceSize(const aclTensor* srcTensor, aclTe
1196 }1198 }
1197 aclTensor* outTensor;1199 aclTensor* outTensor;
1198 int64_t dstDimNum = dstTensor->GetStorageShape().GetDimNum();1200 int64_t dstDimNum = dstTensor->GetStorageShape().GetDimNum();
1199- if (dstTensor->GetStorageShape().GetDim(dstDimNum - 1) == NUM_SIXTEEN &&1201+ if (dstTensor->GetStorageShape().GetDim(dstDimNum - NUM_ONE) == NUM_SIXTEEN &&
1200- ge::GetSizeByDataType(srcTensor->GetDataType()) >= 4 && !IsRegBase()) {1202+ ge::GetSizeByDataType(srcTensor->GetDataType()) >= NUM_FOUR && !IsRegBase()) {
1201 outTensor = const_cast<aclTensor*>(1203 outTensor = const_cast<aclTensor*>(
1202 l0op::TransDataSpecial(formatTensor, dstTensor->GetStorageFormat(), 1, uniqueExecutor.get()));1204 l0op::TransDataSpecial(formatTensor, dstTensor->GetStorageFormat(), 1, uniqueExecutor.get()));
1203 } else {1205 } else {
@@ -202,7 +202,7 @@ void PadV3GradReplicationTiling::CalcStrideAligned()
202 uint64_t rowSizeAligned = GetSizeOfBlockAlign(rowSize, blockSize_) / dataSize_;202 uint64_t rowSizeAligned = GetSizeOfBlockAlign(rowSize, blockSize_) / dataSize_;
203 203 
204 for (int64_t k = dimNum_ - NUM_TWO; k >= 0; k--) {204 for (int64_t k = dimNum_ - NUM_TWO; k >= 0; k--) {
205- if (k == dimNum_ - 2) {205+ if (k == dimNum_ - NUM_TWO) {
206 strideAligned_[k] = rowSizeAligned; // 中间维stride(行stride,blockSize对齐)206 strideAligned_[k] = rowSizeAligned; // 中间维stride(行stride,blockSize对齐)
207 } else {207 } else {
208 strideAligned_[k] = strideAligned_[k + 1] * outputShape_[k + 1];208 strideAligned_[k] = strideAligned_[k + 1] * outputShape_[k + 1];
@@ -186,7 +186,7 @@ static const aclTensor* normalDavidPath(const aclTensor* selfContiguous, int64_t
186 186 
187 // 调用normal_算子kernel function(AI Cpu算子)187 // 调用normal_算子kernel function(AI Cpu算子)
188 int64_t alg = 1;188 int64_t alg = 1;
189- auto algScalar = executor->AllocScalar(reinterpret_cast<void*>(&alg), DataType::DT_INT32);189+ auto algScalar = executor->AllocScalar(&alg, DataType::DT_INT32);
190 const aclTensor* algTensor = executor->ConvertToTensor(algScalar, op::ToOpDataType(ACL_INT32));190 const aclTensor* algTensor = executor->ConvertToTensor(algScalar, op::ToOpDataType(ACL_INT32));
191 auto stateLessOut = l0op::StatelessRandomNormalV2(selfContiguous, keyArr, counterArr, algTensor, executor);191 auto stateLessOut = l0op::StatelessRandomNormalV2(selfContiguous, keyArr, counterArr, algTensor, executor);
192 return normalDoublePath(selfContiguous, stateLessOut, mean, std, executor);192 return normalDoublePath(selfContiguous, stateLessOut, mean, std, executor);
@@ -237,7 +237,7 @@ static const aclTensor* normalTensorDavidPath(const aclTensor* selfContiguous, c
237 CHECK_RET(resultAddOut != nullptr, nullptr);237 CHECK_RET(resultAddOut != nullptr, nullptr);
238 238 
239 int64_t alg = 1;239 int64_t alg = 1;
240- auto algScalar = executor->AllocScalar(reinterpret_cast<void*>(&alg), DataType::DT_INT32);240+ auto algScalar = executor->AllocScalar(&alg, DataType::DT_INT32);
241 const aclTensor* algTensor = executor->ConvertToTensor(algScalar, op::ToOpDataType(ACL_INT32));241 const aclTensor* algTensor = executor->ConvertToTensor(algScalar, op::ToOpDataType(ACL_INT32));
242 auto stateLessOut = l0op::StatelessRandomNormalV2(selfContiguous, normalSeedU64, resultAddOut, algTensor,242 auto stateLessOut = l0op::StatelessRandomNormalV2(selfContiguous, normalSeedU64, resultAddOut, algTensor,
243 executor);243 executor);