Lunderberg opened a new pull request, #16457: URL: https://github.com/apache/tvm/pull/16457
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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
