From 74295e3bd47b64964fe6a51825079e75c84cc172 Mon Sep 17 00:00:00 2001 From: Nick Hill Date: Mon, 3 Aug 2026 17:54:49 -0700 Subject: [PATCH] [CI][Bugfix] Fix flaky `test_store_orders_after_compute_write` (#50926) Signed-off-by: Nick Hill Co-authored-by: Claude --- tests/v1/simple_kv_offload/test_worker.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/v1/simple_kv_offload/test_worker.py b/tests/v1/simple_kv_offload/test_worker.py index 859d0fecd5..5856120fe7 100644 --- a/tests/v1/simple_kv_offload/test_worker.py +++ b/tests/v1/simple_kv_offload/test_worker.py @@ -100,6 +100,13 @@ def _drive_store( if int((cpu[:, 0].to(torch.int32) != val).sum().item()): corrupt += 1 + + # Drain the compute stream before returning: in the no-barrier control + # phase the store never waits on compute, so the host loop runs far ahead + # and leaves a backlog of sleep+fill kernels in flight. Without this, the + # leftover control-phase fills race the barrier phase's fill->copy window + # on the shared gpu tensor and flakily corrupt one iteration. + compute_stream.synchronize() return corrupt