Commit 7f7fdb0
Aegis-AI
fix(moe): prevent crash when persistent buffer slots are exhausted
When all buffer slots are claimed by speculative-hit routing (ranges.count
== maxBuffers and all experts get different slot assignments), the
force-unwrap on '.first { !usedSlots.contains($0) }!' returns nil and
crashes with _assertionFailure.
Replace the force-unwrap with a guard that sets a slotExhausted flag and
breaks out. When detected, the hit/miss arrays are cleared and we fall
through to the existing full-pread fallback path — same correctness,
no crash.
Fixes SharpAI/SwiftLM#871 parent 86e3f93 commit 7f7fdb0
1 file changed
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
713 | 713 | | |
714 | 714 | | |
715 | 715 | | |
| 716 | + | |
716 | 717 | | |
717 | 718 | | |
718 | 719 | | |
| |||
723 | 724 | | |
724 | 725 | | |
725 | 726 | | |
726 | | - | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
727 | 733 | | |
728 | 734 | | |
729 | 735 | | |
| |||
733 | 739 | | |
734 | 740 | | |
735 | 741 | | |
736 | | - | |
| 742 | + | |
737 | 743 | | |
738 | 744 | | |
739 | 745 | | |
| |||
762 | 768 | | |
763 | 769 | | |
764 | 770 | | |
765 | | - | |
766 | | - | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
767 | 778 | | |
768 | 779 | | |
769 | 780 | | |
| |||
0 commit comments