Merged
fix(index): 修正框架内部对象缺失的错误码归因 #13013
fazhenyao123Add on 23 days ago
fix(index): 修正框架内部对象缺失的错误码归因 #13013
Merged
Total: 7 files changed+130-42
| @@ -15,18 +15,32 @@ | |||
| 15 | * \brief | 15 | * \brief |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | +#include <string> | ||
| 19 | +#include <vector> | ||
| 18 | #include "register/op_impl_registry.h" | 20 | #include "register/op_impl_registry.h" |
| 19 | #include "log/log.h" | 21 | #include "log/log.h" |
| 20 | #include "exe_graph/runtime/infer_datatype_context.h" | 22 | #include "exe_graph/runtime/infer_datatype_context.h" |
| 21 | 23 | ||
| 22 | using namespace ge; | 24 | using namespace ge; |
| 23 | 25 | ||
| 26 | +namespace { | ||
| 27 | +void ReportMissingInferenceObject(const char* functionName, const char* objectName) | ||
| 28 | +{ | ||
| 29 | + const std::string reason = std::string(functionName) + ": framework-provided " + objectName + | ||
| 30 | + " is nullptr; check framework context construction"; | ||
| 31 | + const std::vector<const char*> keys = {"opName", "reason"}; | ||
| 32 | + const std::vector<const char*> values = {"IndexCheck", reason.c_str()}; | ||
| 33 | + OP_LOGE_WITHOUT_REPORT("IndexCheck", "%s", reason.c_str()); | ||
| 34 | + REPORT_PREDEFINED_ERR_MSG("EZ1014", keys, values); | ||
| 35 | +} | ||
| 36 | +} // namespace | ||
| 37 | + | ||
| 24 | namespace ops { | 38 | namespace ops { |
| 25 | 39 | ||
| 26 | static ge::graphStatus InferDataTypeForIndexCheck(gert::InferDataTypeContext* context) | 40 | static ge::graphStatus InferDataTypeForIndexCheck(gert::InferDataTypeContext* context) |
| 27 | { | 41 | { |
| 28 | if (context == nullptr) { | 42 | if (context == nullptr) { |
| 29 | - OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "context"); | 43 | + ReportMissingInferenceObject(__func__, "context"); |
| 30 | return ge::GRAPH_FAILED; | 44 | return ge::GRAPH_FAILED; |
| 31 | } | 45 | } |
| 32 | return ge::GRAPH_SUCCESS; | 46 | return ge::GRAPH_SUCCESS; |
| @@ -15,12 +15,26 @@ | |||
| 15 | * \brief | 15 | * \brief |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | +#include <string> | ||
| 19 | +#include <vector> | ||
| 18 | #include "register/op_impl_registry.h" | 20 | #include "register/op_impl_registry.h" |
| 19 | #include "exe_graph/runtime/infer_shape_context.h" | 21 | #include "exe_graph/runtime/infer_shape_context.h" |
| 20 | #include "log/log.h" | 22 | #include "log/log.h" |
| 21 | 23 | ||
| 22 | using namespace ge; | 24 | using namespace ge; |
| 23 | 25 | ||
| 26 | +namespace { | ||
| 27 | +void ReportMissingInferenceObject(const char* functionName, const char* objectName) | ||
| 28 | +{ | ||
| 29 | + const std::string reason = std::string(functionName) + ": framework-provided " + objectName + | ||
| 30 | + " is nullptr; check framework context construction"; | ||
| 31 | + const std::vector<const char*> keys = {"opName", "reason"}; | ||
| 32 | + const std::vector<const char*> values = {"IndexCheck", reason.c_str()}; | ||
| 33 | + OP_LOGE_WITHOUT_REPORT("IndexCheck", "%s", reason.c_str()); | ||
| 34 | + REPORT_PREDEFINED_ERR_MSG("EZ1014", keys, values); | ||
| 35 | +} | ||
| 36 | +} // namespace | ||
| 37 | + | ||
| 24 | namespace ops { | 38 | namespace ops { |
| 25 | namespace { | 39 | namespace { |
| 26 | constexpr size_t INPUT_BOUNDS_INDEX = 0; | 40 | constexpr size_t INPUT_BOUNDS_INDEX = 0; |
| @@ -29,7 +43,7 @@ constexpr size_t INPUT_BOUNDS_INDEX = 0; | |||
| 29 | static ge::graphStatus InferShapeForIndexCheck(gert::InferShapeContext* context) | 43 | static ge::graphStatus InferShapeForIndexCheck(gert::InferShapeContext* context) |
| 30 | { | 44 | { |
| 31 | if (context == nullptr) { | 45 | if (context == nullptr) { |
| 32 | - OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "context"); | 46 | + ReportMissingInferenceObject(__func__, "context"); |
| 33 | return ge::GRAPH_FAILED; | 47 | return ge::GRAPH_FAILED; |
| 34 | } | 48 | } |
| 35 | OP_LOGD(context->GetNodeName(), "Begin to do InferShapeForIndexCheck"); | 49 | OP_LOGD(context->GetNodeName(), "Begin to do InferShapeForIndexCheck"); |
| @@ -12,6 +12,8 @@ | |||
| 12 | * \file index_check_tiling.cpp | 12 | * \file index_check_tiling.cpp |
| 13 | * \brief | 13 | * \brief |
| 14 | */ | 14 | */ |
| 15 | +#include <string> | ||
| 16 | +#include <vector> | ||
| 15 | #include "register/op_impl_registry.h" | 17 | #include "register/op_impl_registry.h" |
| 16 | #include "log/log.h" | 18 | #include "log/log.h" |
| 17 | #include "tiling/platform/platform_ascendc.h" | 19 | #include "tiling/platform/platform_ascendc.h" |
| @@ -25,6 +27,18 @@ constexpr int64_t MIN_UB_SIZE = 1024; | |||
| 25 | constexpr uint64_t BLOCK_BYTES = 32; | 27 | constexpr uint64_t BLOCK_BYTES = 32; |
| 26 | constexpr size_t MAX_DIM_NUM = 8; | 28 | constexpr size_t MAX_DIM_NUM = 8; |
| 27 | 29 | ||
| 30 | +namespace { | ||
| 31 | +void ReportMissingTilingObject(const char* functionName, const char* objectName) | ||
| 32 | +{ | ||
| 33 | + const std::string reason = std::string(functionName) + ": framework-provided " + objectName + | ||
| 34 | + " is nullptr; check framework context construction"; | ||
| 35 | + const std::vector<const char*> keys = {"opName", "reason"}; | ||
| 36 | + const std::vector<const char*> values = {"IndexCheck", reason.c_str()}; | ||
| 37 | + OP_LOGE_WITHOUT_REPORT("IndexCheck", "%s", reason.c_str()); | ||
| 38 | + REPORT_PREDEFINED_ERR_MSG("EZ1008", keys, values); | ||
| 39 | +} | ||
| 40 | +} // namespace | ||
| 41 | + | ||
| 28 | namespace optiling { | 42 | namespace optiling { |
| 29 | class IndexCheckTiling { | 43 | class IndexCheckTiling { |
| 30 | public: | 44 | public: |
| @@ -51,13 +65,12 @@ ge::graphStatus IndexCheckTiling::Init() | |||
| 51 | { | 65 | { |
| 52 | OP_LOGD(tilingContext_, "Tiling start."); | 66 | OP_LOGD(tilingContext_, "Tiling start."); |
| 53 | if (tilingContext_ == nullptr) { | 67 | if (tilingContext_ == nullptr) { |
| 54 | - OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "tilingContext"); | 68 | + ReportMissingTilingObject(__func__, "tilingContext"); |
| 55 | return ge::GRAPH_FAILED; | 69 | return ge::GRAPH_FAILED; |
| 56 | } | 70 | } |
| 57 | 71 | ||
| 58 | auto compileInfo = tilingContext_->GetCompileInfo<IndexCheckCompileInfo>(); | 72 | auto compileInfo = tilingContext_->GetCompileInfo<IndexCheckCompileInfo>(); |
| 59 | - OP_CHECK_IF(compileInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "compileInfo"), | 73 | + OP_CHECK_IF(compileInfo == nullptr, ReportMissingTilingObject(__func__, "compileInfo"), return ge::GRAPH_FAILED); |
| 60 | - return ge::GRAPH_FAILED); | ||
| 61 | totalCoreNum_ = compileInfo->totalCoreNum; | 74 | totalCoreNum_ = compileInfo->totalCoreNum; |
| 62 | workspaceSize_ = compileInfo->workspaceSize; | 75 | workspaceSize_ = compileInfo->workspaceSize; |
| 63 | if (compileInfo->ubSizePlatform < static_cast<uint64_t>(SCALE_SPACE + MIN_UB_SIZE)) { | 76 | if (compileInfo->ubSizePlatform < static_cast<uint64_t>(SCALE_SPACE + MIN_UB_SIZE)) { |
| @@ -74,11 +87,11 @@ ge::graphStatus IndexCheckTiling::Init() | |||
| 74 | workspaceSize_); | 87 | workspaceSize_); |
| 75 | 88 | ||
| 76 | auto computeNodeInfoPtr = tilingContext_->GetComputeNodeInfo(); | 89 | auto computeNodeInfoPtr = tilingContext_->GetComputeNodeInfo(); |
| 77 | - OP_CHECK_IF(computeNodeInfoPtr == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "computeNodeInfoPtr"), | 90 | + OP_CHECK_IF(computeNodeInfoPtr == nullptr, ReportMissingTilingObject(__func__, "computeNodeInfoPtr"), |
| 78 | return ge::GRAPH_FAILED); | 91 | return ge::GRAPH_FAILED); |
| 79 | 92 | ||
| 80 | auto idxInstanceInfoPtr = computeNodeInfoPtr->GetInputInstanceInfo(1); | 93 | auto idxInstanceInfoPtr = computeNodeInfoPtr->GetInputInstanceInfo(1); |
| 81 | - OP_CHECK_IF(idxInstanceInfoPtr == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "idxInstanceInfoPtr"), | 94 | + OP_CHECK_IF(idxInstanceInfoPtr == nullptr, ReportMissingTilingObject(__func__, "idxInstanceInfoPtr"), |
| 82 | return ge::GRAPH_FAILED); | 95 | return ge::GRAPH_FAILED); |
| 83 | tensorId_ = idxInstanceInfoPtr->GetInstanceNum(); | 96 | tensorId_ = idxInstanceInfoPtr->GetInstanceNum(); |
| 84 | OP_CHECK_IF( | 97 | OP_CHECK_IF( |
| @@ -172,7 +185,7 @@ ge::graphStatus IndexCheckTiling::RunKernelTiling() | |||
| 172 | tilingData_.params.set_tensorLens(tensorLens_.data()); | 185 | tilingData_.params.set_tensorLens(tensorLens_.data()); |
| 173 | 186 | ||
| 174 | auto rawTilingData = tilingContext_->GetRawTilingData(); | 187 | auto rawTilingData = tilingContext_->GetRawTilingData(); |
| 175 | - OP_CHECK_IF(rawTilingData == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "rawTilingData"), | 188 | + OP_CHECK_IF(rawTilingData == nullptr, ReportMissingTilingObject(__func__, "rawTilingData"), |
| 176 | return ge::GRAPH_FAILED); | 189 | return ge::GRAPH_FAILED); |
| 177 | tilingData_.SaveToBuffer(rawTilingData->GetData(), rawTilingData->GetCapacity()); | 190 | tilingData_.SaveToBuffer(rawTilingData->GetData(), rawTilingData->GetCapacity()); |
| 178 | rawTilingData->SetDataSize(tilingData_.GetDataSize()); | 191 | rawTilingData->SetDataSize(tilingData_.GetDataSize()); |
| @@ -187,7 +200,7 @@ ge::graphStatus IndexCheckTiling::RunKernelTiling() | |||
| 187 | return ge::GRAPH_FAILED; | 200 | return ge::GRAPH_FAILED; |
| 188 | } | 201 | } |
| 189 | size_t* workspaces = tilingContext_->GetWorkspaceSizes(1); | 202 | size_t* workspaces = tilingContext_->GetWorkspaceSizes(1); |
| 190 | - OP_CHECK_IF(workspaces == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "workspaces"), return ge::GRAPH_FAILED); | 203 | + OP_CHECK_IF(workspaces == nullptr, ReportMissingTilingObject(__func__, "workspaces"), return ge::GRAPH_FAILED); |
| 191 | workspaces[0] = workspaceSize_; | 204 | workspaces[0] = workspaceSize_; |
| 192 | TilingDataPrint(); | 205 | TilingDataPrint(); |
| 193 | OP_LOGD(tilingContext_, "set tiling data end."); | 206 | OP_LOGD(tilingContext_, "set tiling data end."); |
| @@ -208,7 +221,7 @@ void IndexCheckTiling::TilingDataPrint() const | |||
| 208 | ge::graphStatus TilingIndexCheck(gert::TilingContext* context) | 221 | ge::graphStatus TilingIndexCheck(gert::TilingContext* context) |
| 209 | { | 222 | { |
| 210 | if (context == nullptr) { | 223 | if (context == nullptr) { |
| 211 | - OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "context"); | 224 | + ReportMissingTilingObject(__func__, "context"); |
| 212 | return ge::GRAPH_FAILED; | 225 | return ge::GRAPH_FAILED; |
| 213 | } | 226 | } |
| 214 | OP_LOGD(context->GetNodeName(), "IndexCheck tiling begin"); | 227 | OP_LOGD(context->GetNodeName(), "IndexCheck tiling begin"); |
| @@ -223,16 +236,14 @@ ge::graphStatus TilingIndexCheck(gert::TilingContext* context) | |||
| 223 | ge::graphStatus TilingPrepareForIndexCheck(gert::TilingParseContext* context) | 236 | ge::graphStatus TilingPrepareForIndexCheck(gert::TilingParseContext* context) |
| 224 | { | 237 | { |
| 225 | if (context == nullptr) { | 238 | if (context == nullptr) { |
| 226 | - OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "context"); | 239 | + ReportMissingTilingObject(__func__, "context"); |
| 227 | return ge::GRAPH_FAILED; | 240 | return ge::GRAPH_FAILED; |
| 228 | } | 241 | } |
| 229 | OP_LOGD(context, "TilingPrepareForIndexCheck start"); | 242 | OP_LOGD(context, "TilingPrepareForIndexCheck start"); |
| 230 | auto compileInfo = context->GetCompiledInfo<IndexCheckCompileInfo>(); | 243 | auto compileInfo = context->GetCompiledInfo<IndexCheckCompileInfo>(); |
| 231 | - OP_CHECK_IF(compileInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "compileInfo"), | 244 | + OP_CHECK_IF(compileInfo == nullptr, ReportMissingTilingObject(__func__, "compileInfo"), return ge::GRAPH_FAILED); |
| 232 | - return ge::GRAPH_FAILED); | ||
| 233 | auto platformInfo = context->GetPlatformInfo(); | 245 | auto platformInfo = context->GetPlatformInfo(); |
| 234 | - OP_CHECK_IF(platformInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexCheck", "platformInfo"), | 246 | + OP_CHECK_IF(platformInfo == nullptr, ReportMissingTilingObject(__func__, "platformInfo"), return ge::GRAPH_FAILED); |
| 235 | - return ge::GRAPH_FAILED); | ||
| 236 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 247 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 237 | compileInfo->totalCoreNum = ascendcPlatform.GetCoreNumAiv(); | 248 | compileInfo->totalCoreNum = ascendcPlatform.GetCoreNumAiv(); |
| 238 | compileInfo->workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); | 249 | compileInfo->workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| @@ -13,6 +13,8 @@ | |||
| 13 | * \brief | 13 | * \brief |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | +#include <string> | ||
| 17 | +#include <vector> | ||
| 16 | #include "index_put_with_sort_tiling.h" | 18 | #include "index_put_with_sort_tiling.h" |
| 17 | #include "log/log.h" | 19 | #include "log/log.h" |
| 18 | #include "platform/platform_infos_def.h" | 20 | #include "platform/platform_infos_def.h" |
| @@ -22,6 +24,18 @@ | |||
| 22 | #include "tiling/platform/platform_ascendc.h" | 24 | #include "tiling/platform/platform_ascendc.h" |
| 23 | #include "util/math_util.h" | 25 | #include "util/math_util.h" |
| 24 | 26 | ||
| 27 | +namespace { | ||
| 28 | +void ReportMissingTilingObject(const char* functionName, const char* objectName) | ||
| 29 | +{ | ||
| 30 | + const std::string reason = std::string(functionName) + ": framework-provided " + objectName + | ||
| 31 | + " is nullptr; check framework context construction"; | ||
| 32 | + const std::vector<const char*> keys = {"opName", "reason"}; | ||
| 33 | + const std::vector<const char*> values = {"IndexPutWithSort", reason.c_str()}; | ||
| 34 | + OP_LOGE_WITHOUT_REPORT("IndexPutWithSort", "%s", reason.c_str()); | ||
| 35 | + REPORT_PREDEFINED_ERR_MSG("EZ1008", keys, values); | ||
| 36 | +} | ||
| 37 | +} // namespace | ||
| 38 | + | ||
| 25 | namespace optiling { | 39 | namespace optiling { |
| 26 | constexpr uint32_t BLOCK_SIZE = 32; | 40 | constexpr uint32_t BLOCK_SIZE = 32; |
| 27 | constexpr uint32_t HALF_ALIGNED = 16; | 41 | constexpr uint32_t HALF_ALIGNED = 16; |
| @@ -202,7 +216,7 @@ ge::graphStatus IndexPutWithSortTilingOp::Init() | |||
| 202 | 216 | ||
| 203 | tilingData.coreNums = coreNum; | 217 | tilingData.coreNums = coreNum; |
| 204 | auto attrs = context->GetAttrs(); | 218 | auto attrs = context->GetAttrs(); |
| 205 | - OP_CHECK_IF(attrs == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexPutWithSort", "attrs"), return ge::GRAPH_FAILED); | 219 | + OP_CHECK_IF(attrs == nullptr, ReportMissingTilingObject(__func__, "attrs"), return ge::GRAPH_FAILED); |
| 206 | tilingData.sliceSize = *(attrs->GetAttrPointer<uint32_t>)(0); | 220 | tilingData.sliceSize = *(attrs->GetAttrPointer<uint32_t>)(0); |
| 207 | tilingData.sliceSizeAligned = ((tilingData.sliceSize + HALF_ALIGNED - 1) / HALF_ALIGNED) * HALF_ALIGNED; | 221 | tilingData.sliceSizeAligned = ((tilingData.sliceSize + HALF_ALIGNED - 1) / HALF_ALIGNED) * HALF_ALIGNED; |
| 208 | bool accumulate = *(attrs->GetAttrPointer<bool>)(1); // false为替换, true为累加 | 222 | bool accumulate = *(attrs->GetAttrPointer<bool>)(1); // false为替换, true为累加 |
| @@ -249,11 +263,9 @@ ge::graphStatus TilingPrepareForIndexPutWithSort(gert::TilingParseContext* conte | |||
| 249 | { | 263 | { |
| 250 | OP_LOGD(context->GetNodeName(), "Tiling Prepare For IndexPutWithSort start"); | 264 | OP_LOGD(context->GetNodeName(), "Tiling Prepare For IndexPutWithSort start"); |
| 251 | auto compileInfo = context->GetCompiledInfo<IndexPutWithSortCompileInfo>(); | 265 | auto compileInfo = context->GetCompiledInfo<IndexPutWithSortCompileInfo>(); |
| 252 | - OP_CHECK_IF(compileInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexPutWithSort", "compileInfo"), | 266 | + OP_CHECK_IF(compileInfo == nullptr, ReportMissingTilingObject(__func__, "compileInfo"), return ge::GRAPH_FAILED); |
| 253 | - return ge::GRAPH_FAILED); | ||
| 254 | auto platformInfo = context->GetPlatformInfo(); | 267 | auto platformInfo = context->GetPlatformInfo(); |
| 255 | - OP_CHECK_IF(platformInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("IndexPutWithSort", "platformInfo"), | 268 | + OP_CHECK_IF(platformInfo == nullptr, ReportMissingTilingObject(__func__, "platformInfo"), return ge::GRAPH_FAILED); |
| 256 | - return ge::GRAPH_FAILED); | ||
| 257 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 269 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 258 | compileInfo->workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); | 270 | compileInfo->workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| 259 | compileInfo->totalCoreNum = ascendcPlatform.GetCoreNumAiv(); | 271 | compileInfo->totalCoreNum = ascendcPlatform.GetCoreNumAiv(); |
| @@ -12,6 +12,8 @@ | |||
| 12 | * \file linear_index_tiling.cpp | 12 | * \file linear_index_tiling.cpp |
| 13 | * \brief | 13 | * \brief |
| 14 | */ | 14 | */ |
| 15 | +#include <string> | ||
| 16 | +#include <vector> | ||
| 15 | #include "register/op_impl_registry.h" | 17 | #include "register/op_impl_registry.h" |
| 16 | #include "util/math_util.h" | 18 | #include "util/math_util.h" |
| 17 | #include "log/log.h" | 19 | #include "log/log.h" |
| @@ -22,6 +24,18 @@ | |||
| 22 | 24 | ||
| 23 | using namespace std; | 25 | using namespace std; |
| 24 | 26 | ||
| 27 | +namespace { | ||
| 28 | +void ReportMissingTilingObject(const char* functionName, const char* objectName) | ||
| 29 | +{ | ||
| 30 | + const std::string reason = std::string(functionName) + ": framework-provided " + objectName + | ||
| 31 | + " is nullptr; check framework context construction"; | ||
| 32 | + const std::vector<const char*> keys = {"opName", "reason"}; | ||
| 33 | + const std::vector<const char*> values = {"LinearIndex", reason.c_str()}; | ||
| 34 | + OP_LOGE_WITHOUT_REPORT("LinearIndex", "%s", reason.c_str()); | ||
| 35 | + REPORT_PREDEFINED_ERR_MSG("EZ1008", keys, values); | ||
| 36 | +} | ||
| 37 | +} // namespace | ||
| 38 | + | ||
| 25 | namespace { | 39 | namespace { |
| 26 | const int BUFFER_NUM = 1; | 40 | const int BUFFER_NUM = 1; |
| 27 | const int TWO_DIM = 2; | 41 | const int TWO_DIM = 2; |
| @@ -77,13 +91,12 @@ private: | |||
| 77 | ge::graphStatus LinearIndexTiling::Init() | 91 | ge::graphStatus LinearIndexTiling::Init() |
| 78 | { | 92 | { |
| 79 | if (tilingContext == nullptr) { | 93 | if (tilingContext == nullptr) { |
| 80 | - OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "tilingContext"); | 94 | + ReportMissingTilingObject(__func__, "tilingContext"); |
| 81 | return ge::GRAPH_FAILED; | 95 | return ge::GRAPH_FAILED; |
| 82 | } | 96 | } |
| 83 | 97 | ||
| 84 | auto compileInfo = static_cast<const LinearIndexCompileInfo*>(tilingContext->GetCompileInfo()); | 98 | auto compileInfo = static_cast<const LinearIndexCompileInfo*>(tilingContext->GetCompileInfo()); |
| 85 | - OP_CHECK_IF(compileInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "compileInfo"), | 99 | + OP_CHECK_IF(compileInfo == nullptr, ReportMissingTilingObject(__func__, "compileInfo"), return ge::GRAPH_FAILED); |
| 86 | - return ge::GRAPH_FAILED); | ||
| 87 | static uint32_t coreNum = static_cast<uint32_t>(compileInfo->totalCoreNum); | 100 | static uint32_t coreNum = static_cast<uint32_t>(compileInfo->totalCoreNum); |
| 88 | if (coreNum == 0) { | 101 | if (coreNum == 0) { |
| 89 | const std::string reason = "Tiling requires a positive AIV core count; actual=" + std::to_string(coreNum); | 102 | const std::string reason = "Tiling requires a positive AIV core count; actual=" + std::to_string(coreNum); |
| @@ -99,15 +112,15 @@ ge::graphStatus LinearIndexTiling::Init() | |||
| 99 | OP_LOGD(tilingContext, "ubSizePlatForm: %lu.", ubSizePlatForm); | 112 | OP_LOGD(tilingContext, "ubSizePlatForm: %lu.", ubSizePlatForm); |
| 100 | 113 | ||
| 101 | auto attrs = tilingContext->GetAttrs(); | 114 | auto attrs = tilingContext->GetAttrs(); |
| 102 | - OP_CHECK_IF(attrs == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "attrs"), return ge::GRAPH_FAILED); | 115 | + OP_CHECK_IF(attrs == nullptr, ReportMissingTilingObject(__func__, "attrs"), return ge::GRAPH_FAILED); |
| 103 | OP_CHECK_IF(tilingContext->GetInputShape(INPUT_0) == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "indices"), | 116 | OP_CHECK_IF(tilingContext->GetInputShape(INPUT_0) == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "indices"), |
| 104 | return ge::GRAPH_FAILED); | 117 | return ge::GRAPH_FAILED); |
| 105 | OP_CHECK_IF(tilingContext->GetInputShape(INPUT_1) == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "shape"), | 118 | OP_CHECK_IF(tilingContext->GetInputShape(INPUT_1) == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "shape"), |
| 106 | return ge::GRAPH_FAILED); | 119 | return ge::GRAPH_FAILED); |
| 107 | OP_CHECK_IF(tilingContext->GetInputDesc(INPUT_0) == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "indices"), | 120 | OP_CHECK_IF(tilingContext->GetInputDesc(INPUT_0) == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "indices"), |
| 108 | return ge::GRAPH_FAILED); | 121 | return ge::GRAPH_FAILED); |
| 109 | - OP_CHECK_IF(tilingContext->GetRawTilingData() == nullptr, | 122 | + OP_CHECK_IF(tilingContext->GetRawTilingData() == nullptr, ReportMissingTilingObject(__func__, "rawTilingData"), |
| 110 | - OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "rawTilingData"), return ge::GRAPH_FAILED); | 123 | + return ge::GRAPH_FAILED); |
| 111 | 124 | ||
| 112 | auto indicesShape = tilingContext->GetInputShape(INPUT_0)->GetStorageShape(); | 125 | auto indicesShape = tilingContext->GetInputShape(INPUT_0)->GetStorageShape(); |
| 113 | auto varShapeTensor = tilingContext->GetInputTensor(INPUT_1); | 126 | auto varShapeTensor = tilingContext->GetInputTensor(INPUT_1); |
| @@ -265,11 +278,9 @@ ge::graphStatus TilingPrepareForLinearIndex(gert::TilingParseContext* context) | |||
| 265 | { | 278 | { |
| 266 | OP_LOGD(context, "TilingPrepareForLinearIndex start."); | 279 | OP_LOGD(context, "TilingPrepareForLinearIndex start."); |
| 267 | auto compileInfo = context->GetCompiledInfo<LinearIndexCompileInfo>(); | 280 | auto compileInfo = context->GetCompiledInfo<LinearIndexCompileInfo>(); |
| 268 | - OP_CHECK_IF(compileInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "compileInfo"), | 281 | + OP_CHECK_IF(compileInfo == nullptr, ReportMissingTilingObject(__func__, "compileInfo"), return ge::GRAPH_FAILED); |
| 269 | - return ge::GRAPH_FAILED); | ||
| 270 | auto platformInfo = context->GetPlatformInfo(); | 282 | auto platformInfo = context->GetPlatformInfo(); |
| 271 | - OP_CHECK_IF(platformInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndex", "platformInfo"), | 283 | + OP_CHECK_IF(platformInfo == nullptr, ReportMissingTilingObject(__func__, "platformInfo"), return ge::GRAPH_FAILED); |
| 272 | - return ge::GRAPH_FAILED); | ||
| 273 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 284 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 274 | compileInfo->totalCoreNum = ascendcPlatform.GetCoreNumAiv(); | 285 | compileInfo->totalCoreNum = ascendcPlatform.GetCoreNumAiv(); |
| 275 | compileInfo->workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); | 286 | compileInfo->workspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| @@ -16,6 +16,8 @@ | |||
| 16 | * Output shape is same as the first indices tensor shape. | 16 | * Output shape is same as the first indices tensor shape. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | +#include <string> | ||
| 20 | +#include <vector> | ||
| 19 | #include "register/op_impl_registry.h" | 21 | #include "register/op_impl_registry.h" |
| 20 | #include "log/log.h" | 22 | #include "log/log.h" |
| 21 | #include "util/shape_util.h" | 23 | #include "util/shape_util.h" |
| @@ -23,6 +25,18 @@ | |||
| 23 | using namespace ge; | 25 | using namespace ge; |
| 24 | using namespace Ops::Base; | 26 | using namespace Ops::Base; |
| 25 | 27 | ||
| 28 | +namespace { | ||
| 29 | +void ReportMissingInferenceObject(const char* functionName, const char* objectName) | ||
| 30 | +{ | ||
| 31 | + const std::string reason = std::string(functionName) + ": framework-provided " + objectName + | ||
| 32 | + " is nullptr; check framework context construction"; | ||
| 33 | + const std::vector<const char*> keys = {"opName", "reason"}; | ||
| 34 | + const std::vector<const char*> values = {"LinearIndexV2", reason.c_str()}; | ||
| 35 | + OP_LOGE_WITHOUT_REPORT("LinearIndexV2", "%s", reason.c_str()); | ||
| 36 | + REPORT_PREDEFINED_ERR_MSG("EZ1014", keys, values); | ||
| 37 | +} | ||
| 38 | +} // namespace | ||
| 39 | + | ||
| 26 | namespace ops { | 40 | namespace ops { |
| 27 | 41 | ||
| 28 | /** | 42 | /** |
| @@ -39,12 +53,13 @@ namespace ops { | |||
| 39 | static ge::graphStatus InferShapeForLinearIndexV2(gert::InferShapeContext* context) | 53 | static ge::graphStatus InferShapeForLinearIndexV2(gert::InferShapeContext* context) |
| 40 | { | 54 | { |
| 41 | if (context == nullptr) { | 55 | if (context == nullptr) { |
| 42 | - OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "context"); | 56 | + ReportMissingInferenceObject(__func__, "context"); |
| 43 | return GRAPH_FAILED; | 57 | return GRAPH_FAILED; |
| 44 | } | 58 | } |
| 45 | // Get output shape | 59 | // Get output shape |
| 46 | auto outShape = context->GetOutputShape(0); | 60 | auto outShape = context->GetOutputShape(0); |
| 47 | - OP_CHECK_IF(outShape == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "index"), return ge::GRAPH_FAILED); | 61 | + OP_CHECK_IF(outShape == nullptr, ReportMissingInferenceObject(__func__, "outputShape(index)"), |
| 62 | + return ge::GRAPH_FAILED); | ||
| 48 | // Get the first indices tensor shape (indices_list is dynamic input, index 0) | 63 | // Get the first indices tensor shape (indices_list is dynamic input, index 0) |
| 49 | auto indicesShape = context->GetDynamicInputShape(0, 0); | 64 | auto indicesShape = context->GetDynamicInputShape(0, 0); |
| 50 | OP_CHECK_IF(indicesShape == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "indices_list"), | 65 | OP_CHECK_IF(indicesShape == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "indices_list"), |
| @@ -70,7 +85,7 @@ static ge::graphStatus InferShapeForLinearIndexV2(gert::InferShapeContext* conte | |||
| 70 | static graphStatus InferDataTypeForLinearIndexV2(gert::InferDataTypeContext* context) | 85 | static graphStatus InferDataTypeForLinearIndexV2(gert::InferDataTypeContext* context) |
| 71 | { | 86 | { |
| 72 | if (context == nullptr) { | 87 | if (context == nullptr) { |
| 73 | - OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "context"); | 88 | + ReportMissingInferenceObject(__func__, "context"); |
| 74 | return GRAPH_FAILED; | 89 | return GRAPH_FAILED; |
| 75 | } | 90 | } |
| 76 | 91 | ||
| @@ -12,6 +12,8 @@ | |||
| 12 | * \file linear_index_v2_tiling.cpp | 12 | * \file linear_index_v2_tiling.cpp |
| 13 | * \brief | 13 | * \brief |
| 14 | */ | 14 | */ |
| 15 | +#include <string> | ||
| 16 | +#include <vector> | ||
| 15 | #include "register/op_impl_registry.h" | 17 | #include "register/op_impl_registry.h" |
| 16 | #include "util/math_util.h" | 18 | #include "util/math_util.h" |
| 17 | #include "log/log.h" | 19 | #include "log/log.h" |
| @@ -33,6 +35,18 @@ constexpr uint32_t DCACHE_SIZE = 32 * 1024; | |||
| 33 | constexpr uint32_t REGBASE_CCEC_CACHE_SIZE = 8 * 1024; | 35 | constexpr uint32_t REGBASE_CCEC_CACHE_SIZE = 8 * 1024; |
| 34 | constexpr uint64_t WORKSPACE_SIZE = 0; | 36 | constexpr uint64_t WORKSPACE_SIZE = 0; |
| 35 | 37 | ||
| 38 | +namespace { | ||
| 39 | +void ReportMissingTilingObject(const char* functionName, const char* objectName) | ||
| 40 | +{ | ||
| 41 | + const std::string reason = std::string(functionName) + ": framework-provided " + objectName + | ||
| 42 | + " is nullptr; check framework context construction"; | ||
| 43 | + const std::vector<const char*> keys = {"opName", "reason"}; | ||
| 44 | + const std::vector<const char*> values = {"LinearIndexV2", reason.c_str()}; | ||
| 45 | + OP_LOGE_WITHOUT_REPORT("LinearIndexV2", "%s", reason.c_str()); | ||
| 46 | + REPORT_PREDEFINED_ERR_MSG("EZ1008", keys, values); | ||
| 47 | +} | ||
| 48 | +} // namespace | ||
| 49 | + | ||
| 36 | namespace optiling { | 50 | namespace optiling { |
| 37 | struct computeParam { | 51 | struct computeParam { |
| 38 | uint64_t formerTime = 0; | 52 | uint64_t formerTime = 0; |
| @@ -99,17 +113,16 @@ ge::graphStatus LinearIndexV2Tiling::Init() | |||
| 99 | { | 113 | { |
| 100 | OP_LOGD(tilingContext_, "Tiling start."); | 114 | OP_LOGD(tilingContext_, "Tiling start."); |
| 101 | if (tilingContext_ == nullptr) { | 115 | if (tilingContext_ == nullptr) { |
| 102 | - OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "tilingContext"); | 116 | + ReportMissingTilingObject(__func__, "tilingContext"); |
| 103 | return ge::GRAPH_FAILED; | 117 | return ge::GRAPH_FAILED; |
| 104 | } | 118 | } |
| 105 | auto compileInfo = static_cast<const LinearIndexV2CompileInfo*>(tilingContext_->GetCompileInfo()); | 119 | auto compileInfo = static_cast<const LinearIndexV2CompileInfo*>(tilingContext_->GetCompileInfo()); |
| 106 | auto computeNodeInfoPtr = tilingContext_->GetComputeNodeInfo(); | 120 | auto computeNodeInfoPtr = tilingContext_->GetComputeNodeInfo(); |
| 107 | - OP_CHECK_IF(compileInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "compileInfo"), | 121 | + OP_CHECK_IF(compileInfo == nullptr, ReportMissingTilingObject(__func__, "compileInfo"), return ge::GRAPH_FAILED); |
| 108 | - return ge::GRAPH_FAILED); | 122 | + OP_CHECK_IF(computeNodeInfoPtr == nullptr, ReportMissingTilingObject(__func__, "computeNodeInfoPtr"), |
| 109 | - OP_CHECK_IF(computeNodeInfoPtr == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "computeNodeInfoPtr"), | ||
| 110 | return ge::GRAPH_FAILED); | 123 | return ge::GRAPH_FAILED); |
| 111 | auto idxInstanceInfoPtr = computeNodeInfoPtr->GetInputInstanceInfo(0); | 124 | auto idxInstanceInfoPtr = computeNodeInfoPtr->GetInputInstanceInfo(0); |
| 112 | - OP_CHECK_IF(idxInstanceInfoPtr == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "idxInstanceInfoPtr"), | 125 | + OP_CHECK_IF(idxInstanceInfoPtr == nullptr, ReportMissingTilingObject(__func__, "idxInstanceInfoPtr"), |
| 113 | return ge::GRAPH_FAILED); | 126 | return ge::GRAPH_FAILED); |
| 114 | tensorId_ = idxInstanceInfoPtr->GetInstanceNum(); | 127 | tensorId_ = idxInstanceInfoPtr->GetInstanceNum(); |
| 115 | if (tensorId_ == 0) { | 128 | if (tensorId_ == 0) { |
| @@ -270,11 +283,9 @@ ge::graphStatus TilingPrepareForLinearIndexV2(gert::TilingParseContext* context) | |||
| 270 | { | 283 | { |
| 271 | OP_LOGD(context, "TilingPrepareForLinearIndexV2 start"); | 284 | OP_LOGD(context, "TilingPrepareForLinearIndexV2 start"); |
| 272 | auto compileInfo = context->GetCompiledInfo<LinearIndexV2CompileInfo>(); | 285 | auto compileInfo = context->GetCompiledInfo<LinearIndexV2CompileInfo>(); |
| 273 | - OP_CHECK_IF(compileInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "compileInfo"), | 286 | + OP_CHECK_IF(compileInfo == nullptr, ReportMissingTilingObject(__func__, "compileInfo"), return ge::GRAPH_FAILED); |
| 274 | - return ge::GRAPH_FAILED); | ||
| 275 | auto platformInfo = context->GetPlatformInfo(); | 287 | auto platformInfo = context->GetPlatformInfo(); |
| 276 | - OP_CHECK_IF(platformInfo == nullptr, OP_LOGE_WITH_INVALID_INPUT("LinearIndexV2", "platformInfo"), | 288 | + OP_CHECK_IF(platformInfo == nullptr, ReportMissingTilingObject(__func__, "platformInfo"), return ge::GRAPH_FAILED); |
| 277 | - return ge::GRAPH_FAILED); | ||
| 278 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 289 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 279 | compileInfo->totalCoreNum = ascendcPlatform.GetCoreNumAiv(); | 290 | compileInfo->totalCoreNum = ascendcPlatform.GetCoreNumAiv(); |
| 280 | compileInfo->isAscend950 = Ops::NN::OpTiling::IsRegbaseSocVersion(context); | 291 | compileInfo->isAscend950 = Ops::NN::OpTiling::IsRegbaseSocVersion(context); |