From 1da8837aadea5e7b5f17576f89de611485d1ad07 Mon Sep 17 00:00:00 2001 From: Manupa Karunaratne Date: Mon, 28 Mar 2022 15:53:14 +0100 Subject: [PATCH] fixup! [USMP] Adding support for U4 usecase Change-Id: I9509ebb0746bcef6e699db3c7f9daaff0d9841a5 --- src/relay/backend/aot_executor_codegen.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/relay/backend/aot_executor_codegen.cc b/src/relay/backend/aot_executor_codegen.cc index 572c964c612b8..35f3a878065d6 100644 --- a/src/relay/backend/aot_executor_codegen.cc +++ b/src/relay/backend/aot_executor_codegen.cc @@ -723,14 +723,18 @@ class AOTExecutorCodegen : public MixedModeVisitor { * brief Create tir::Var for input/output while updating * the buffer_maps. */ - void CreateIOVar(const Expr& expr, std::string original_name) { + void CreateIOVar(const Expr& expr, const std::string& original_name, + bool use_unique_name = true) { if (expr->IsInstance()) { Tuple tuple = Downcast(expr); for (unsigned i = 0; i < tuple->fields.size(); i++) { CreateIOVar(tuple->fields[i], original_name); } } else { - std::string name = GetUniqueIOVarName(original_name); + std::string name = original_name; + if (use_unique_name) { + name = GetUniqueIOVarName(original_name); + } tir::Var var = tir::Var(name, DataType::Handle()); main_signature_.push_back(var); auto tensor_type = expr->checked_type().as(); @@ -998,7 +1002,10 @@ class AOTExecutorCodegen : public MixedModeVisitor { for (auto input : lowered_main_func->params) { input_vars_.push_back(input); std::string input_name = SanitizeName(input->name_hint()); - CreateIOVar(input, input_name); + // We dont want the compiler changing input names in the + // event of a sanitization collision. Therefore, enforcing + // the var created to use the input_name strictly. + CreateIOVar(input, input_name, /*use_unique_name = */ false); } // Define the storage allocator ids