-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Unity][Graph matching] Automatically add used-by constraints for is_op pattern
#14439
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1034,15 +1034,6 @@ def main( | |
| matmul2 = is_op("relax.matmul")(inp_pat, K_weight_pat) | ||
| matmul3 = is_op("relax.matmul")(inp_pat, V_weight_pat) | ||
|
|
||
| # TODO(masahi): Automate addition of used_by constraints during is_op | ||
| inp_pat.used_by(matmul1, 0) | ||
| inp_pat.used_by(matmul2, 0) | ||
| inp_pat.used_by(matmul3, 0) | ||
|
|
||
| Q_weight_pat.only_used_by(matmul1, 1) | ||
| K_weight_pat.only_used_by(matmul2, 1) | ||
| V_weight_pat.only_used_by(matmul3, 1) | ||
|
Comment on lines
-1042
to
-1044
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But yeah I guess you meant oftentimes we don't fold Q, K, and V so it is fine if they are being used by others at the same time. |
||
|
|
||
| dfb = QKV_proj["main"].body.blocks[0] | ||
| out = ctx.match_dfb(dfb) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets removed since it is not used anywhere but it touches
PatternContext::Current()(which is nowOptional)