From b9c95fd5990aa3e9833268b427f36dc61afd2512 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Wed, 14 Jul 2021 17:40:21 +0300 Subject: [PATCH 01/15] [VM] Add imports to new TE in VM compiler --- src/relay/backend/vm/compiler.cc | 9 +++++++-- src/relay/backend/vm/compiler.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/relay/backend/vm/compiler.cc b/src/relay/backend/vm/compiler.cc index 96aa77f286a9..51499d2c3705 100644 --- a/src/relay/backend/vm/compiler.cc +++ b/src/relay/backend/vm/compiler.cc @@ -1184,8 +1184,13 @@ void VMCompiler::Codegen() { } } + // TODO(mikepapdim) replace compiler engine with TE auto compile_engine = CompileEngine::Global(); + auto ext_mods = compile_engine->LowerExternalFunctions(); + + //targets = target + runtime::Module lib; if (funcs.size() > 0) { lib = tvm::build(funcs, target_host_); @@ -1196,8 +1201,8 @@ void VMCompiler::Codegen() { } lib = codegen::CreateMetadataModule(params_, lib, ext_mods, target_host_, runtime::Metadata()); exec_->SetLib(lib); - CompileEngine::Global()->Clear(); -} + CompileEngine::Global()->Clear(); //TODO(mikepapadim)replace compiler engine with TE +} ExprDeviceMap VMCompiler::AnalyzeContext() const { Device default_device; diff --git a/src/relay/backend/vm/compiler.h b/src/relay/backend/vm/compiler.h index 3a3796373a61..181aaff72e0b 100644 --- a/src/relay/backend/vm/compiler.h +++ b/src/relay/backend/vm/compiler.h @@ -45,6 +45,8 @@ #include "../../../runtime/vm/profiler/vm.h" #include "../../backend/compile_engine.h" #include "../../transforms/pass_utils.h" +#include "../te_compiler_cache.h" + namespace tvm { namespace relay { From 451d83836e46c3ebb2079676b4d692907e7a00ff Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Wed, 14 Jul 2021 17:42:56 +0300 Subject: [PATCH 02/15] [VM] Add comments to compile engine usages --- src/relay/backend/vm/compiler.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/relay/backend/vm/compiler.cc b/src/relay/backend/vm/compiler.cc index 51499d2c3705..2018cb695268 100644 --- a/src/relay/backend/vm/compiler.cc +++ b/src/relay/backend/vm/compiler.cc @@ -48,6 +48,7 @@ #include "../../backend/compile_engine.h" #include "../../op/op_common.h" #include "../../transforms/pass_utils.h" +#include "../te_compiler_cache.h" #include "../utils.h" #include "compiler.h" @@ -253,7 +254,7 @@ class VMFunctionCompiler : ExprFunctor { ExprDeviceMap expr_device_map) : last_register_(0), registers_num_(0), - engine_(CompileEngine::Global()), + engine_(CompileEngine::Global()), //TODO: replace with TE context_(context), target_host_(target_host), expr_device_map_(std::move(expr_device_map)) { @@ -465,7 +466,7 @@ class VMFunctionCompiler : ExprFunctor { void EmitShapeFunc(Function func, Array inputs, Array outputs) { // Lower shape function CCacheKey key(func, target_host_); - auto cfunc = engine_->LowerShapeFunc(key); + auto cfunc = engine_->LowerShapeFunc(key); //TODO: replace with TE int op_index = -1; // pick the only function inside the context ICHECK_EQ(cfunc->funcs->functions.size(), 1); @@ -551,7 +552,7 @@ class VMFunctionCompiler : ExprFunctor { CCacheKey key(func, target); auto mangle_fn = [](String name) { return name; }; - auto cfunc = engine_->Lower(key, mangle_fn); + auto cfunc = engine_->Lower(key, mangle_fn); //TODO: replace with TE auto op_index = -1; if (func->GetAttr(attr::kCompiler).defined()) { @@ -858,7 +859,7 @@ class VMFunctionCompiler : ExprFunctor { /*! \brief Total number of virtual registers allocated. */ size_t registers_num_; /*! \brief Compiler engine to lower primitive functions. */ - CompileEngine engine_; + CompileEngine engine_; //TODO: replace with TE /*! \brief Global shared meta data */ VMCompilerContext* context_; /*! \brief Target devices. */ From d53fd1ebce28155c9ed9f2ffeabf415b18b3932e Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Fri, 16 Jul 2021 13:13:25 +0300 Subject: [PATCH 03/15] [VM] Replace depreceated CachedFunc of compile_engine with TE_compiler --- src/relay/backend/vm/compiler.cc | 22 +++++++++------------- src/relay/backend/vm/compiler.h | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/relay/backend/vm/compiler.cc b/src/relay/backend/vm/compiler.cc index 2018cb695268..8a7cefcee195 100644 --- a/src/relay/backend/vm/compiler.cc +++ b/src/relay/backend/vm/compiler.cc @@ -45,12 +45,12 @@ #include #include "../../../target/source/codegen_source_base.h" -#include "../../backend/compile_engine.h" #include "../../op/op_common.h" #include "../../transforms/pass_utils.h" #include "../te_compiler_cache.h" #include "../utils.h" #include "compiler.h" +#include "../te_compiler.h" namespace tvm { namespace relay { @@ -254,7 +254,7 @@ class VMFunctionCompiler : ExprFunctor { ExprDeviceMap expr_device_map) : last_register_(0), registers_num_(0), - engine_(CompileEngine::Global()), //TODO: replace with TE + // engine_(CompileEngine::Global()), //TODO: replace with TE context_(context), target_host_(target_host), expr_device_map_(std::move(expr_device_map)) { @@ -465,8 +465,8 @@ class VMFunctionCompiler : ExprFunctor { void EmitShapeFunc(Function func, Array inputs, Array outputs) { // Lower shape function - CCacheKey key(func, target_host_); - auto cfunc = engine_->LowerShapeFunc(key); //TODO: replace with TE + tec::CCacheKey key(func, target_host_); + auto cfunc = compiler_->LowerShapeFunc(key); //TODO: replace with TE int op_index = -1; // pick the only function inside the context ICHECK_EQ(cfunc->funcs->functions.size(), 1); @@ -550,9 +550,9 @@ class VMFunctionCompiler : ExprFunctor { } } - CCacheKey key(func, target); + tec::CCacheKey key(func, target); auto mangle_fn = [](String name) { return name; }; - auto cfunc = engine_->Lower(key, mangle_fn); //TODO: replace with TE + auto cfunc = compiler_->Lower(key, mangle_fn); //TODO: replace with TE auto op_index = -1; if (func->GetAttr(attr::kCompiler).defined()) { @@ -859,8 +859,7 @@ class VMFunctionCompiler : ExprFunctor { /*! \brief Total number of virtual registers allocated. */ size_t registers_num_; /*! \brief Compiler engine to lower primitive functions. */ - CompileEngine engine_; //TODO: replace with TE - /*! \brief Global shared meta data */ + tvm::relay::tec::TECompiler compiler_; /*! \brief Global shared meta data */ VMCompilerContext* context_; /*! \brief Target devices. */ std::unordered_map targets_; @@ -1185,10 +1184,8 @@ void VMCompiler::Codegen() { } } - // TODO(mikepapdim) replace compiler engine with TE - auto compile_engine = CompileEngine::Global(); - - auto ext_mods = compile_engine->LowerExternalFunctions(); + tvm::relay::tec::TECompiler compiler; + auto ext_mods = compiler->LowerExternalFunctions(); //targets = target @@ -1202,7 +1199,6 @@ void VMCompiler::Codegen() { } lib = codegen::CreateMetadataModule(params_, lib, ext_mods, target_host_, runtime::Metadata()); exec_->SetLib(lib); - CompileEngine::Global()->Clear(); //TODO(mikepapadim)replace compiler engine with TE } ExprDeviceMap VMCompiler::AnalyzeContext() const { diff --git a/src/relay/backend/vm/compiler.h b/src/relay/backend/vm/compiler.h index 181aaff72e0b..ef7f75177148 100644 --- a/src/relay/backend/vm/compiler.h +++ b/src/relay/backend/vm/compiler.h @@ -43,9 +43,9 @@ #include "../../../runtime/vm/naive_allocator.h" #include "../../../runtime/vm/profiler/vm.h" -#include "../../backend/compile_engine.h" #include "../../transforms/pass_utils.h" #include "../te_compiler_cache.h" +#include "../te_compiler.h" namespace tvm { @@ -82,7 +82,7 @@ struct VMCompilerContext { // Device type for constants std::vector const_device_type; // List of cached functions - std::vector cached_funcs; + std::vector cached_funcs; // The functions that have been lowered. std::unordered_map seen_funcs; }; From 37f344e5bb33e3ff525ef0856c971fb822ec1950 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Fri, 16 Jul 2021 14:42:27 +0300 Subject: [PATCH 04/15] [VM] rm compiler engine compiler.cc --- src/relay/backend/vm/compiler.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/relay/backend/vm/compiler.cc b/src/relay/backend/vm/compiler.cc index 8a7cefcee195..c561a84240dc 100644 --- a/src/relay/backend/vm/compiler.cc +++ b/src/relay/backend/vm/compiler.cc @@ -80,6 +80,7 @@ namespace vm { using namespace tvm::runtime; using namespace tvm::runtime::vm; using namespace relay::transform; +using namespace tec; // (@jroesch): VM passes, eventually declare as passes. bool IsClosure(const Function& func); @@ -465,7 +466,7 @@ class VMFunctionCompiler : ExprFunctor { void EmitShapeFunc(Function func, Array inputs, Array outputs) { // Lower shape function - tec::CCacheKey key(func, target_host_); + CCacheKey key(func, target_host_); auto cfunc = compiler_->LowerShapeFunc(key); //TODO: replace with TE int op_index = -1; // pick the only function inside the context @@ -550,7 +551,7 @@ class VMFunctionCompiler : ExprFunctor { } } - tec::CCacheKey key(func, target); + CCacheKey key(func, target); auto mangle_fn = [](String name) { return name; }; auto cfunc = compiler_->Lower(key, mangle_fn); //TODO: replace with TE @@ -859,7 +860,8 @@ class VMFunctionCompiler : ExprFunctor { /*! \brief Total number of virtual registers allocated. */ size_t registers_num_; /*! \brief Compiler engine to lower primitive functions. */ - tvm::relay::tec::TECompiler compiler_; /*! \brief Global shared meta data */ + TECompiler compiler_; + /*! \brief Global shared meta data */ VMCompilerContext* context_; /*! \brief Target devices. */ std::unordered_map targets_; @@ -1184,7 +1186,7 @@ void VMCompiler::Codegen() { } } - tvm::relay::tec::TECompiler compiler; + TECompiler compiler; auto ext_mods = compiler->LowerExternalFunctions(); //targets = target From 0f428cf7e7bf282cec3860133fcff77057c69b45 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Fri, 16 Jul 2021 15:11:31 +0300 Subject: [PATCH 05/15] [VM] Replace compile engine with TECompiler in memory allocator --- src/relay/transforms/memory_alloc.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/relay/transforms/memory_alloc.cc b/src/relay/transforms/memory_alloc.cc index b61567d0bae0..a097b0d1463b 100644 --- a/src/relay/transforms/memory_alloc.cc +++ b/src/relay/transforms/memory_alloc.cc @@ -41,14 +41,17 @@ #include #include -#include "../backend/compile_engine.h" #include "../op/memory/memory.h" #include "../op/vm/vm.h" #include "./pass_utils.h" #include "let_list.h" #include "pattern_utils.h" +#include "../backend/te_compiler_cache.h" +#include "../backend/te_compiler.h" + using namespace tvm::runtime; +using namespace tvm::relay::tec; namespace tvm { namespace relay { @@ -271,9 +274,11 @@ class DialectRewriter : public ExprMutator { Array EmitShapeFunc(LetList* scope, const Function& func, const std::vector& new_args) { Array shape_func_ins; - auto engine = CompileEngine::Global(); + + TECompiler compiler; + CCacheKey key(func, target_host_); - auto cfunc = engine->LowerShapeFunc(key); + auto cfunc = compiler->LowerShapeFunc(key); auto input_states = cfunc->shape_func_param_states; Array is_inputs; From 88707faf94b4a41302f2e399ceb95ad919f22307 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Fri, 16 Jul 2021 18:42:11 +0300 Subject: [PATCH 06/15] [VM] Add relay interface to te_compiler --- python/tvm/relay/backend/te_compiler.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 python/tvm/relay/backend/te_compiler.py diff --git a/python/tvm/relay/backend/te_compiler.py b/python/tvm/relay/backend/te_compiler.py new file mode 100644 index 000000000000..e69de29bb2d1 From 452815d10b5330e548cbbc9208786d92c0ccba94 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Tue, 20 Jul 2021 13:52:44 +0300 Subject: [PATCH 07/15] [Relay] Fix linting errors --- src/relay/backend/vm/compiler.cc | 6 +++--- src/relay/backend/vm/compiler.h | 3 +-- src/relay/transforms/memory_alloc.cc | 7 +++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/relay/backend/vm/compiler.cc b/src/relay/backend/vm/compiler.cc index 392d40c33f59..d07908e6f409 100644 --- a/src/relay/backend/vm/compiler.cc +++ b/src/relay/backend/vm/compiler.cc @@ -47,10 +47,10 @@ #include "../../../target/source/codegen_source_base.h" #include "../../op/op_common.h" #include "../../transforms/pass_utils.h" +#include "../te_compiler.h" #include "../te_compiler_cache.h" #include "../utils.h" #include "compiler.h" -#include "../te_compiler.h" namespace tvm { namespace relay { @@ -859,7 +859,7 @@ class VMFunctionCompiler : ExprFunctor { /*! \brief Total number of virtual registers allocated. */ size_t registers_num_; /*! \brief Compiler engine to lower primitive functions. */ - TECompiler compiler_; + TECompiler compiler_; /*! \brief Global shared meta data */ VMCompilerContext* context_; /*! \brief Target devices. */ @@ -1198,7 +1198,7 @@ void VMCompiler::Codegen() { } lib = codegen::CreateMetadataModule(params_, lib, ext_mods, target_host_, runtime::Metadata()); exec_->SetLib(lib); -} +} ExprDeviceMap VMCompiler::AnalyzeContext() const { Device default_device; diff --git a/src/relay/backend/vm/compiler.h b/src/relay/backend/vm/compiler.h index ef7f75177148..096f286d8d92 100644 --- a/src/relay/backend/vm/compiler.h +++ b/src/relay/backend/vm/compiler.h @@ -44,9 +44,8 @@ #include "../../../runtime/vm/naive_allocator.h" #include "../../../runtime/vm/profiler/vm.h" #include "../../transforms/pass_utils.h" -#include "../te_compiler_cache.h" #include "../te_compiler.h" - +#include "../te_compiler_cache.h" namespace tvm { namespace relay { diff --git a/src/relay/transforms/memory_alloc.cc b/src/relay/transforms/memory_alloc.cc index a097b0d1463b..657e2c392455 100644 --- a/src/relay/transforms/memory_alloc.cc +++ b/src/relay/transforms/memory_alloc.cc @@ -41,15 +41,14 @@ #include #include +#include "../backend/te_compiler.h" +#include "../backend/te_compiler_cache.h" #include "../op/memory/memory.h" #include "../op/vm/vm.h" #include "./pass_utils.h" #include "let_list.h" #include "pattern_utils.h" -#include "../backend/te_compiler_cache.h" -#include "../backend/te_compiler.h" - using namespace tvm::runtime; using namespace tvm::relay::tec; @@ -275,7 +274,7 @@ class DialectRewriter : public ExprMutator { const std::vector& new_args) { Array shape_func_ins; - TECompiler compiler; + TECompiler compiler; CCacheKey key(func, target_host_); auto cfunc = compiler->LowerShapeFunc(key); From a30cf6acbebddc7afea357583f485e5dd31db0ac Mon Sep 17 00:00:00 2001 From: YuchenJin Date: Thu, 22 Jul 2021 16:29:56 +0000 Subject: [PATCH 08/15] Move TEcompiler to VMCompilerContext; add global func into IRmodule when lowering in TEcompiler --- src/relay/backend/te_compiler.cc | 1 + src/relay/backend/vm/compiler.cc | 11 +++-------- src/relay/backend/vm/compiler.h | 2 ++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/relay/backend/te_compiler.cc b/src/relay/backend/te_compiler.cc index 9a0d2a2d7f43..57f299be6024 100644 --- a/src/relay/backend/te_compiler.cc +++ b/src/relay/backend/te_compiler.cc @@ -195,6 +195,7 @@ class TECompilerImpl : public TECompilerNode { auto target = Target("ext_dev"); auto global_var = GlobalVar(func_name); global_var->checked_type_ = key->source_func->checked_type(); + ir_module->Add(global_var, key->source_func); value->cached_func = CachedFunc(target, global_var, {}, {}, te::Schedule(), {}, ir_module); return value; } diff --git a/src/relay/backend/vm/compiler.cc b/src/relay/backend/vm/compiler.cc index bbca9b4c05fa..d97384bd1295 100644 --- a/src/relay/backend/vm/compiler.cc +++ b/src/relay/backend/vm/compiler.cc @@ -47,8 +47,6 @@ #include "../../../target/source/codegen_source_base.h" #include "../../op/op_common.h" #include "../../transforms/pass_utils.h" -#include "../te_compiler.h" -#include "../te_compiler_cache.h" #include "../utils.h" #include "compiler.h" @@ -466,7 +464,7 @@ class VMFunctionCompiler : ExprFunctor { void EmitShapeFunc(Function func, Array inputs, Array outputs) { // Lower shape function CCacheKey key(func, target_host_); - auto cfunc = compiler_->LowerShapeFunc(key); + auto cfunc = context_->compiler->LowerShapeFunc(key); int op_index = -1; // pick the only function inside the context ICHECK_EQ(cfunc->funcs->functions.size(), 1); @@ -552,7 +550,7 @@ class VMFunctionCompiler : ExprFunctor { CCacheKey key(func, target); auto mangle_fn = [](String name) { return name; }; - auto cfunc = compiler_->Lower(key, mangle_fn); + auto cfunc = context_->compiler->Lower(key, mangle_fn); auto op_index = -1; if (func->GetAttr(attr::kCompiler).defined()) { @@ -858,8 +856,6 @@ class VMFunctionCompiler : ExprFunctor { size_t last_register_; /*! \brief Total number of virtual registers allocated. */ size_t registers_num_; - /*! \brief Compiler engine to lower primitive functions. */ - TECompiler compiler_; /*! \brief Global shared meta data */ VMCompilerContext* context_; /*! \brief Target devices. */ @@ -1185,8 +1181,7 @@ void VMCompiler::Codegen() { } } - TECompiler compiler; - auto ext_mods = compiler->LowerExternalFunctions(); + auto ext_mods = context_.compiler->LowerExternalFunctions(); runtime::Module lib; if (funcs.size() > 0) { diff --git a/src/relay/backend/vm/compiler.h b/src/relay/backend/vm/compiler.h index 096f286d8d92..a05c52ced07f 100644 --- a/src/relay/backend/vm/compiler.h +++ b/src/relay/backend/vm/compiler.h @@ -76,6 +76,8 @@ struct VMCompilerContext { TagMap tag_map; // Map from global var to a unique integer GlobalMap global_map; + // TEcompiler for lowering + tec::TECompiler compiler; // List of constants std::vector constants; // Device type for constants From 7dd9282b5fac5dd69bb865ec3ed4cdd25cca3393 Mon Sep 17 00:00:00 2001 From: YuchenJin Date: Thu, 22 Jul 2021 17:09:38 +0000 Subject: [PATCH 09/15] add back the check --- src/relay/backend/vm/compiler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/relay/backend/vm/compiler.cc b/src/relay/backend/vm/compiler.cc index d97384bd1295..df6f6e8c8e8e 100644 --- a/src/relay/backend/vm/compiler.cc +++ b/src/relay/backend/vm/compiler.cc @@ -1171,7 +1171,7 @@ void VMCompiler::Codegen() { if (target->kind->device_type == kDLExtDev) { // Collect metadata in functions that are handled by external codegen. auto name = cfunc->prim_fn_var->name_hint; - // ICHECK(mod->ContainGlobalVar(name)); + ICHECK(mod->ContainGlobalVar(name)); Function func = Downcast(mod->Lookup(name)); backend::UpdateConstants(func, ¶ms_); } else if (funcs.count(target) == 0) { From 3234a773482f5355fe5dc49995f2baa34d51d48e Mon Sep 17 00:00:00 2001 From: YuchenJin Date: Mon, 26 Jul 2021 13:09:02 -0700 Subject: [PATCH 10/15] skip the check for ext func in tecompiler --- src/relay/backend/te_compiler.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/relay/backend/te_compiler.cc b/src/relay/backend/te_compiler.cc index 57f299be6024..17d17dd073d9 100644 --- a/src/relay/backend/te_compiler.cc +++ b/src/relay/backend/te_compiler.cc @@ -350,6 +350,9 @@ class LowerTensorExpr : public ExprMutator { Map prim_fns; for (auto prim_fn : ext_func->funcs->functions) { + if (prim_fn.second->GetAttr(attr::kCompiler).defined()) { + continue; + } CHECK(prim_fn.second.as()) << "must be a prim fn"; prim_fns.Set(prim_fn.first, Downcast(prim_fn.second)); } From 9ca3ffeeacd2cb448cdea932f72e9dc9823689be Mon Sep 17 00:00:00 2001 From: YuchenJin Date: Mon, 2 Aug 2021 16:50:12 -0700 Subject: [PATCH 11/15] skip tvm::build for external functions --- src/relay/backend/build_module.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/relay/backend/build_module.cc b/src/relay/backend/build_module.cc index ea53c34c793b..4132ea338e72 100644 --- a/src/relay/backend/build_module.cc +++ b/src/relay/backend/build_module.cc @@ -540,6 +540,11 @@ class RelayBuildModule : public runtime::ModuleNode { auto lowered_funcs = executor_codegen_->GetIRModule(); + // No need to build for external functions. + if (lowered_funcs.find("ext_dev") != lowered_funcs.end()) { + lowered_funcs.Set("ext_dev", IRModule()); + } + // Generate a placeholder function that attaches linked params as its arguments. if (target_host->GetAttr("link-params").value_or(Bool(false))) { CHECK(pf != nullptr) << "Unable to link-params with no target_host and no llvm codegen."; From 0e823cee3f5dd7215806126144d95b293719b8fa Mon Sep 17 00:00:00 2001 From: YuchenJin Date: Tue, 3 Aug 2021 08:01:37 -0700 Subject: [PATCH 12/15] trigger ci From c6f7d26e0b4ade48c21dd4a874b4c445edbb594d Mon Sep 17 00:00:00 2001 From: YuchenJin Date: Wed, 4 Aug 2021 08:50:10 -0700 Subject: [PATCH 13/15] retrigger ci From 03d1fdfc19659cb04e2570c9d4bd631f5e9163d1 Mon Sep 17 00:00:00 2001 From: YuchenJin Date: Wed, 4 Aug 2021 20:22:58 -0700 Subject: [PATCH 14/15] retrigger ci From 2aa311470d732d6c1567066b6e4f2a86c2dc3dda Mon Sep 17 00:00:00 2001 From: YuchenJin Date: Sun, 8 Aug 2021 06:02:14 -0700 Subject: [PATCH 15/15] remove the unnecessary loop in tecompiler --- src/relay/backend/te_compiler.cc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/relay/backend/te_compiler.cc b/src/relay/backend/te_compiler.cc index 17d17dd073d9..7846ac91be7d 100644 --- a/src/relay/backend/te_compiler.cc +++ b/src/relay/backend/te_compiler.cc @@ -348,15 +348,6 @@ class LowerTensorExpr : public ExprMutator { << ext_func->prim_fn_var->name_hint; Map prim_fns; - - for (auto prim_fn : ext_func->funcs->functions) { - if (prim_fn.second->GetAttr(attr::kCompiler).defined()) { - continue; - } - CHECK(prim_fn.second.as()) << "must be a prim fn"; - prim_fns.Set(prim_fn.first, Downcast(prim_fn.second)); - } - relay::Function func_with_metadata = func; func_with_metadata = WithAttr(func_with_metadata, "prim_fn_var", ext_func->prim_fn_var); func_with_metadata = WithAttr(func_with_metadata, "prim_funcs", prim_fns);