Skip to content

Commit

Permalink
fixup! [USMP] Adding support for U4 usecase
Browse files Browse the repository at this point in the history
Change-Id: I9509ebb0746bcef6e699db3c7f9daaff0d9841a5
  • Loading branch information
manupak committed Mar 28, 2022
1 parent 2194a56 commit 1da8837
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/relay/backend/aot_executor_codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<TupleNode>()) {
Tuple tuple = Downcast<Tuple>(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<TensorTypeNode>();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1da8837

Please sign in to comment.