From 5c19344d968c50f3a86b99c2254666977d8b54b8 Mon Sep 17 00:00:00 2001 From: l00278812 Date: Thu, 29 Dec 2022 20:07:47 +0800 Subject: [PATCH] fixed 2acd284 from https://gitee.com/l00278812/tensorflow/pulls/1906 enable lazy_recompile when enable jit_compile --- tf_adapter/kernels/geop_npu.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc index 3f7ebb81c..55b90264d 100644 --- a/tf_adapter/kernels/geop_npu.cc +++ b/tf_adapter/kernels/geop_npu.cc @@ -328,6 +328,9 @@ void GeOp::Initialize(OpKernelConstruction *ctx) { ctx->GetAttr("_graph_parallel_option_path", &graph_parallel_option_path_); ctx->GetAttr("_recompute_mode", &recompute_mode_); ctx->GetAttr("_dynamic_input", &dynamic_input_); + string jit_compile; + ctx->GetAttr("_jit_compile", &jit_compile); + jit_compile_ = jit_compile == "1" ? true : false; if (!dynamic_input_.empty() && dynamic_input_ == "1") { jit_compile_ = true; is_getnext_dynamic_shape_ = true; @@ -724,7 +727,8 @@ void GeOp::ComputeAsync(OpKernelContext *ctx, DoneCallback done) { // if input shapes changed, cache graphs uint32_t cache_graph_id = graph_id_; bool is_tuning = (!init_options_["ge.jobType"].empty()) && (!init_options_["ge.tuningPath"].empty()); - bool is_lazy_recompile_mode = (dynamic_input_ == "1") && (dynamic_graph_execute_mode_ == "lazy_recompile"); + bool is_lazy_recompile_mode = ((dynamic_input_ == "1") && (dynamic_graph_execute_mode_ == "lazy_recompile")) + || ((dynamic_input_ == "0") && jit_compile_); ADP_LOG(INFO) << "is_set_dynamic_config: " << is_set_dynamic_config << " is_tuning: " << is_tuning << " is_lazy_recompile_mode: " << is_lazy_recompile_mode; -- Gitee