[Unity] Implement relax.Function.bind_params#15626
Conversation
Similar to `relax.Function.bind_symbolic_vars`, implemented in apache#15509, this commit introduces `relax.Function.bind_params` to allow Relax parameters to be manipulated on a per-function basis. This utility function and the existing `BindParams` transform both use the same underlying implementation.
|
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.
Generated by tvm-bot |
|
@sunggg This is a follow-up to the |
sunggg
left a comment
There was a problem hiding this comment.
LGTM! Thank you @Lunderberg.
Just one basic question, what would be the real use-case for this pass? Is this for multi-gpu?
|
At the moment, this would primarily be to write a single Relax function, then manually manipulate it into a specialized form. For example, writing an attention function that accepts a boolean filter tensor, then using BindParams to make a sibling function that replaces it with a constant tensor which o Lu contains In the past, this would have been used to statically bind model parameters into an end-to-end model. However, since that requires the compiling machine to have sufficient RAM, it isn’t as flexible as the |
|
Thanks @Lunderberg and @sunggg! This is merged. |
This test was implemented in apache#15626, but was initially disabled as it depended on functionality not introduced until apache#15577. Since that PR has landed, cleaning up and enabling the unit test.
This test was implemented in apache#15626, but was initially disabled as it depended on functionality not introduced until apache#15577. Since that PR has landed, cleaning up and enabling the unit test.
Similar to
relax.Function.bind_symbolic_vars, implemented in #15509, this commit introducesrelax.Function.bind_paramsto allow Relax parameters to be manipulated on a per-function basis. This utility function and the existingBindParamstransform both use the same underlying implementation.