Commit fc360e5
gemma4: fix prefix cache miss — add snapshot_save in generate/restore paths
The Gemma4 backend was missing the snapshot_save(req.snap_slot) call after
prefill. The prefix cache registered entries (confirm_inline_snap), but the
actual KV data was never stored. On subsequent requests, restore_and_generate
found snapshots_[slot].ctx == nullptr → 'bad slot' error → 0 output tokens.
Fix: add inline snapshot save after prefill in both generate() and
restore_and_generate(), matching the pattern used by Qwen3/Qwen35 backends.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 1090d51 commit fc360e5
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
514 | 524 | | |
515 | 525 | | |
516 | 526 | | |
| |||
651 | 661 | | |
652 | 662 | | |
653 | 663 | | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
654 | 674 | | |
655 | 675 | | |
656 | 676 | | |
| |||
0 commit comments