Commit f963db0
committed
ggml-opencl: treat null attention mask as bidirectional, not causal
The flash-attention dispatch inferred causal masking from shape with
`is_causal = (mask == NULL && n_q > 1 && n_q == n_kv)`. A null mask means
no masking, i.e. bidirectional attention (the SigLIP vision and embedding
encoders), while causal attention always supplies an explicit causal mask
in this codebase (llama-graph.cpp build_attn passes a kq_mask filled with
-INFINITY). The heuristic therefore wrongly made the bidirectional
Qwen3-VL vision tower attend causally, so each patch only saw earlier
patches and the image embedding was corrupted.
Set is_causal = 0 unconditionally; causality is always expressed via the
explicit mask. This cannot regress the LLM, which already passes a real
causal mask (is_causal was already 0 for it) and relies on that mask.1 parent d781a13 commit f963db0
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9853 | 9853 | | |
9854 | 9854 | | |
9855 | 9855 | | |
9856 | | - | |
| 9856 | + | |
| 9857 | + | |
| 9858 | + | |
| 9859 | + | |
| 9860 | + | |
| 9861 | + | |
| 9862 | + | |
| 9863 | + | |
9857 | 9864 | | |
9858 | 9865 | | |
9859 | 9866 | | |
| |||
0 commit comments