From fc393854fccfd5c38c657e5051e6af9e61cc860a Mon Sep 17 00:00:00 2001 From: VectorSL <864733542@qq.com> Date: Sun, 11 Aug 2024 17:25:33 +0800 Subject: [PATCH] fix export cache --- .../runtime/graph_scheduler/graph_compiler.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/mindspore/ccsrc/runtime/graph_scheduler/graph_compiler.cc b/mindspore/ccsrc/runtime/graph_scheduler/graph_compiler.cc index 967aef12945..cc92a341fa2 100644 --- a/mindspore/ccsrc/runtime/graph_scheduler/graph_compiler.cc +++ b/mindspore/ccsrc/runtime/graph_scheduler/graph_compiler.cc @@ -137,6 +137,23 @@ bool UseCacheToCompileGraphKBK(const FuncGraphPtr &func_graph, const device::Dev return true; } +bool ExportCompileCacheKBK(const FuncGraphPtr &func_graph, const device::DeviceType &device_type) { + if (!CompileCacheEnable()) { + return false; + } + auto &context = CompileCacheContext::GetInstance(); + if (context.FrontGraph() != func_graph) { + return false; + } + if (device_type != device::DeviceType::kAscend) { + return false; + } + if (context.UseCompileCache()) { + return false; + } + return true; +} + bool ExportCompileCache(const FuncGraphPtr &func_graph, const device::DeviceType &device_type) { if (!EnableBackendCompileCache(func_graph, device_type)) { return false; @@ -439,7 +456,7 @@ GraphId CompileAnyTypeInputGraph(const KernelGraphPtr &graph, const AnfNodePtrLi bool UpdateCacheFlag(const FuncGraphPtr &func_graph, const DeviceContext *device_context) { MS_EXCEPTION_IF_NULL(func_graph); MS_EXCEPTION_IF_NULL(device_context); - if (ExportCompileCache(func_graph, device_context->GetDeviceType())) { + if (ExportCompileCacheKBK(func_graph, device_context->GetDeviceType())) { return true; } return false; -- Gitee