-
Notifications
You must be signed in to change notification settings - Fork 58
[DISCUSS] Relax minimum build pipeline #49
Comments
Some comments:
|
Thanks @ZihengJiang!
|
The third point sounds strange to me. It looks like that the executor type is decided by Another question is why we choose to use I don't have further comment besides of this. I would suggest to put this doc in the last section of https://github.com/tlc-pack/relax/wiki/Relax-Compilation-MVP-Design, since it is most about the building interface. |
"Another question is why we choose to use rt_mod["create_executor"] such syntax instead of create_executor(rt_mod)?" Good question and happy to discuss it! First of all, I think it's good to have a unified API to create executor and run the executor. Since And this syntax is the same as the current syntax to create a graph executor with the factory class, except I think using |
If we are going to reuse relax compilaton MVP, let us rename that to relax minimum build to include the broader vision. |
Hi, @YuchenJin. Thank you for the great proposal!
|
Thanks @sunggg, these are great questions!
class MyModule:
@R.func
def relax_func(...):
# specify compiler/executor with function attributes
R.func_attrs(
"target": {
"kind": "cuda",
...
"compiler": "vm",
"executor": "vm-cudagraph",
}
)
...
@R.func
def trt_func(...):
R.func_attrs(
"target": {
"kind": "cuda",
...
"compiler": "tensorrt",
"executor": "tensorrt",
}
) In this case,
|
Key goals
In relax, we want to have a unified and minimum build API that maps
IRModule
→runtime.Module
. Thetvm.relax.build(mod: IRmodule)
can build any IRModule no matter what transformations have been applied to the input IRModule. This minimum build will enable flexible and customizable compilation pipelines without the need to hack into the core of the compiler, and allow us to explore new space. We propose the following interface, and would like to hear your ideas!Interface
The build API accepts two inputs: an input IRModule(mixed Relax/TIR functions) to build, the target to be built for.
The minimum build pipeline should include passes
ToNonDataflow
,CallDPSRewrite
,VMMemoryLower
, andVMShapeLower
How to implement
The estimated amount of work(~ a few hundred loc)
VMExecutorFactory
as a wrapper class to create VM executor.runtime.Module
will only contain compiled TIR primfuncs.vm = relax.VirtualMachine(ex, tvm.cpu(), mod=lib)
, we need to make it to takeVMExecutorFactory
instead.The following code snippet shows the build API and how to create an executor and run a relax program:
The text was updated successfully, but these errors were encountered: