-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Relax] Allow DeadCodeElimination within ApplyPassToFunction (#16801)
The `tvm.ir.transform.ApplyPassToFunction` allows a transform to be applied selectively to some portions of a `IRModule`, without applying to the entire `IRModule`. For example, to apply an optimization pass (e.g. `relax.transform.ExpandMatmulOfSum`) or an interface-altering pass (e.g. `relax.transform.BundleModelParams`) to specific functions. It does so by generating an intermediate `IRModule` containing only the functions specified, applying the transform to that intermediate, then merging the results. When using `ApplyPassToFunction` to apply `DeadCodeElimination`, or a pipeline containing `DeadCodeElimination`, this intermediate `IRModule` may contain calls to `GlobalVar` instances that are not within the intermediate `IRModule`. Prior to this commit, this resulted in an error being thrown when collecting the call graph. This commit updates `DeadCodeElimination` to instead handle incomplete call-graph collection.
- Loading branch information
1 parent
35c6143
commit 545e097
Showing
3 changed files
with
202 additions
and
12 deletions.
There are no files selected for viewing
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
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
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