diff --git a/mindspore/_extends/parallel_compile/tbe_compiler/compiler.py b/mindspore/_extends/parallel_compile/tbe_compiler/compiler.py index 7bb4923bb5..e7fa1c6cd1 100755 --- a/mindspore/_extends/parallel_compile/tbe_compiler/compiler.py +++ b/mindspore/_extends/parallel_compile/tbe_compiler/compiler.py @@ -25,8 +25,6 @@ build_in_impl_path = get_build_in_impl_path() # op function list op_build = "compile" -fusion_pattern_start_flag = "fusion_pattern_start" -fusion_pattern_end_flag = "fusion_pattern_end" def _initialize(impl_path): """Initialize""" @@ -157,5 +155,6 @@ def compile_with_json(json_str): if __name__ == "__main__": in_args = sys.stdin.readline() result = compile_with_json(in_args) - sys.stdout.write(fusion_pattern_start_flag + str(result) + fusion_pattern_end_flag) - sys.stdout.flush() + if isinstance(result, dict): + sys.stdout.write(json.dumps(result)) + sys.stdout.flush() diff --git a/mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_parallel_build.cc b/mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_parallel_build.cc index e26954f35b..162fb30984 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_parallel_build.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_parallel_build.cc @@ -145,9 +145,6 @@ void ParallelBuildManager::PreTaskFinishProcess(int32_t task_id, const std::stri std::pair ParallelBuildManager::TaskFinishProcess(int32_t task_id, const std::string &build_ret, bool set_kernel_mod) { - auto compile_info = ProcessBuildRetStr(build_ret); - MS_LOG(DEBUG) << "Tbe build ret:" << compile_info; - auto task_iter = task_map_.find(task_id); if (task_iter == task_map_.end()) { MS_EXCEPTION(ArgumentError) << "can find task_id:" << task_id; @@ -170,8 +167,8 @@ std::pair ParallelBuildManager::TaskFinishProcess(int32_t MS_EXCEPTION_IF_NULL(kernel_mod); if (set_kernel_mod) { AnfAlgo::SetKernelMod(kernel_mod, task_iter->second.node.get()); - AnfAlgo::SetNodeAttr(kAttrCompileInfo, MakeValue(compile_info), task_iter->second.node); - MS_LOG(DEBUG) << "Set Node Attr compile_info:" << compile_info; + AnfAlgo::SetNodeAttr(kAttrCompileInfo, MakeValue(build_ret), task_iter->second.node); + MS_LOG(INFO) << "Set Node Attr compile_info:" << build_ret; } auto ret = std::make_pair(task_iter->second.scope_id, kernel_mod); (void)task_map_.erase(task_iter); @@ -258,19 +255,5 @@ AnfNodePtr ParallelBuildManager::GetAnfNodeByTaskID(int32_t task_id) { } return nullptr; } - -std::string ParallelBuildManager::ProcessBuildRetStr(const std::string &build_result) { - std::string start_flag = "fusion_pattern_start"; - std::string end_flag = "fusion_pattern_end"; - int start = build_result.find(start_flag); - int end = build_result.find(end_flag); - if (start != -1 && end != -1 && end >= start) { - std::string result = build_result.substr(start + start_flag.size(), end - start - start_flag.size()); - if (!result.empty()) { - return result; - } - } - return ""; -} } // namespace kernel } // namespace mindspore diff --git a/mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_parallel_build.h b/mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_parallel_build.h index 7928c0df9b..29761837bd 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_parallel_build.h +++ b/mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_parallel_build.h @@ -66,9 +66,6 @@ class ParallelBuildManager { void ResetTaskInfo(); AnfNodePtr GetAnfNodeByTaskID(int32_t task_id); - private: - std::string ProcessBuildRetStr(const std::string &build_result); - private: std::map pre_task_map_; std::map task_map_; diff --git a/mindspore/ccsrc/runtime/device/ascend/executor/ai_core_dynamic_kernel.cc b/mindspore/ccsrc/runtime/device/ascend/executor/ai_core_dynamic_kernel.cc index 1eac30f910..227b8d29fc 100644 --- a/mindspore/ccsrc/runtime/device/ascend/executor/ai_core_dynamic_kernel.cc +++ b/mindspore/ccsrc/runtime/device/ascend/executor/ai_core_dynamic_kernel.cc @@ -15,8 +15,6 @@ */ #include "runtime/device/ascend/executor/ai_core_dynamic_kernel.h" - -#include #include #include #include "framework/common/debug/log.h" @@ -54,15 +52,6 @@ void AiCoreDynamicKernel::Execute() { MS_LOG(INFO) << "End Execute node:" << cnode_ptr_->fullname_with_scope(); } -std::string ReplaceInvalidJsonStr(const std::string &str) { - auto ret = std::regex_replace(str, std::regex("100000000"), R"("100000000")"); - ret = std::regex_replace(ret, std::regex("100000001"), R"("100000001")"); - ret = std::regex_replace(ret, std::regex("100000002"), R"("100000002")"); - ret = std::regex_replace(ret, std::regex("True"), R"(true)"); - ret = std::regex_replace(ret, std::regex("False"), R"(false)"); - return ret; -} - void AiCoreDynamicKernel::ParseCompileJson() { if (!AnfAlgo::IsDynamicShape(cnode_ptr_)) { return; @@ -71,8 +60,6 @@ void AiCoreDynamicKernel::ParseCompileJson() { MS_LOG(EXCEPTION) << "Get compile_info failed"; } auto compile_info_attr = AnfAlgo::GetNodeAttr(cnode_ptr_, kAttrCompileInfo); - std::replace(compile_info_attr.begin(), compile_info_attr.end(), '\'', '\"'); - compile_info_attr = ReplaceInvalidJsonStr(compile_info_attr); MS_LOG(INFO) << "Get compile_info:" << compile_info_attr; op_compile_info_.str = compile_info_attr; op_compile_info_.key = "";