diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc index 7d6fa457b4b5cb4a7626cb7540d4f5593ece3290..7266804a8a47cb7885e8e5966bc4cdeadc3be362 100644 --- a/tf_adapter/kernels/geop_npu.cc +++ b/tf_adapter/kernels/geop_npu.cc @@ -1006,6 +1006,11 @@ Status GeOp::CreateGeSession() { } // create ge session should be ensure after getinit aysnc success const auto init_status = GePlugin::GetInstance()->GetInitStatus(); + const auto &warning_message = GePlugin::GetInstance()->GetInitWarningMessage(); + if (!warning_message.empty()) { + LOG(WARNING) << "[GePlugin] GEInitialize warning message: " << std::endl + << warning_message; + } if (init_status != ge::SUCCESS) { ADP_LOG(ERROR) << "[GePlugin] Init ge failed, ret : " << ToString(init_status); const auto &error_message = GePlugin::GetInstance()->GetInitErrorMessage(); diff --git a/tf_adapter/tests/depends/ge_runner/src/ge_runner_stub.cc b/tf_adapter/tests/depends/ge_runner/src/ge_runner_stub.cc index d3d206a7f8ba95c3988eca9e3b76ae8ff586e82f..04541e9529df2d2ea254c4620ff10deae942afee 100644 --- a/tf_adapter/tests/depends/ge_runner/src/ge_runner_stub.cc +++ b/tf_adapter/tests/depends/ge_runner/src/ge_runner_stub.cc @@ -251,6 +251,7 @@ Status ParserFinalize() { } GE_FUNC_VISIBILITY ge::AscendString GEGetErrorMsgV2() { return ge::AscendString("ERROR");} +GE_FUNC_VISIBILITY ge::AscendString GEGetWarningMsgV2() { return ge::AscendString("WARNING"); } GE_FUNC_VISIBILITY std::string GEGetErrorMsg() { return "ERROR";} Session::Session(const std::map &options) {} diff --git a/tf_adapter/util/ge_plugin.cc b/tf_adapter/util/ge_plugin.cc index f9c4f552248c833f08e1ea7a92fea54f32e9c0f5..f11b008cfcf7c504aac84d76efab90b2471997a3 100644 --- a/tf_adapter/util/ge_plugin.cc +++ b/tf_adapter/util/ge_plugin.cc @@ -342,12 +342,18 @@ void GePlugin::Init(std::map &init_options, const bool const auto init_ascend_string_options = ChangeStringToAscendString(init_options); const auto init_ret = ge::GEInitialize(init_ascend_string_options); error_message_ = std::string(ge::GEGetErrorMsgV2().GetString()); + warning_message_ = std::string(ge::GEGetWarningMsgV2().GetString()); return init_ret; }, init_options) .share(); } else { ge::Status status = ge::GEInitialize(init_options_ascend_string); + warning_message_ = std::string(ge::GEGetWarningMsgV2().GetString()); + if (!warning_message_.empty()) { + LOG(WARNING) << "[GePlugin] GEInitialize warning message: " << std::endl + << warning_message_; + } if (status != ge::SUCCESS) { std::this_thread::sleep_for(std::chrono::milliseconds(kFatalSleepTime)); ADP_LOG(FATAL) << "[GePlugin] Initialize ge failed, ret : " << ToString(status); diff --git a/tf_adapter/util/ge_plugin.h b/tf_adapter/util/ge_plugin.h index 64a58b54fa761aeaaee6f625d9ffb49cfda16b1f..370370c2ef3d21b4ce513fa563473ac8cf216e3e 100644 --- a/tf_adapter/util/ge_plugin.h +++ b/tf_adapter/util/ge_plugin.h @@ -49,6 +49,10 @@ class GePlugin { return error_message_; } + std::string GetInitWarningMessage() { + return warning_message_; + } + std::map GetInitOptions(); void SetRankTableFileEnv(std::map &init_options, std::string &rankTableFile); @@ -74,6 +78,7 @@ class GePlugin { static std::atomic_int graph_counter_; std::shared_future future_; std::string error_message_; + std::string warning_message_; }; tensorflow::Status RegisterNpuCancellationCallback(std::function callback, diff --git a/tf_adapter_2.x/tests/stub/ge_stub.cpp b/tf_adapter_2.x/tests/stub/ge_stub.cpp index 3c033877c40256c6f616b686c4fe6c372fc7b012..229ebb08d64fe0ad97958e2cde5b308ae892e152 100644 --- a/tf_adapter_2.x/tests/stub/ge_stub.cpp +++ b/tf_adapter_2.x/tests/stub/ge_stub.cpp @@ -109,6 +109,7 @@ size_t ComputeGraph::GetAllNodesSize() const { return graph->num_op_nodes(); } size_t ComputeGraph::GetInputSize() const { return 1U; } size_t ComputeGraph::GetOutputSize() const { return 1U; } ge::AscendString GEGetErrorMsgV2() { return ge::AscendString("ERROR"); } +ge::AscendString GEGetWarningMsgV2() { return ge::AscendString("WARNING"); } Status GEInitialize(const std::map &options) { return SUCCESS; } diff --git a/tf_adapter_2.x/tests/stub/include/ge/ge_api.h b/tf_adapter_2.x/tests/stub/include/ge/ge_api.h index af422d3a9f3314ee9a20bd387cf0ec3904425fec..79347a9420f2f143bb4433e73589e506e880a406 100644 --- a/tf_adapter_2.x/tests/stub/include/ge/ge_api.h +++ b/tf_adapter_2.x/tests/stub/include/ge/ge_api.h @@ -32,6 +32,7 @@ Status GEInitialize(const std::map &options) Status GEFinalize(); ge::AscendString GEGetErrorMsgV2(); +ge::AscendString GEGetWarningMsgV2(); class Shape { public: