From 8fa65fa5f2e2340247ae6702bd35f0e2fdc7e380 Mon Sep 17 00:00:00 2001 From: xiao_yao1994 Date: Mon, 6 May 2024 15:14:00 +0800 Subject: [PATCH] disable backend compile cache in msrun mode --- mindspore/ccsrc/pipeline/jit/ps/compile_cache_manager.cc | 8 ++++---- mindspore/ccsrc/pipeline/jit/ps/resource.cc | 4 +++- .../device/ascend/hal/hardware/ge_graph_executor.cc | 6 ++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mindspore/ccsrc/pipeline/jit/ps/compile_cache_manager.cc b/mindspore/ccsrc/pipeline/jit/ps/compile_cache_manager.cc index d18e6d2214e..84f03b07fc2 100644 --- a/mindspore/ccsrc/pipeline/jit/ps/compile_cache_manager.cc +++ b/mindspore/ccsrc/pipeline/jit/ps/compile_cache_manager.cc @@ -319,15 +319,15 @@ std::string CompileCacheManager::GetCachedDataQueueName(const std::string &datas return queue_name; } data_queue_num_++; + auto &config_mng = ConfigManager::GetInstance(); + if (config_mng.dataset_phase().empty()) { + config_mng.set_dataset_phase(dataset_phase); + } // if queue name has cached, we should not get it again from cache file in the same process. auto &context = CompileCacheContext::GetInstance(); if (context.has_cached_queue_name()) { return queue_name; } - auto &config_mng = ConfigManager::GetInstance(); - if (config_mng.dataset_phase().empty()) { - config_mng.set_dataset_phase(dataset_phase); - } const auto &filename = GetDataQueueNameCachePath(std::to_string(CompileCacheManager::data_queue_num_)); MS_LOG(INFO) << "Get data queue name from file " << filename; std::ifstream json_fs(filename); diff --git a/mindspore/ccsrc/pipeline/jit/ps/resource.cc b/mindspore/ccsrc/pipeline/jit/ps/resource.cc index 9ef6d33e9da..0e54fd9048a 100644 --- a/mindspore/ccsrc/pipeline/jit/ps/resource.cc +++ b/mindspore/ccsrc/pipeline/jit/ps/resource.cc @@ -710,7 +710,9 @@ void Resource::GetCompileCacheResource(const py::list &compile_cache_dep_files, MS_LOG(WARNING) << "Check the consistency of dependency files hash failed. Execute all the compilation actions."; return; } - context.set_init_compile_cache(true); + if (!common::UseHostCollective()) { + context.set_init_compile_cache(true); + } compile_cache_manager_->InitCompileCacheHash(compile_cache_dep_files); *compile_cache_consistent = compile_cache_manager_->CheckDepFilesHashConsistency(); if (!*compile_cache_consistent) { diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ge_graph_executor.cc b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ge_graph_executor.cc index 00bf0f410a6..462ec8400af 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ge_graph_executor.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ge_graph_executor.cc @@ -804,8 +804,9 @@ bool GeGraphExecutor::CompileGraph(const KernelGraphPtr &graph, const auto &tensor_order_map = GetParams(graph, &origin_shape); auto &compile_cache_context = CompileCacheContext::GetInstance(); auto use_compile_cache = compile_cache_context.UseCompileCache(); + auto init_compile_cache = compile_cache_context.init_compile_cache(); GEGraphOptimization::GetInstance().OptimizeGEGraph(graph); - if (use_compile_cache) { + if (use_compile_cache && init_compile_cache) { MS_LOG(INFO) << "Use ge compile cache, and skip specific optimization and ge_adapter execution"; if (!BuildFakeGraph(graph)) { return false; @@ -863,8 +864,9 @@ bool GeGraphExecutor::CompileGraph(const FuncGraphPtr &graph, const std::map