Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Unity] Implement relax.Function.bind_params #15626

Merged
merged 4 commits into from
Sep 6, 2023

Conversation

Lunderberg
Copy link
Contributor

Similar to relax.Function.bind_symbolic_vars, implemented in #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.

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.
@tvm-bot
Copy link
Collaborator

tvm-bot commented Aug 27, 2023

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

@Lunderberg
Copy link
Contributor Author

@sunggg This is a follow-up to the BindSymbolicVars commit we made a few weeks ago. Since BindSymbolicVars and BindParams are so similar, I wanted to have the same functionality for both.

Copy link
Contributor

@sunggg sunggg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you @Lunderberg.
Just one basic question, what would be the real use-case for this pass? Is this for multi-gpu?

@Lunderberg
Copy link
Contributor Author

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 True.

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 LiftTransformParams.

@csullivan csullivan merged commit ec4a8b3 into apache:unity Sep 6, 2023
2 checks passed
@csullivan
Copy link
Contributor

Thanks @Lunderberg and @sunggg! This is merged.

@Lunderberg Lunderberg deleted the unity_bind_params branch September 6, 2023 19:25
Lunderberg added a commit to Lunderberg/tvm that referenced this pull request Oct 24, 2023
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.
Lunderberg added a commit to Lunderberg/tvm that referenced this pull request Oct 25, 2023
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.
masahi pushed a commit that referenced this pull request Oct 30, 2023
This test was implemented in #15626,
but was initially disabled as it depended on functionality not
introduced until #15577.  Since that
PR has landed, cleaning up and enabling the unit test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants