Commit e6d65fb
authored
vulkan: support arbitrary KV dimension in flash attention (#16160)
The "Clamp" spec constant is already based on whether KV is a multiple of Bc,
so use that to control whether bounds checking is performed. Add bounds checking
to the scalar and coopmat1 paths. Coopmat2 didn't need any changes (the K/V
tensors are already optionally clamped, nothing else needed to be changed).1 parent 8656f5d commit e6d65fb
File tree
3 files changed
+38
-9
lines changed- ggml/src/ggml-vulkan/vulkan-shaders
3 files changed
+38
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| |||
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
158 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
159 | 166 | | |
160 | 167 | | |
161 | 168 | | |
| |||
172 | 179 | | |
173 | 180 | | |
174 | 181 | | |
175 | | - | |
| 182 | + | |
176 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
177 | 187 | | |
178 | 188 | | |
179 | 189 | | |
| |||
190 | 200 | | |
191 | 201 | | |
192 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
193 | 206 | | |
194 | 207 | | |
195 | 208 | | |
| |||
203 | 216 | | |
204 | 217 | | |
205 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
206 | 222 | | |
207 | 223 | | |
208 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
| 156 | + | |
155 | 157 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
160 | 162 | | |
161 | | - | |
| 163 | + | |
162 | 164 | | |
| 165 | + | |
163 | 166 | | |
164 | 167 | | |
165 | 168 | | |
| |||
202 | 205 | | |
203 | 206 | | |
204 | 207 | | |
205 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
206 | 211 | | |
207 | 212 | | |
208 | 213 | | |
209 | 214 | | |
210 | 215 | | |
211 | 216 | | |
212 | 217 | | |
213 | | - | |
| 218 | + | |
214 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
215 | 223 | | |
216 | 224 | | |
217 | 225 | | |
| |||
233 | 241 | | |
234 | 242 | | |
235 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
236 | 247 | | |
237 | 248 | | |
238 | 249 | | |
| |||
0 commit comments