From 8c206feb91c74d2d4343adee3f581c90d8340953 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 18 Aug 2026 10:32:55 +0000 Subject: [PATCH] =?UTF-8?q?[fix]=20baseline4=20paged=5Fattn.py=20=E7=9A=84?= =?UTF-8?q?=20seq=5Flens=5Ftensor=20=E5=8C=85=E5=90=AB=200x7FFF7FFF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qwen3_6_scripts/paged_attn.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qwen3_6_scripts/paged_attn.py b/qwen3_6_scripts/paged_attn.py index c27c615d..693c6a7b 100644 --- a/qwen3_6_scripts/paged_attn.py +++ b/qwen3_6_scripts/paged_attn.py @@ -1516,6 +1516,16 @@ class PagedAttention: blocksparse_head_sliding_step: int = 0, ) -> torch.Tensor: actual_max = int(seq_lens.max().item()) if seq_lens.numel() > 0 else max_seq_len + # Guard against uninitialized seq_lens entries (0x7FFF7FFF pattern) + # from chunked prefill + GDN capture boundary metadata race. + if actual_max > max_seq_len: + import logging as _logging + _logging.getLogger(__name__).warning( + "[BI100 PAGED_ATTN] seq_lens contains value %d > max_seq_len %d, " + "clamping (likely uninitialized metadata from chunked prefill)", + actual_max, max_seq_len) + seq_lens = seq_lens.clamp(max=max_seq_len) + actual_max = max_seq_len block_size = value_cache.shape[3] num_seqs, num_heads, head_size = query.shape if key_cache.shape[1] != value_cache.shape[1]: