From 78d3c3318bcfa3d800f9c437872f5fa245d202f9 Mon Sep 17 00:00:00 2001 From: zhangzhaoju Date: Mon, 17 May 2021 17:33:16 +0800 Subject: [PATCH] Delete the invalid cache --- mindspore/ccsrc/pipeline/jit/pipeline.cc | 1 - mindspore/ccsrc/vm/backend.cc | 7 ------- mindspore/ccsrc/vm/segment_runner.cc | 9 --------- mindspore/ccsrc/vm/segment_runner.h | 5 ----- 4 files changed, 22 deletions(-) diff --git a/mindspore/ccsrc/pipeline/jit/pipeline.cc b/mindspore/ccsrc/pipeline/jit/pipeline.cc index ab7b1a43e2e..8ba0fedf56d 100644 --- a/mindspore/ccsrc/pipeline/jit/pipeline.cc +++ b/mindspore/ccsrc/pipeline/jit/pipeline.cc @@ -1171,7 +1171,6 @@ void ClearResAtexit() { PrimBpropOptimizer::GetPrimBpropOptimizerInst().Clear(); abstract::ClearPrimEvaluatorMap(); - compile::ClearConvertCache(); pipeline::GetMethodMap().clear(); pipeline::GetAttrMap().clear(); pipeline::ExecutorPy::ClearRes(); diff --git a/mindspore/ccsrc/vm/backend.cc b/mindspore/ccsrc/vm/backend.cc index b739b88c937..592b4dadc35 100644 --- a/mindspore/ccsrc/vm/backend.cc +++ b/mindspore/ccsrc/vm/backend.cc @@ -50,10 +50,6 @@ LinConvertResult MsBackend::MsConvert(const GraphSegmentPtr &segment, const std: MS_LOG(DEBUG) << "MsConvert"; MS_EXCEPTION_IF_NULL(segment); MS_EXCEPTION_IF_NULL(MsContext::GetInstance()); - auto cached = g_ConvertCache.find(segment); - if (cached != g_ConvertCache.end()) { - return cached->second; - } LinConvertResult result; FuncGraphPtr fg; AnfNodePtrList inputs; @@ -107,9 +103,6 @@ LinConvertResult MsBackend::MsConvert(const GraphSegmentPtr &segment, const std: result.graph_id = graph_id; graph_id_map_[graph_id] = result; - if (!pynative_mode) { - (void)g_ConvertCache.emplace(segment, result); - } return result; } diff --git a/mindspore/ccsrc/vm/segment_runner.cc b/mindspore/ccsrc/vm/segment_runner.cc index 482453231fb..dd446956375 100644 --- a/mindspore/ccsrc/vm/segment_runner.cc +++ b/mindspore/ccsrc/vm/segment_runner.cc @@ -36,9 +36,6 @@ namespace mindspore { namespace compile { -// cached conversion -ConvertCache g_ConvertCache; -void ClearConvertCache() { g_ConvertCache.clear(); } namespace { // Return the list of nodes whose values are required beyond this segment. @@ -178,11 +175,6 @@ std::tuple TransformSegmentToAnfGr template LinConvertResult Convert(const GraphSegmentPtr &segment, const std::string &) { MS_EXCEPTION_IF_NULL(segment); - auto cached = g_ConvertCache.find(segment); - if (cached != g_ConvertCache.end()) { - return cached->second; - } - LinConvertResult result; FuncGraphPtr fg = nullptr; @@ -202,7 +194,6 @@ LinConvertResult Convert(const GraphSegmentPtr &segment, const std::string &) { result.outputs = outputs; result.graph_id = UINT32_MAX; - (void)g_ConvertCache.emplace(segment, result); return result; } diff --git a/mindspore/ccsrc/vm/segment_runner.h b/mindspore/ccsrc/vm/segment_runner.h index 316fed57ca1..841d3ce4e9b 100644 --- a/mindspore/ccsrc/vm/segment_runner.h +++ b/mindspore/ccsrc/vm/segment_runner.h @@ -40,13 +40,8 @@ struct LinConvertResult { }; using LinkFuncType = std::function; -using ConvertCache = std::unordered_map; extern LinkFuncType MsVmConvert; -extern ConvertCache g_ConvertCache; extern std::set backend_list; - -void ClearConvertCache(); - std::tuple TransformSegmentToAnfGraph(const AnfNodePtrList &lst); } // namespace compile } // namespace mindspore