From 5b2b8dcc2a05e24938f24ceefe8cee895dacd140 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 11 Aug 2026 12:18:22 +0000 Subject: [PATCH] =?UTF-8?q?fix(CRITICAL):=20route=20ALL=20prefill=20throug?= =?UTF-8?q?h=20sdpa=5Ffallback=20=E2=80=94=20ixformer=20varlen=5Ffwd=20inc?= =?UTF-8?q?ompatible=20with=20FwOp=2020-arg=20signature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: xformers.py only routed head_size>128 through _run_sdpa_fallback. For head_size<=128, xops.memory_efficient_attention_forward(op=FwOp()) dispatched to ixformer varlen_fwd with incompatible 20-arg signature, crashing during determine_num_available_blocks profiling. Fix: use _run_sdpa_fallback for ALL head sizes during prefill. --- qwen3_6_scripts/xformers.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/qwen3_6_scripts/xformers.py b/qwen3_6_scripts/xformers.py index bbb43e91..9dfbeb62 100644 --- a/qwen3_6_scripts/xformers.py +++ b/qwen3_6_scripts/xformers.py @@ -942,18 +942,10 @@ class XFormersImpl(AttentionImpl[XFormersMetadata]): query = query.unsqueeze(0) key = key.unsqueeze(0) value = value.unsqueeze(0) - if self.head_size > 128: - out = self._run_sdpa_fallback(query, key, value, attn_metadata) - else: - out = xops.memory_efficient_attention_forward( - query, - key, - value, - attn_bias=attn_bias[0], - p=0.0, - scale=self.scale, - op=self.attn_op, - ) + # BI-V100: ixformer varlen_fwd has incompatible signature with + # xops.fmha.flash.FwOp() (20-arg mismatch). Use pure-math fallback + # for ALL head sizes during prefill, not just head_size > 128. + out = self._run_sdpa_fallback(query, key, value, attn_metadata) return out.view_as(original_query) # Attention with alibi slopes.