已合并
fix: 修复Remainder/Greater/Equal/IsIn报错dtype支持列表双层中括号 #5512
hahaha22创建于 9月9日
fix: 修复Remainder/Greater/Equal/IsIn报错dtype支持列表双层中括号 #5512
已合并
共 5 个文件变更+64-78
| @@ -46,7 +46,7 @@ static const std::initializer_list<op::DataType> REGBASE_DTYPE_SUPPORT_LIST = { | |||
| 46 | op::DataType::DT_DOUBLE, op::DataType::DT_COMPLEX64, op::DataType::DT_COMPLEX128, op::DataType::DT_BF16, | 46 | op::DataType::DT_DOUBLE, op::DataType::DT_COMPLEX64, op::DataType::DT_COMPLEX128, op::DataType::DT_BF16, |
| 47 | op::DataType::DT_UINT64}; | 47 | op::DataType::DT_UINT64}; |
| 48 | 48 | ||
| 49 | -//其他output支持的类型 | 49 | +// 其他output支持的类型 |
| 50 | static const std::initializer_list<op::DataType> OUT_DTYPE_SUPPORT_910_LIST = { | 50 | static const std::initializer_list<op::DataType> OUT_DTYPE_SUPPORT_910_LIST = { |
| 51 | op::DataType::DT_FLOAT, op::DataType::DT_INT32, op::DataType::DT_INT64, op::DataType::DT_FLOAT16, | 51 | op::DataType::DT_FLOAT, op::DataType::DT_INT32, op::DataType::DT_INT64, op::DataType::DT_FLOAT16, |
| 52 | op::DataType::DT_INT16, op::DataType::DT_INT8, op::DataType::DT_UINT8, op::DataType::DT_UINT64, | 52 | op::DataType::DT_INT16, op::DataType::DT_INT8, op::DataType::DT_UINT8, op::DataType::DT_UINT64, |
| @@ -236,9 +236,7 @@ static bool CheckDtypeValid(const aclTensor* self, const aclScalar* other, const | |||
| 236 | OP_CHECK_DTYPE_NOT_SUPPORT(other, dtypeSupportList, return false); | 236 | OP_CHECK_DTYPE_NOT_SUPPORT(other, dtypeSupportList, return false); |
| 237 | 237 | ||
| 238 | auto npuArch = op::GetCurrentPlatformInfo().GetCurNpuArch(); | 238 | auto npuArch = op::GetCurrentPlatformInfo().GetCurNpuArch(); |
| 239 | - auto outSuportList = IsRegBase(npuArch) ? | 239 | + auto outSuportList = IsRegBase(npuArch) ? GetOutputDtypeSupportList() : dtypeSupportList; |
H | |||
| 240 | - GetOutputDtypeSupportList() : | ||
| 241 | - dtypeSupportList; | ||
| 242 | // 检查out的数据类型 | 240 | // 检查out的数据类型 |
| 243 | OP_CHECK_DTYPE_NOT_SUPPORT(out, outSuportList, return false); | 241 | OP_CHECK_DTYPE_NOT_SUPPORT(out, outSuportList, return false); |
| 244 | 242 | ||
| @@ -255,18 +253,16 @@ static bool CheckPromoteType(const aclTensor* self, const aclScalar* other, cons | |||
| 255 | auto inputSupportList = GetInputDtypeSupportList(); | 253 | auto inputSupportList = GetInputDtypeSupportList(); |
| 256 | // 检查self的数据类型是否在Equal算子的支持列表内 | 254 | // 检查self的数据类型是否在Equal算子的支持列表内 |
| 257 | if (!CheckType(promoteType, inputSupportList)) { | 255 | if (!CheckType(promoteType, inputSupportList)) { |
| 258 | - OP_LOGE( | 256 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "promote dtype %s should be in dtype support list %s.", |
| 259 | - ACLNN_ERR_PARAM_INVALID, "promote dtype %s should be in dtype support list [%s].", | 257 | + op::ToString(promoteType).GetString(), op::ToString(inputSupportList).GetString()); |
| 260 | - op::ToString(promoteType).GetString(), op::ToString(inputSupportList).GetString()); | ||
| 261 | return false; | 258 | return false; |
| 262 | } | 259 | } |
| 263 | } else { | 260 | } else { |
| 264 | promoteType = op::PromoteType(self->GetDataType(), other->GetDataType()); | 261 | promoteType = op::PromoteType(self->GetDataType(), other->GetDataType()); |
| 265 | } | 262 | } |
| 266 | if (promoteType == DataType::DT_UNDEFINED) { | 263 | if (promoteType == DataType::DT_UNDEFINED) { |
| 267 | - OP_LOGE( | 264 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Self dtype %s and other dtype %s can not promote dtype.", |
| 268 | - ACLNN_ERR_PARAM_INVALID, "Self dtype %s and other dtype %s can not promote dtype.", | 265 | + op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString()); |
| 269 | - op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString()); | ||
| 270 | return false; | 266 | return false; |
| 271 | } | 267 | } |
| 272 | 268 | ||
| @@ -308,8 +304,8 @@ static aclnnStatus CheckParams(const aclTensor* self, const aclScalar* other, co | |||
| 308 | return ACLNN_SUCCESS; | 304 | return ACLNN_SUCCESS; |
| 309 | } | 305 | } |
| 310 | 306 | ||
| 311 | -aclnnStatus aclnnEqScalarGetWorkspaceSize( | 307 | +aclnnStatus aclnnEqScalarGetWorkspaceSize(const aclTensor* self, const aclScalar* other, aclTensor* out, |
| 312 | - const aclTensor* self, const aclScalar* other, aclTensor* out, uint64_t* workspaceSize, aclOpExecutor** executor) | 308 | + uint64_t* workspaceSize, aclOpExecutor** executor) |
| 313 | { | 309 | { |
| 314 | L2_DFX_PHASE_1(aclnnEqScalar, DFX_IN(self, other), DFX_OUT(out)); | 310 | L2_DFX_PHASE_1(aclnnEqScalar, DFX_IN(self, other), DFX_OUT(out)); |
| 315 | // 固定写法,创建OpExecutor | 311 | // 固定写法,创建OpExecutor |
| @@ -357,8 +353,8 @@ aclnnStatus aclnnEqScalarGetWorkspaceSize( | |||
| 357 | return ACLNN_SUCCESS; | 353 | return ACLNN_SUCCESS; |
| 358 | } | 354 | } |
| 359 | 355 | ||
| 360 | -aclnnStatus aclnnInplaceEqScalarGetWorkspaceSize( | 356 | +aclnnStatus aclnnInplaceEqScalarGetWorkspaceSize(const aclTensor* selfRef, const aclScalar* other, |
| 361 | - const aclTensor* selfRef, const aclScalar* other, uint64_t* workspaceSize, aclOpExecutor** executor) | 357 | + uint64_t* workspaceSize, aclOpExecutor** executor) |
| 362 | { | 358 | { |
| 363 | auto out = const_cast<aclTensor*>(selfRef); | 359 | auto out = const_cast<aclTensor*>(selfRef); |
| 364 | return aclnnEqScalarGetWorkspaceSize(selfRef, other, out, workspaceSize, executor); | 360 | return aclnnEqScalarGetWorkspaceSize(selfRef, other, out, workspaceSize, executor); |
| @@ -161,20 +161,18 @@ static bool CheckDtypeValid(const aclTensor* self, const aclTensor* other, const | |||
| 161 | promoteType = op::PromoteType(self->GetDataType(), other->GetDataType()); | 161 | promoteType = op::PromoteType(self->GetDataType(), other->GetDataType()); |
| 162 | } | 162 | } |
| 163 | if (promoteType == DataType::DT_UNDEFINED) { | 163 | if (promoteType == DataType::DT_UNDEFINED) { |
| 164 | - OP_LOGE( | 164 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Self dtype %s and other dtype %s can not promote dtype.", |
| 165 | - ACLNN_ERR_PARAM_INVALID, "Self dtype %s and other dtype %s can not promote dtype.", | 165 | + op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString()); |
| 166 | - op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString()); | ||
| 167 | return false; | 166 | return false; |
| 168 | } | 167 | } |
| 169 | 168 | ||
| 170 | // 检查promoteType的数据类型是否在equal算子的支持列表内 | 169 | // 检查promoteType的数据类型是否在equal算子的支持列表内 |
| 171 | if (!CheckType(promoteType, inputSupportList)) { | 170 | if (!CheckType(promoteType, inputSupportList)) { |
| 172 | - OP_LOGE( | 171 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, |
| 173 | - ACLNN_ERR_PARAM_INVALID, | 172 | + "Self dtype %s and other dtype %s get promoteType dtype %s should be in " |
| 174 | - "Self dtype %s and other dtype %s get promoteType dtype %s should be in " | 173 | + "dtype support list %s.", |
| 175 | - "dtype support list [%s].", | 174 | + op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString(), |
| 176 | - op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString(), | 175 | + op::ToString(promoteType).GetString(), op::ToString(inputSupportList).GetString()); |
| 177 | - op::ToString(promoteType).GetString(), op::ToString(inputSupportList).GetString()); | ||
| 178 | return false; | 176 | return false; |
| 179 | } | 177 | } |
| 180 | 178 | ||
| @@ -194,16 +192,15 @@ static bool CheckShape(const aclTensor* self, const aclTensor* other, const aclT | |||
| 194 | OP_CHECK_BROADCAST_AND_INFER_SHAPE(self, other, outShape, return false); | 192 | OP_CHECK_BROADCAST_AND_INFER_SHAPE(self, other, outShape, return false); |
| 195 | 193 | ||
| 196 | if (outShape != out->GetViewShape()) { | 194 | if (outShape != out->GetViewShape()) { |
| 197 | - OP_LOGE( | 195 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "BroadcastShape %s is not equal out's shape %s.", |
| 198 | - ACLNN_ERR_PARAM_INVALID, "BroadcastShape %s is not equal out's shape %s.", | 196 | + op::ToString(outShape).GetString(), op::ToString(out->GetViewShape()).GetString()); |
| 199 | - op::ToString(outShape).GetString(), op::ToString(out->GetViewShape()).GetString()); | ||
| 200 | return false; | 197 | return false; |
| 201 | } | 198 | } |
| 202 | return true; | 199 | return true; |
| 203 | } | 200 | } |
| 204 | 201 | ||
| 205 | -static aclnnStatus CheckParams( | 202 | +static aclnnStatus CheckParams(const aclTensor* self, const aclTensor* other, const aclTensor* out, |
| 206 | - const aclTensor* self, const aclTensor* other, const aclTensor* out, DataType& promoteType) | 203 | + DataType& promoteType) |
| 207 | { | 204 | { |
| 208 | // 1. 检查输入的数据类型是否在API支持的数据类型范围之内,需要根据api定义校验 | 205 | // 1. 检查输入的数据类型是否在API支持的数据类型范围之内,需要根据api定义校验 |
| 209 | CHECK_RET(CheckDtypeValid(self, other, out, promoteType), ACLNN_ERR_PARAM_INVALID); | 206 | CHECK_RET(CheckDtypeValid(self, other, out, promoteType), ACLNN_ERR_PARAM_INVALID); |
| @@ -214,8 +211,8 @@ static aclnnStatus CheckParams( | |||
| 214 | return ACLNN_SUCCESS; | 211 | return ACLNN_SUCCESS; |
| 215 | } | 212 | } |
| 216 | 213 | ||
| 217 | -aclnnStatus aclnnEqTensorGetWorkspaceSize( | 214 | +aclnnStatus aclnnEqTensorGetWorkspaceSize(const aclTensor* self, const aclTensor* other, aclTensor* out, |
| 218 | - const aclTensor* self, const aclTensor* other, aclTensor* out, uint64_t* workspaceSize, aclOpExecutor** executor) | 215 | + uint64_t* workspaceSize, aclOpExecutor** executor) |
| 219 | { | 216 | { |
| 220 | L2_DFX_PHASE_1(aclnnEqTensor, DFX_IN(self, other), DFX_OUT(out)); | 217 | L2_DFX_PHASE_1(aclnnEqTensor, DFX_IN(self, other), DFX_OUT(out)); |
| 221 | 218 | ||
| @@ -280,21 +277,18 @@ static inline aclnnStatus CheckInplace(const aclTensor* selfRef, const aclTensor | |||
| 280 | op::Shape broadcastShape; | 277 | op::Shape broadcastShape; |
| 281 | OP_CHECK( | 278 | OP_CHECK( |
| 282 | BroadcastInferShape(selfRef->GetViewShape(), other->GetViewShape(), broadcastShape), | 279 | BroadcastInferShape(selfRef->GetViewShape(), other->GetViewShape(), broadcastShape), |
| 283 | - OP_LOGE( | 280 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Shape of selfRef and other can't broadcast, got %s, %s.", |
| 284 | - ACLNN_ERR_PARAM_INVALID, "Shape of selfRef and other can't broadcast, got %s, %s.", | 281 | + op::ToString(selfRef->GetViewShape()).GetString(), op::ToString(other->GetViewShape()).GetString()), |
| 285 | - op::ToString(selfRef->GetViewShape()).GetString(), op::ToString(other->GetViewShape()).GetString()), | ||
| 286 | - return ACLNN_ERR_PARAM_INVALID); | ||
| 287 | - OP_CHECK( | ||
| 288 | - selfRef->GetViewShape() == broadcastShape, | ||
| 289 | - OP_LOGE( | ||
| 290 | - ACLNN_ERR_PARAM_NULLPTR, "Expected shape of selfRef should be %s, but got %s.", | ||
| 291 | - op::ToString(broadcastShape).GetString(), op::ToString(selfRef->GetViewShape()).GetString()), | ||
| 292 | return ACLNN_ERR_PARAM_INVALID); | 282 | return ACLNN_ERR_PARAM_INVALID); |
| 283 | + OP_CHECK(selfRef->GetViewShape() == broadcastShape, | ||
| 284 | + OP_LOGE(ACLNN_ERR_PARAM_NULLPTR, "Expected shape of selfRef should be %s, but got %s.", | ||
| 285 | + op::ToString(broadcastShape).GetString(), op::ToString(selfRef->GetViewShape()).GetString()), | ||
| 286 | + return ACLNN_ERR_PARAM_INVALID); | ||
| 293 | return ACLNN_SUCCESS; | 287 | return ACLNN_SUCCESS; |
| 294 | } | 288 | } |
| 295 | 289 | ||
| 296 | -aclnnStatus aclnnInplaceEqTensorGetWorkspaceSize( | 290 | +aclnnStatus aclnnInplaceEqTensorGetWorkspaceSize(const aclTensor* selfRef, const aclTensor* other, |
| 297 | - const aclTensor* selfRef, const aclTensor* other, uint64_t* workspaceSize, aclOpExecutor** executor) | 291 | + uint64_t* workspaceSize, aclOpExecutor** executor) |
| 298 | { | 292 | { |
| 299 | auto ret = CheckInplace(selfRef, other); | 293 | auto ret = CheckInplace(selfRef, other); |
| 300 | CHECK_RET(ret == ACLNN_SUCCESS, ret); | 294 | CHECK_RET(ret == ACLNN_SUCCESS, ret); |
| @@ -148,20 +148,18 @@ static bool CheckDtypeValid(const aclTensor* element, const aclScalar* testEleme | |||
| 148 | // 检查element和testElement能否做数据类型推导 | 148 | // 检查element和testElement能否做数据类型推导 |
| 149 | op::DataType promoteType = PromoteTypeScalar(element, testElement); | 149 | op::DataType promoteType = PromoteTypeScalar(element, testElement); |
| 150 | if (promoteType == DataType::DT_UNDEFINED) { | 150 | if (promoteType == DataType::DT_UNDEFINED) { |
| 151 | - OP_LOGE( | 151 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "element dtype %s and testElement dtype %s can not promote dtype.", |
| 152 | - ACLNN_ERR_PARAM_INVALID, "element dtype %s and testElement dtype %s can not promote dtype.", | 152 | + op::ToString(element->GetDataType()).GetString(), op::ToString(testElement->GetDataType()).GetString()); |
| 153 | - op::ToString(element->GetDataType()).GetString(), op::ToString(testElement->GetDataType()).GetString()); | ||
| 154 | return false; | 153 | return false; |
| 155 | } | 154 | } |
| 156 | 155 | ||
| 157 | // 检查promoteType的数据类型是否在equal算子的支持列表内 | 156 | // 检查promoteType的数据类型是否在equal算子的支持列表内 |
| 158 | if (!CheckType(promoteType, supportList)) { | 157 | if (!CheckType(promoteType, supportList)) { |
| 159 | - OP_LOGE( | 158 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, |
| 160 | - ACLNN_ERR_PARAM_INVALID, | 159 | + "element dtype %s and testElement dtype %s get promoteType dtype %s should be in " |
| 161 | - "element dtype %s and testElement dtype %s get promoteType dtype %s should be in " | 160 | + "dtype support list %s.", |
| 162 | - "dtype support list [%s].", | 161 | + op::ToString(element->GetDataType()).GetString(), op::ToString(testElement->GetDataType()).GetString(), |
| 163 | - op::ToString(element->GetDataType()).GetString(), op::ToString(testElement->GetDataType()).GetString(), | 162 | + op::ToString(promoteType).GetString(), op::ToString(supportList).GetString()); |
| 164 | - op::ToString(promoteType).GetString(), op::ToString(supportList).GetString()); | ||
| 165 | return false; | 163 | return false; |
| 166 | } | 164 | } |
| 167 | 165 | ||
| @@ -190,9 +188,9 @@ static aclnnStatus CheckParams(const aclTensor* element, const aclScalar* testEl | |||
| 190 | return ACLNN_SUCCESS; | 188 | return ACLNN_SUCCESS; |
| 191 | } | 189 | } |
| 192 | 190 | ||
| 193 | -aclnnStatus aclnnIsInTensorScalarGetWorkspaceSize( | 191 | +aclnnStatus aclnnIsInTensorScalarGetWorkspaceSize(const aclTensor* element, const aclScalar* testElement, |
| 194 | - const aclTensor* element, const aclScalar* testElement, [[maybe_unused]] bool assumeUnique, bool invert, | 192 | + [[maybe_unused]] bool assumeUnique, bool invert, aclTensor* out, |
| 195 | - aclTensor* out, uint64_t* workspaceSize, aclOpExecutor** executor) | 193 | + uint64_t* workspaceSize, aclOpExecutor** executor) |
| 196 | { | 194 | { |
| 197 | L2_DFX_PHASE_1(aclnnIsInTensorScalar, DFX_IN(element, testElement), DFX_OUT(out)); | 195 | L2_DFX_PHASE_1(aclnnIsInTensorScalar, DFX_IN(element, testElement), DFX_OUT(out)); |
| 198 | 196 | ||
| @@ -190,7 +190,7 @@ static bool CheckPromoteType(const op::DataType selfDtype, const op::DataType ot | |||
| 190 | return false; | 190 | return false; |
| 191 | } | 191 | } |
| 192 | if (!CheckType(promoteType, DTYPE_SUPPORT_LIST)) { | 192 | if (!CheckType(promoteType, DTYPE_SUPPORT_LIST)) { |
| 193 | - OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Promote type %s should be in dtype support list [%s].", | 193 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Promote type %s should be in dtype support list %s.", |
| 194 | op::ToString(promoteType).GetString(), op::ToString(DTYPE_SUPPORT_LIST).GetString()); | 194 | op::ToString(promoteType).GetString(), op::ToString(DTYPE_SUPPORT_LIST).GetString()); |
| 195 | return false; | 195 | return false; |
| 196 | } | 196 | } |
| @@ -220,7 +220,7 @@ static bool CheckPromoteTypeTensorScalar(const op::DataType selfDtype, const op: | |||
| 220 | return false; | 220 | return false; |
| 221 | } | 221 | } |
| 222 | if (!CheckType(castDtype, DTYPE_SUPPORT_LIST)) { | 222 | if (!CheckType(castDtype, DTYPE_SUPPORT_LIST)) { |
| 223 | - OP_LOGE(ACLNN_ERR_PARAM_INVALID, "expected dtype %s should be in dtype support list [%s].", | 223 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "expected dtype %s should be in dtype support list %s.", |
| 224 | op::ToString(castDtype).GetString(), op::ToString(DTYPE_SUPPORT_LIST).GetString()); | 224 | op::ToString(castDtype).GetString(), op::ToString(DTYPE_SUPPORT_LIST).GetString()); |
| 225 | return false; | 225 | return false; |
| 226 | } | 226 | } |
| @@ -252,7 +252,7 @@ static bool CheckPromoteTypeScalarTensor(const op::DataType selfDtype, const op: | |||
| 252 | return false; | 252 | return false; |
| 253 | } | 253 | } |
| 254 | if (!CheckType(outDtype, DTYPE_SUPPORT_LIST)) { | 254 | if (!CheckType(outDtype, DTYPE_SUPPORT_LIST)) { |
| 255 | - OP_LOGE(ACLNN_ERR_PARAM_INVALID, "out dtype %s should be in dtype support list [%s].", | 255 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "out dtype %s should be in dtype support list %s.", |
| 256 | op::ToString(outDtype).GetString(), op::ToString(DTYPE_SUPPORT_LIST).GetString()); | 256 | op::ToString(outDtype).GetString(), op::ToString(DTYPE_SUPPORT_LIST).GetString()); |
| 257 | return false; | 257 | return false; |
| 258 | } | 258 | } |
| @@ -90,10 +90,11 @@ static bool CheckDtypeValid(const aclTensor* self, const aclTensor* other, const | |||
| 90 | { | 90 | { |
| 91 | auto npuArch = op::GetCurrentPlatformInfo().GetCurNpuArch(); | 91 | auto npuArch = op::GetCurrentPlatformInfo().GetCurNpuArch(); |
| 92 | bool is910bSocVersion = (npuArch == NpuArch::DAV_2201 || IsRegBase(npuArch)); | 92 | bool is910bSocVersion = (npuArch == NpuArch::DAV_2201 || IsRegBase(npuArch)); |
| 93 | - const std::initializer_list<op::DataType> CURRENT_DTYPE_SUPPORT_LIST = | 93 | + const std::initializer_list<op::DataType> CURRENT_DTYPE_SUPPORT_LIST = is910bSocVersion ? DTYPE_SUPPORT_910B_LIST : |
| 94 | - is910bSocVersion ? DTYPE_SUPPORT_910B_LIST : DTYPE_SUPPORT_910_LIST; | 94 | + DTYPE_SUPPORT_910_LIST; |
| 95 | - const std::initializer_list<op::DataType> CURRENT_OUT_DTYPE_SUPPORT_LIST = | 95 | + const std::initializer_list<op::DataType> CURRENT_OUT_DTYPE_SUPPORT_LIST = is910bSocVersion ? |
| 96 | - is910bSocVersion ? OUT_DTYPE_SUPPORT_910B_LIST : OUT_DTYPE_SUPPORT_910_LIST; | 96 | + OUT_DTYPE_SUPPORT_910B_LIST : |
| 97 | + OUT_DTYPE_SUPPORT_910_LIST; | ||
| 97 | 98 | ||
| 98 | // 检查out的数据类型是否在Greater算子的支持列表内 | 99 | // 检查out的数据类型是否在Greater算子的支持列表内 |
| 99 | OP_CHECK_DTYPE_NOT_SUPPORT(out, CURRENT_OUT_DTYPE_SUPPORT_LIST, return false); | 100 | OP_CHECK_DTYPE_NOT_SUPPORT(out, CURRENT_OUT_DTYPE_SUPPORT_LIST, return false); |
| @@ -117,20 +118,18 @@ static bool CheckDtypeValid(const aclTensor* self, const aclTensor* other, const | |||
| 117 | } | 118 | } |
| 118 | 119 | ||
| 119 | if (promoteType == DataType::DT_UNDEFINED) { | 120 | if (promoteType == DataType::DT_UNDEFINED) { |
| 120 | - OP_LOGE( | 121 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "Self dtype %s and other dtype %s can not promote dtype.", |
| 121 | - ACLNN_ERR_PARAM_INVALID, "Self dtype %s and other dtype %s can not promote dtype.", | 122 | + op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString()); |
| 122 | - op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString()); | ||
| 123 | return false; | 123 | return false; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | // 检查promoteType的数据类型是否在Greater算子的支持列表内 | 126 | // 检查promoteType的数据类型是否在Greater算子的支持列表内 |
| 127 | if (!CheckType(promoteType, CURRENT_DTYPE_SUPPORT_LIST)) { | 127 | if (!CheckType(promoteType, CURRENT_DTYPE_SUPPORT_LIST)) { |
| 128 | - OP_LOGE( | 128 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, |
| 129 | - ACLNN_ERR_PARAM_INVALID, | 129 | + "Self dtype %s and other dtype %s get promoteType dtype %s should be in " |
| 130 | - "Self dtype %s and other dtype %s get promoteType dtype %s should be in " | 130 | + "dtype support list %s.", |
| 131 | - "dtype support list [%s].", | 131 | + op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString(), |
| 132 | - op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString(), | 132 | + op::ToString(promoteType).GetString(), op::ToString(CURRENT_DTYPE_SUPPORT_LIST).GetString()); |
| 133 | - op::ToString(promoteType).GetString(), op::ToString(CURRENT_DTYPE_SUPPORT_LIST).GetString()); | ||
| 134 | return false; | 133 | return false; |
| 135 | } | 134 | } |
| 136 | if (IsRegBase(npuArch)) { | 135 | if (IsRegBase(npuArch)) { |
| @@ -155,16 +154,15 @@ static bool CheckShape(const aclTensor* self, const aclTensor* other, const aclT | |||
| 155 | OP_CHECK_BROADCAST_AND_INFER_SHAPE(self, other, outShape, return false); | 154 | OP_CHECK_BROADCAST_AND_INFER_SHAPE(self, other, outShape, return false); |
| 156 | 155 | ||
| 157 | if (outShape != out->GetViewShape()) { | 156 | if (outShape != out->GetViewShape()) { |
| 158 | - OP_LOGE( | 157 | + OP_LOGE(ACLNN_ERR_PARAM_INVALID, "BroadcastShape %s is not equal out's shape %s.", |
| 159 | - ACLNN_ERR_PARAM_INVALID, "BroadcastShape %s is not equal out's shape %s.", | 158 | + op::ToString(outShape).GetString(), op::ToString(out->GetViewShape()).GetString()); |
| 160 | - op::ToString(outShape).GetString(), op::ToString(out->GetViewShape()).GetString()); | ||
| 161 | return false; | 159 | return false; |
| 162 | } | 160 | } |
| 163 | return true; | 161 | return true; |
| 164 | } | 162 | } |
| 165 | 163 | ||
| 166 | -static aclnnStatus CheckParams4Gt( | 164 | +static aclnnStatus CheckParams4Gt(const aclTensor* self, const aclTensor* other, const aclTensor* out, |
| 167 | - const aclTensor* self, const aclTensor* other, const aclTensor* out, DataType& promoteType) | 165 | + DataType& promoteType) |
| 168 | { | 166 | { |
| 169 | // 1. 检查输入的数据类型是否在API支持的数据类型范围之内,需要根据api定义校验 | 167 | // 1. 检查输入的数据类型是否在API支持的数据类型范围之内,需要根据api定义校验 |
| 170 | CHECK_RET(CheckDtypeValid(self, other, out, promoteType), ACLNN_ERR_PARAM_INVALID); | 168 | CHECK_RET(CheckDtypeValid(self, other, out, promoteType), ACLNN_ERR_PARAM_INVALID); |
| @@ -175,8 +173,8 @@ static aclnnStatus CheckParams4Gt( | |||
| 175 | return ACLNN_SUCCESS; | 173 | return ACLNN_SUCCESS; |
| 176 | } | 174 | } |
| 177 | 175 | ||
| 178 | -aclnnStatus aclnnGtTensorGetWorkspaceSize( | 176 | +aclnnStatus aclnnGtTensorGetWorkspaceSize(const aclTensor* self, const aclTensor* other, aclTensor* out, |
| 179 | - const aclTensor* self, const aclTensor* other, aclTensor* out, uint64_t* workspaceSize, aclOpExecutor** executor) | 177 | + uint64_t* workspaceSize, aclOpExecutor** executor) |
| 180 | { | 178 | { |
| 181 | L2_DFX_PHASE_1(aclnnGtTensor, DFX_IN(self, other), DFX_OUT(out)); | 179 | L2_DFX_PHASE_1(aclnnGtTensor, DFX_IN(self, other), DFX_OUT(out)); |
| 182 | // 固定写法,创建OpExecutor | 180 | // 固定写法,创建OpExecutor |
| @@ -239,8 +237,8 @@ aclnnStatus aclnnGtTensor(void* workspace, uint64_t workspaceSize, aclOpExecutor | |||
| 239 | return CommonOpExecutorRun(workspace, workspaceSize, executor, stream); | 237 | return CommonOpExecutorRun(workspace, workspaceSize, executor, stream); |
| 240 | } | 238 | } |
| 241 | 239 | ||
| 242 | -aclnnStatus aclnnInplaceGtTensorGetWorkspaceSize( | 240 | +aclnnStatus aclnnInplaceGtTensorGetWorkspaceSize(const aclTensor* selfRef, const aclTensor* other, |
| 243 | - const aclTensor* selfRef, const aclTensor* other, uint64_t* workspaceSize, aclOpExecutor** executor) | 241 | + uint64_t* workspaceSize, aclOpExecutor** executor) |
| 244 | { | 242 | { |
| 245 | auto out = const_cast<aclTensor*>(selfRef); | 243 | auto out = const_cast<aclTensor*>(selfRef); |
| 246 | return aclnnGtTensorGetWorkspaceSize(selfRef, other, out, workspaceSize, executor); | 244 | return aclnnGtTensorGetWorkspaceSize(selfRef, other, out, workspaceSize, executor); |


outSuportList 少了个 p,应该是 outSupportList,这次正好重排到这一行,建议顺手把拼写改掉,le_scalar 里也有同名的这个变量。