From 90b3db6dd8f419cd23f9c4e3146803b7330aa89e Mon Sep 17 00:00:00 2001 From: Jason Mancuso <7891333+jvmncs@users.noreply.github.com> Date: Fri, 14 Aug 2026 19:39:35 -0400 Subject: [PATCH] [Fix: RL] Snapshot async state-capture outputs before overlap (#34319) --- python/sglang/srt/state_capturer/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/state_capturer/base.py b/python/sglang/srt/state_capturer/base.py index 7bedeb445..0fa8bcdad 100644 --- a/python/sglang/srt/state_capturer/base.py +++ b/python/sglang/srt/state_capturer/base.py @@ -176,9 +176,10 @@ class BaseTopkCapturer: forward_batch, can_run_graph, cuda_graph_batch ) if no_copy_to_cpu: + # Clone before the next overlapping forward reuses these buffers. return TopkCaptureOutput( - out_cache_loc=forward_batch.out_cache_loc, - topk=slice_gpu, + out_cache_loc=forward_batch.out_cache_loc.clone(), + topk=slice_gpu.clone(), host_cache=self.host_cache, ) out_cache_loc_cpu = forward_batch.out_cache_loc.cpu()