From 91ba720b75f0d74e2af83765f80078f2a551e881 Mon Sep 17 00:00:00 2001 From: stefankoncarevic Date: Tue, 23 Jun 2026 01:25:43 +0200 Subject: [PATCH] [ROCm][CI] Only require q_scale==1.0 for fp8 query in RocmAttention (#46148) Signed-off-by: stefankoncarevic Co-authored-by: Andreas Karatzas --- vllm/v1/attention/backends/rocm_attn.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/vllm/v1/attention/backends/rocm_attn.py b/vllm/v1/attention/backends/rocm_attn.py index 2f6c48e3df..500cd3fdf9 100644 --- a/vllm/v1/attention/backends/rocm_attn.py +++ b/vllm/v1/attention/backends/rocm_attn.py @@ -421,9 +421,18 @@ class RocmAttentionImpl(AttentionImpl): if is_quantized_kv_cache(self.kv_cache_dtype): key_cache = key_cache.view(self.fp8_dtype) value_cache = value_cache.view(self.fp8_dtype) - assert layer._q_scale_float == 1.0, ( - "A non 1.0 q_scale is not currently supported." - ) + # chunked_prefill_paged_decode runs attention with a full-precision + # query (it does not quantize Q to fp8 and does not consume + # q_scale), so q_scale only matters when the query itself is fp8. + # For a non-fp8 query, q_scale is not applicable and is ignored + # (mirrors TritonAttentionImpl). This avoids spuriously failing on + # checkpoints that carry a non-1.0 q_scale while keeping the query + # in full precision. + if query.dtype == self.fp8_dtype and layer._q_scale_float != 1.0: + raise NotImplementedError( + "A non 1.0 q_scale with an fp8 query is not currently " + "supported by RocmAttentionImpl." + ) cu_seqlens_q = attn_metadata.query_start_loc seqused_k = attn_metadata.seq_lens