forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Relax] Implement Function.check_for_special_case
If a dynamic model is frequently called with specific arguments or shapes of arguments, performance may be improved by generating to specialized versions of the model. Previously, specialized versions of a relax function `func` could be generated using `func.bind_params` and `func.bind_symbolic_vars`. However, use of these specialized versions requires the calling scope to explicitly check the preconditions of each kernel and call the appropriate one. This commit implements a new utility, `check_for_special_case`, which handles both the generating of the special case, and checking whether the special case applies. The function's user-facing signature is unmodified, while internally it delegates to either the original function or the specialized version depending on the result of the check. This allows optimized kernels for specific static shapes to be introduced solely by changing the optimization pipeline, with no changes required in the calling scope.
- Loading branch information
1 parent
c20cdaf
commit 8b94f7c
Showing
7 changed files
with
476 additions
and
26 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
Oops, something went wrong.