Commit 56c984f
authored
[webgpu] Simplify the signature of CanApplyFlashAttention (microsoft#26926)
This pull request simplifies the logic for handling present key/value
tensors in the WebGPU Flash Attention implementation. The main change is
that the responsibility for creating internal present key/value tensors
is moved from the caller to the `ApplyFlashAttention` function itself.
This reduces code duplication and makes the API easier to use.
Additionally, the `CanApplyFlashAttention` function is simplified to
remove unnecessary checks for present key/value tensors.1 parent 4a858a8 commit 56c984f
5 files changed
Lines changed: 22 additions & 15 deletions
File tree
- onnxruntime/contrib_ops/webgpu/bert
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
| 729 | + | |
737 | 730 | | |
738 | | - | |
| 731 | + | |
739 | 732 | | |
740 | 733 | | |
741 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
403 | 419 | | |
404 | 420 | | |
405 | 421 | | |
| |||
532 | 548 | | |
533 | 549 | | |
534 | 550 | | |
535 | | - | |
| 551 | + | |
536 | 552 | | |
537 | 553 | | |
538 | 554 | | |
539 | 555 | | |
540 | 556 | | |
541 | | - | |
542 | | - | |
543 | 557 | | |
544 | 558 | | |
545 | 559 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
| 255 | + | |
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
0 commit comments