[CUBLAS] Add cuBLAS as a Relay partitioning target (BYOC)#10820
Merged
mbrookhart merged 2 commits intoapache:mainfrom Mar 30, 2022
Merged
[CUBLAS] Add cuBLAS as a Relay partitioning target (BYOC)#10820mbrookhart merged 2 commits intoapache:mainfrom
mbrookhart merged 2 commits intoapache:mainfrom
Conversation
This PR adds a partitioning pass for cuBLAS so that supported Relay patterns can be offloaded to cuBLAS. This initial commit only adds offloading support for nn.matmul. Although cuBLAS is already enabled in TVM by using strategy selection in TE, by exposing it explicitly as a Relay partitioning target we can more precisely describe how to execute a model in Relay. This is desirable particularly in the Collage effort to improve multi-backend graph partitioning.
Contributor
Author
mbs-octoml
reviewed
Mar 29, 2022
Contributor
mbs-octoml
left a comment
There was a problem hiding this comment.
Quite nice I think, thanks. It will be fun to see this used for complex patterns.
When we add the second+ examples I think we can consider:
- removing per-op boilerplate, since placeholder construction, create_schedule and build will always be the same
- avoiding the tvm.build entry point since I believe the support for schedules & tensors is now considered anachronistic. Perhaps a tvm.build_te(op, placeholders, target, name.
Contributor
Author
|
Thanks @mbs-octoml, I've refactored both the 'lower funcs' and tests to extract all the boilerplate into reusable code. I've also switched to first using create_prim_func, then I call tvm.build on the resulting TIR. |
Contributor
|
thanks @mbaret LGTM |
mbrookhart
approved these changes
Mar 30, 2022
Contributor
|
Thanks @mbaret @mbs-octoml @mikepapadim |
pfk-beta
pushed a commit
to pfk-beta/tvm
that referenced
this pull request
Apr 11, 2022
* [CUBLAS] Add cuBLAS as a Relay partitioning target (BYOC) This PR adds a partitioning pass for cuBLAS so that supported Relay patterns can be offloaded to cuBLAS. This initial commit only adds offloading support for nn.matmul. Although cuBLAS is already enabled in TVM by using strategy selection in TE, by exposing it explicitly as a Relay partitioning target we can more precisely describe how to execute a model in Relay. This is desirable particularly in the Collage effort to improve multi-backend graph partitioning. * Refactor to remove boilerplate
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a partitioning pass for cuBLAS so that supported Relay patterns can be offloaded to cuBLAS. This initial commit only adds offloading support for nn.matmul.
Although cuBLAS is already enabled in TVM by using strategy selection in TE, by exposing it explicitly as a Relay partitioning target we can more precisely describe how to execute a model in Relay. This is desirable particularly in the Collage effort to improve multi-backend graph partitioning.