From 26cc501393051ef169ad9dfde6011ec950cbd172 Mon Sep 17 00:00:00 2001 From: zixi-qi Date: Mon, 4 May 2026 04:41:15 +0000 Subject: [PATCH 1/2] Revert "Revert "Temporary disable persistent topk (#41442)"" This reverts commit a4debbd5bd0608999314ad68e6463fb1d76f5d4e. Signed-off-by: zixi-qi --- vllm/model_executor/layers/sparse_attn_indexer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vllm/model_executor/layers/sparse_attn_indexer.py b/vllm/model_executor/layers/sparse_attn_indexer.py index ca82f2feb7ef..6bca26c4b9f6 100644 --- a/vllm/model_executor/layers/sparse_attn_indexer.py +++ b/vllm/model_executor/layers/sparse_attn_indexer.py @@ -320,7 +320,7 @@ def sparse_attn_indexer( num_rows = logits.shape[0] topk_indices = topk_indices_buffer[:num_padded_tokens, :topk_tokens] - if current_platform.is_cuda() and topk_tokens in (512, 1024, 2048): + if current_platform.is_cuda() and topk_tokens in (512, 2048): workspace_manager = current_workspace_manager() (topk_workspace,) = workspace_manager.get_simultaneous( ((RADIX_TOPK_WORKSPACE_SIZE,), torch.uint8), From d92dd26f1ed5f07aa0f00a1fcc6c5a1ef5ef99c4 Mon Sep 17 00:00:00 2001 From: zixi-qi Date: Mon, 4 May 2026 04:45:07 +0000 Subject: [PATCH 2/2] Gate persistent topk for topk_tokens=1024 to Blackwell only Keep `topk_tokens == 1024` on the persistent_topk path on Blackwell (SM10x), but disable it on Hopper and other CUDA archs so the original revert (#41442) behavior is preserved there. Co-authored-by: Claude Signed-off-by: zixi-qi --- vllm/model_executor/layers/sparse_attn_indexer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/layers/sparse_attn_indexer.py b/vllm/model_executor/layers/sparse_attn_indexer.py index 6bca26c4b9f6..79f7e714c2f3 100644 --- a/vllm/model_executor/layers/sparse_attn_indexer.py +++ b/vllm/model_executor/layers/sparse_attn_indexer.py @@ -320,7 +320,12 @@ def sparse_attn_indexer( num_rows = logits.shape[0] topk_indices = topk_indices_buffer[:num_padded_tokens, :topk_tokens] - if current_platform.is_cuda() and topk_tokens in (512, 2048): + allowed_topk = ( + (512, 1024, 2048) + if current_platform.is_device_capability_family(100) + else (512, 2048) + ) + if current_platform.is_cuda() and topk_tokens in allowed_topk: workspace_manager = current_workspace_manager() (topk_workspace,) = workspace_manager.get_simultaneous( ((RADIX_TOPK_WORKSPACE_SIZE,), torch.uint8),