-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Unified IR Infra #4617
Comments
Migrated from https://discuss.tvm.ai/t/ir-unified-tvm-ir-infra/4801 |
Nice to consider names, @MarisaKirisame can you also post the name proposal to the original discuss thread to get other people's thoughts. To be clear, the proposal is to name the low-level ir module "axon" |
Move to #4647 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Introduction
The TVM stack has been evolving for more than two years now. The current compiler stack contains several components that were designed at different points in time. This RFC proposes a unified IR infrastructure for the TVM stack by combining past lessons.
From a high-level the proposed infrastructure will consist of:
Unified IR Module and Pass Infra
The main component of our proposal is to introduce a unified IRModule structure that can contain different variants of functions(relay::Function/te::Function). The namespace te(tensor expression) is a tentative namespace for low-level functions, and comments and suggestions about name choices are more than welcome.
This change will simplify the intermediate representation data structures and terminology used in our previous compilation flow, which can be shown as follows:
As shown above, our current flow has different intermediate data structures at different stages (relay::Module, Stmt, LoweredFunc) with different terminologies. Under the new design, we will have a single module structure, and transformations between IRs become ir::Module to ir::Module transformations.
More importantly, we can use specific calling conventions, enabling different function variants to call each other. The following code snippet is a mock-up to demonstrate a module containing both a relay.Function and te.Function. The
relay_add_one
function can call into thete_add_one
function using the destination-passing convention, where outputs are passed as inputs to the function.Enabling both high-level functions(
relay.Function
) and tensor-expression functions to coexist in the same module enables the potential for cross layer optimizations. Of course, most of the transformations will only operate on one type of function and will simply ignore other functions in the same module.Most importantly, the proposed change will minimize concepts for developers. Developers only need to know about ir::Module and runtime::Module. Every transformation is ir::Module -> ir::Module.
AutoTVM and other schedule transformations can be viewed as an intelligent way to transform an ir::Module. We are exploring ways to embed the current tensor expressions as a special type of Function in ir::Module.
Timeline Upgrade Path
Once we agree on the general design, we can step several refactor steps to bring the current codebase to the new IR infrastructure.
The text was updated successfully, but these errors were encountered: