From 1238edd954b7f255e7e8e53246b8493bcacef2c6 Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Mon, 19 Oct 2026 15:45:17 -0700 Subject: [PATCH] [Perf] deepseek-v4.1: Reset request-window tags without a host sync (#45247) --- python/sglang/srt/mem_cache/dsv41_request_window.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/mem_cache/dsv41_request_window.py b/python/sglang/srt/mem_cache/dsv41_request_window.py index a5a99358d7..8c203ff1da 100644 --- a/python/sglang/srt/mem_cache/dsv41_request_window.py +++ b/python/sglang/srt/mem_cache/dsv41_request_window.py @@ -234,7 +234,8 @@ class RequestWindow: loc = slots.to(torch.int64)[:, None] * self.capacity + torch.arange( self.capacity, device=slots.device ) - self.tags[:, loc.flatten()] = -1 + # index_fill_ stays on the device; a scalar index_put waits for the stream. + self.tags.index_fill_(1, loc.flatten(), -1) self.prepared = None def activate(self, layout):