Commit 6b0f169
committed
ggml-opencl: harden flash-attn finite-math strip and document is_causal invariant
The flash-attn compile-flag strip removed only the first occurrence of each
unsafe flag and silently tolerated a miss. If compile_opts ever changes its
spelling/spacing or repeats a flag, a surviving -cl-finite-math-only /
-cl-fast-relaxed-math would rebuild the FA kernels with Inf-assuming math and
silently reintroduce the -INFINITY online-softmax/masking miscompile this
strip exists to prevent.
Erase every occurrence of each flag and add a GGML_ASSERT that no
finite-math/fast-math/unsafe-math flag survived, so a future regression fails
loudly at load time instead of producing silently wrong attention output.
Also document the is_causal invariant in ggml_cl_flash_attn: a null mask is
treated as bidirectional, so any caller needing causal masking must supply an
explicit causal mask rather than relying on shape inference.1 parent d266267 commit 6b0f169
1 file changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2149 | 2149 | | |
2150 | 2150 | | |
2151 | 2151 | | |
2152 | | - | |
2153 | | - | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
2154 | 2159 | | |
2155 | 2160 | | |
2156 | 2161 | | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
2157 | 2169 | | |
2158 | 2170 | | |
2159 | 2171 | | |
| |||
9860 | 9872 | | |
9861 | 9873 | | |
9862 | 9874 | | |
| 9875 | + | |
| 9876 | + | |
| 9877 | + | |
| 9878 | + | |
9863 | 9879 | | |
9864 | 9880 | | |
9865 | 9881 | | |
| |||
0 commit comments