[Unity][CodeGen] RunCodegen based on externally-exposed functions - #16422
Merged
vinx13 merged 2 commits intoJan 30, 2024
Merged
Conversation
* `IRModule.clone`: Clone the module. While in C++, a module can be copied using `IRModule::CopyOnWrite()`, copying a module in Python required passing all members into the `IRModule` initializer. The `IRModule.clone` method provides an easier way to copy an `IRModule` from python. * `IRModule.__delitem__`: Remove a function from the module. This exposes the C++ method `IRModuleNode::Remove` for use in the python API. This uses the python `del` keyword, similar to a native python list. Similar to the existing `IRModule.__getitem__`, this can be called with either a `GlobalVar` or a python string. * `IRModule.__contains__`: Check if a function is in the module. This allows the pythone keyword `in` to check if a module contains a specific function. Similar to the existing `IRModule.__getitem__`, this can be called either with a `GlobalVar` (`if gvar in mod`) or with a python string (`if "function_name" in mod`).
Lunderberg
force-pushed
the
unity_check_func_attr_in_relax_codegen
branch
2 times, most recently
from
January 23, 2024 16:24
2bf368d to
9a1d724
Compare
Prior to this commit, `relax.transform.RunCodegen` required a list of entry functions for a module, defaulting to `"main"` if not specified. The list of entry functions is duplicate information that could be inferred from the module, and should not be required from the user. This commit updates `RunCodegen` to treat all externally-exposed functions as entry points, in the same manner as `DeadCodeElimination`. For backwards compatibility, the `entry_functions` argument is still accepted, and is used to augment the list of externally-exposed functions.
Lunderberg
force-pushed
the
unity_check_func_attr_in_relax_codegen
branch
from
January 25, 2024 15:32
9a1d724 to
762e229
Compare
vinx13
approved these changes
Jan 30, 2024
elvin-n
pushed a commit
to Deelvin/tvm
that referenced
this pull request
Mar 19, 2024
…ache#16422) * [IR] Add utility methods to IRModule * `IRModule.clone`: Clone the module. While in C++, a module can be copied using `IRModule::CopyOnWrite()`, copying a module in Python required passing all members into the `IRModule` initializer. The `IRModule.clone` method provides an easier way to copy an `IRModule` from python. * `IRModule.__delitem__`: Remove a function from the module. This exposes the C++ method `IRModuleNode::Remove` for use in the python API. This uses the python `del` keyword, similar to a native python list. Similar to the existing `IRModule.__getitem__`, this can be called with either a `GlobalVar` or a python string. * `IRModule.__contains__`: Check if a function is in the module. This allows the pythone keyword `in` to check if a module contains a specific function. Similar to the existing `IRModule.__getitem__`, this can be called either with a `GlobalVar` (`if gvar in mod`) or with a python string (`if "function_name" in mod`). * [Unity][CodeGen] RunCodegen based on externally-exposed functions Prior to this commit, `relax.transform.RunCodegen` required a list of entry functions for a module, defaulting to `"main"` if not specified. The list of entry functions is duplicate information that could be inferred from the module, and should not be required from the user. This commit updates `RunCodegen` to treat all externally-exposed functions as entry points, in the same manner as `DeadCodeElimination`. For backwards compatibility, the `entry_functions` argument is still accepted, and is used to augment the list of externally-exposed functions.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prior to this commit,
relax.transform.RunCodegenrequired a list of entry functions for a module, defaulting to"main"if not specified. The list of entry functions is duplicate information that could be inferred from the module, and should not be required from the user. This commit updatesRunCodegento treat all externally-exposed functions as entry points, in the same manner asDeadCodeElimination.For backwards compatibility, the
entry_functionsargument is still accepted, and is used to augment the list of externally-exposed functions.