diff --git a/python/tvm/relay/backend/contrib/ethosu/codegen.py b/python/tvm/relay/backend/contrib/ethosu/codegen.py index 5a5f1478e16e..e40053d49ac9 100644 --- a/python/tvm/relay/backend/contrib/ethosu/codegen.py +++ b/python/tvm/relay/backend/contrib/ethosu/codegen.py @@ -526,7 +526,8 @@ def relay_to_tir(mod: tvm.ir.IRModule) -> tvm.ir.IRModule: sram = extract_memory_info(workspace_memory_pools.pools[0], memory_pressure) tir_mod = LowerToTIR(_ethos_u55_cascader(sram, util.is_striping_enabled()))(mod) else: - tir_mod = LowerToTIR(copy_constants())(mod) + scheduler = None if util.is_copying_constants_disabled() else copy_constants() + tir_mod = LowerToTIR(scheduler)(mod) return tir_mod diff --git a/python/tvm/relay/backend/contrib/ethosu/util.py b/python/tvm/relay/backend/contrib/ethosu/util.py index f0c753814f63..6533bab7d272 100644 --- a/python/tvm/relay/backend/contrib/ethosu/util.py +++ b/python/tvm/relay/backend/contrib/ethosu/util.py @@ -258,6 +258,12 @@ def is_cascader_enabled(): return compiler_attrs.enable_cascader +def is_copying_constants_disabled() -> bool: + """Determine whether copying constants is disabled for case without cascader""" + compiler_attrs = tvm.get_global_func("relay.ext.ethos-u.get_compiler_attrs")() + return bool(compiler_attrs.disable_copying_constants) + + def is_striping_enabled(): """Determine whether the cascader is enabled""" compiler_attrs = tvm.get_global_func("relay.ext.ethos-u.get_compiler_attrs")() diff --git a/src/relay/backend/contrib/ethosu/compiler_attrs.cc b/src/relay/backend/contrib/ethosu/compiler_attrs.cc index 6c825a18901a..237ccecf54d3 100644 --- a/src/relay/backend/contrib/ethosu/compiler_attrs.cc +++ b/src/relay/backend/contrib/ethosu/compiler_attrs.cc @@ -41,6 +41,7 @@ struct EthosUCompilerConfigNode : public tvm::AttrsNode