Commit 1090d51
gemma4: add BSA sparse-FA prefill path + unified flash_prefill_forward dispatch
- Implement gemma4_prefill_bsa() for per-layer BSA prefill using
flash_prefill_forward for SWA layers (head_dim=128) with dense FA
fallback for full-attention layers (head_dim=256).
- Write KV cache during Graph A (ring-buffer aware for SWA layers).
- Add GGML_ASSERT guard for swa_size > 0 before modulo operation.
- Add flash_prefill_forward() unified dispatch to flashprefill.h that
selects bf16/f16/q8 kernel based on compile flags + buffer type.
- Simplify Qwen3 attention dispatch to use the unified function.
- Remove duplicated ifdef boilerplate from both model implementations.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent de0e4c1 commit 1090d51
4 files changed
Lines changed: 760 additions & 68 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
93 | 124 | | |
94 | 125 | | |
95 | 126 | | |
| |||
0 commit comments