Add SGLANG_ENABLE_WAR_BARRIER to force-enable the overlap scheduler WAR barrier on non-CUDA (e.g. AMD) (#27967)

This commit is contained in:
Oguz Ulgen
2026-06-11 15:38:37 -07:00
committed by GitHub
parent 493f828bfa
commit 949326d922
2 changed files with 7 additions and 1 deletions
+4
View File
@@ -309,6 +309,10 @@ class Envs:
# Scheduler: others:
SGLANG_EMPTY_CACHE_INTERVAL = EnvFloat(-1) # in seconds. Set if you observe high memory accumulation over a long serving period.
SGLANG_DISABLE_CONSECUTIVE_PREFILL_OVERLAP = EnvBool(False)
# Force-enable the WAR (write-after-read) barrier for the overlap scheduler
# even when is_cuda() is False (e.g. AMD/ROCm). On CUDA the barrier is
# already enabled regardless of this flag (see start_event_loop).
SGLANG_ENABLE_WAR_BARRIER = EnvBool(False)
# PP: skip output send/recv when the entire batch consists of non-final chunked prefill requests,
# since process_batch_result_prefill discards next_token_ids for those anyway.
SGLANG_PP_SKIP_PURE_CHUNKED_OUTPUT_COMM = EnvBool(False)
+3 -1
View File
@@ -1424,7 +1424,9 @@ class Scheduler(
# DFLASH fences its shared req_to_token writes with verify_done /
# plan-stream deps, so the global WAR barrier only serializes plan
# overlap. TODO: generalize this global-barrier enablement policy.
self._war_barrier_enabled = is_cuda() and not self.spec_algorithm.is_dflash()
self._war_barrier_enabled = (
is_cuda() or envs.SGLANG_ENABLE_WAR_BARRIER.get()
) and not self.spec_algorithm.is_dflash()
with self.device_module.StreamContext(self.schedule_stream):
dispatch_event_loop(self)