Commit 38b2261
committed
Update on "[Executorch][llm] Add ring buffer based kv cache and mask calculation to MHA"
Leveraging previous work now we allow MHA to have ring buffer cache. If ring buffer cache is used
then we query the mask from kv cache and use that for sdpa instead of using precalculated mask.
In this process we had to adjsut ring buffer implementation to allow keeping the context of
full sliding window. See code for comment.
Differential Revision: [D73891425](https://our.internmc.facebook.com/intern/diff/D73891425/)
[ghstack-poisoned]File tree
2 files changed
+55
-2
lines changed- backends/cadence/aot
- tests
2 files changed
+55
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
888 | 891 | | |
889 | 892 | | |
890 | 893 | | |
| |||
908 | 911 | | |
909 | 912 | | |
910 | 913 | | |
911 | | - | |
| 914 | + | |
912 | 915 | | |
913 | 916 | | |
914 | 917 | | |
| |||
918 | 921 | | |
919 | 922 | | |
920 | 923 | | |
921 | | - | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
922 | 928 | | |
923 | 929 | | |
924 | 930 | | |
925 | 931 | | |
926 | 932 | | |
927 | 933 | | |
928 | 934 | | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
929 | 938 | | |
930 | 939 | | |
931 | 940 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
587 | 609 | | |
588 | 610 | | |
589 | 611 | | |
| |||
622 | 644 | | |
623 | 645 | | |
624 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
625 | 669 | | |
626 | 670 | | |
627 | 671 | | |
| |||
0 commit comments