Uh oh!
There was an error while loading. Please reload this page.
[Unity][BYOC] Fuse attention pattern with strided_slice - #14649
Merged
Conversation
This PR expands the support for fused stacked attention patterns strating with `strided_slice`. Initially, we only support fused stacked attention pattern starting with `split` in apache#14608. But with the help of apache#14583, we may have similar patterns starting with `strided_slice` as well.
tvm-bot
commented
Apr 17, 2023
Collaborator
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 |
vinx13
reviewed
Apr 17, 2023
| elif start_op == "strided_slice": | ||
| query_raw = is_op("relax.strided_slice")(stacked_qkv) | ||
| key_raw = is_op("relax.strided_slice")(stacked_qkv) | ||
| value_raw = is_op("relax.strided_slice")(stacked_qkv) |
Member
There was a problem hiding this comment.
we will also need to check the begin/end in strides_slice if value has a different sequence length
Member
I found that |
masahi
reviewed
Apr 17, 2023
| k = R.reshape(qkv_tuple[1], [b, s, n, h]) | ||
| v = R.reshape(qkv_tuple[2], [b, s, n, h_v]) | ||
| elif op == "strided_slice": | ||
| qkv_tuple = R.split(qkv, [n * h, n * h * 2], axis=2) |
ContributorAuthor
There was a problem hiding this comment.
yes, this is useless from copy and paste.
masahi
approved these changes
Apr 18, 2023
cyx-6 added a commit
to cyx-6/tvm
that referenced
this pull request
Apr 18, 2023
This PR is a follow up for apache#14608 and apache#14649. In this PR, we add the checks for the fused stacked attention patterns. So we only enable the fusion of `stacked_qkv` with `ndim=3` and the `split/strided_slice axis=2`.
cyx-6 added a commit
that referenced
this pull request
Apr 19, 2023
* [Unity][BYOC] Add check for stacked attention patterns This PR is a follow up for #14608 and #14649. In this PR, we add the checks for the fused stacked attention patterns. So we only enable the fusion of `stacked_qkv` with `ndim=3` and the `split/strided_slice axis=2`. * check the order of strided_slice
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 freeto 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 expands the support for fused stacked attention patterns strating with
strided_slice. Initially, we only support fused stacked attention pattern starting withsplitin #14608. But with the help of #14583, we may have similar patterns starting withstrided_sliceas well.