Commit dc64397
ggml-opencl: add trailing barrier in f32 flash-attn tile loop
The f32 flash-attention kernel loads K/V tiles into local memory,
barriers, reads them, then loops to overwrite the tiles for the next
K/V block without a trailing barrier. Out-of-range lanes (the last
partial BLOCK_M block) could also race ahead into the next tile load
while active lanes were still reading. With n_kv > BLOCK_N (e.g. the
bidirectional vision tower, n_kv=247) this corrupts the shared tiles.
Add a trailing barrier(CLK_LOCAL_MEM_FENCE) at the end of the K/V block
loop and guard the score computation with the query-row range check
instead of an early continue.1 parent c1dace7 commit dc64397
1 file changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
| |||
171 | 176 | | |
172 | 177 | | |
173 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
174 | 184 | | |
175 | 185 | | |
176 | 186 | | |
| |||
0 commit comments