manupa-arm commented on code in PR #10862:
URL: https://github.com/apache/tvm/pull/10862#discussion_r857412103
##########
python/tvm/relay/backend/contrib/ethosu/codegen.py:
##########
@@ -362,9 +406,30 @@ def relay_to_tir(mod: tvm.ir.IRModule) -> tvm.ir.IRModule:
gv: "ethos-u" for gv, _ in filter(lambda x: util.is_npu_func(x[1]),
mod.functions.items())
}
mod = mod.with_attr("device_contexts", device_contexts)
- mod = LowerToTIR(SCHEDULER)(mod)
- return mod
+ # Use the cascader if it is enabled for the U55 accelerator, otherwise use
copy_constants
+ # scheduler
+ if util.is_cascader_enabled():
+ assert (
+ util.get_accelerator_config() != "ethos-u65-256"
+ ), "Cascading is not supported for the U65 accelerator"
+
+ workspace_memory_pools = mod.attrs["workspace_memory_pools"]
+
+ assert (
+ workspace_memory_pools
+ ), "Workspace memory pool needs to be provided for the U55 cascader"
+
+ assert (
+ len(workspace_memory_pools.pools) == 1
+ ), "Exactly one workspace pool needs to be provided for the U55
cascader"
+
+ sram = extract_memory_info(workspace_memory_pools.pools[0])
+ tir_mod = LowerToTIR(_ethos_u55_cascader(sram))(mod)
Review Comment:
For a followup : Please consider adsorbing the call to extract_memory_info
inside the cascader. (Sorry for not being clear before). Ideally, we'd want to
remove the "MemoryRegion" construct and to get there the current direction of
travel to confine the usage of it inside the cascader. Therefore the interface
of the cascader should be made to accept MemoryPool(s).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]