Skip to content

Commit 19c1755

Browse files
iancrisclaude
andcommitted
ggml-opencl: drop the FA null-mask assert — it aborts the bidirectional encoder
The GGML_ASSERT(mask != NULL || n_q == 1) added in the previous commit is wrong: this backend deliberately treats a null mask as bidirectional (is_causal = 0), and the bidirectional encoder path legitimately dispatches flash-attn with a null mask and n_q > 1 (the SigLIP/Qwen3-VL vision tower, n_q = n_kv = 247). The assert therefore fires on a valid call — confirmed by an on-device SIGABRT during the QVAC-21297 S25 smoke run (ggml_abort in ggml_cl_compute_forward, right after "flash_attn = enabled"). A null mask + n_q > 1 is indistinguishable from a caller that mistakenly omitted a causal mask, so there is no safe runtime assertion for this contract; the existing "null mask ⇒ bidirectional" INVARIANT comment is the correct documentation. Keep the barrier/divergence fix and the ggml_cl_upscale zero-source-dim guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1acc1c1 commit 19c1755

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

ggml/src/ggml-opencl/ggml-opencl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9883,7 +9883,6 @@ static void ggml_cl_flash_attn(ggml_backend_t backend, const ggml_tensor * q, co
98839883
// that needs causal masking MUST supply an explicit causal mask; relying on
98849884
// shape inference here will silently produce bidirectional (wrong) output.
98859885
const int is_causal = 0;
9886-
GGML_ASSERT((mask != NULL || n_q == 1) && "FA null mask + n_q>1 requires an explicit causal mask");
98879886

98889887
const int n_head_log2_val = n_head > 0 ? 1u << (int)floorf(log2f((float)n_head)) : 0;
98899888
const float n_head_log2_f = n_head_log2_val > 0 ? (float)n_head_log2_val : 1.0f;

0 commit comments

Comments
 (0)