From 3fe17c6f81028fe7189da7cb8c36b01955964718 Mon Sep 17 00:00:00 2001 From: ZhouChen Date: Tue, 16 Sep 2025 14:41:27 +0000 Subject: [PATCH] !3024 warning report after GEInitalize Merge pull request !3024 from ZhouChen/test_warning_report --- tf_adapter/kernels/geop_npu.cc | 5 +++++ tf_adapter/tests/depends/ge_runner/src/ge_runner_stub.cc | 1 + tf_adapter/util/ge_plugin.cc | 6 ++++++ tf_adapter/util/ge_plugin.h | 5 +++++ tf_adapter_2.x/tests/stub/ge_stub.cpp | 1 + tf_adapter_2.x/tests/stub/include/ge/ge_api.h | 1 + 6 files changed, 19 insertions(+) diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc index 7d6fa457b..7266804a8 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 d3d206a7f..04541e952 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 f9c4f5522..f11b008cf 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 64a58b54f..370370c2e 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 3c033877c..229ebb08d 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 af422d3a9..79347a942 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: -- Gitee