[Bugfix] Fix int32 overflow in triton_decode_attention page offsets (#47671)

Signed-off-by: Yifan Qiao <yifanqiao@inferact.ai>
This commit is contained in:
Yifan Qiao
2026-07-06 10:36:15 -04:00
committed by GitHub
parent 51ee564e56
commit 095adf1fdc
@@ -133,7 +133,7 @@ def _fwd_kernel_stage1(
+ offs_n // PAGE_SIZE,
mask=offs_n < split_kv_end,
other=0,
)
).to(tl.int64) # page_number * page stride overflows int32
kv_in_page = offs_n % PAGE_SIZE
offs_buf_k = (
(kv_page_number * stride_buf_kpbs + kv_in_page * stride_buf_kbs)[
@@ -375,7 +375,7 @@ def _fwd_grouped_kernel_stage1(
mask=offs_n < split_kv_end,
other=0,
cache_modifier=".ca",
)
).to(tl.int64) # page_number * page stride overflows int32
kv_off_k = (
kv_page_number * stride_buf_kpbs + (offs_n % PAGE_SIZE) * stride_buf_kbs
)