Last active
August 25, 2022 07:35
-
-
Save gangmul12/083f71d86bad9d4943c216f88a5cc32e to your computer and use it in GitHub Desktop.
relay to tir without any schedule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
target "lwc" is custom lwc, with only definition, and without any implementation. | |
""" | |
def get_lowered_tir(mod): | |
""" | |
Argument | |
======== | |
mod : IRModule that contains RelayOp only | |
Returns | |
======== | |
ret : IRModule that contains TIR only | |
""" | |
LowerTE = tvm._ffi.get_global_func("relay.tec.LowerTE") | |
host_target = tvm.target.Target("llvm") | |
prim_target = tvm.target.Target("lwc", host=host_target) | |
ctxt = tvm.transform.PassContext() | |
config = tvm.target.make_compilation_config(ctxt, prim_target) | |
mod = tvm.relay.transform.PlanDevices(config)(mod) | |
mod = tvm.relay.transform.FuseOps(fuse_opt_level=0)(mod) | |
mod = tvm.relay.transform.InferType()(mod) | |
mod = LowerTE("default", config)(mod) | |
return mod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment