[Worker] Capture-safe guard-telemetry infrastructure, default off

Shared machinery for device-side bounds guards: persistent int64 counters per
site, written by guarded kernels and read by a background thread. The reader
starts only after warm-up and CUDA-graph capture and never waits on the
compute stream; a read failure arms the stop rather than popping the buffer.
Shutdown does one synchronous final drain so a hit on the last step is
reported before teardown. Release default: off.

Co-Authored-By: Hinata <hinata@idihore.id>
Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
2026-10-09 19:43:52 +07:00
co-authored by Hinata
parent 4a3ebc6b5b
commit 03f5313f0f
3 changed files with 643 additions and 0 deletions
+9
View File
@@ -80,6 +80,7 @@ from vllm.v1.watermarking.spec_decode import (
create_speculative_target_watermarker,
speculative_target_watermark_key,
)
from vllm.v1.worker import guard_telemetry
from vllm.v1.worker.block_table import get_block_table_width
from vllm.v1.worker.cp_utils import check_attention_cp_compatibility
from vllm.v1.worker.gpu import pcp_manager as pcp
@@ -203,6 +204,10 @@ class GPUModelRunner(LoRAModelRunnerMixin):
self.jit_warmup_registry = JitWarmupRegistry(vllm_config)
self.device = device
# Bounds-guard instrumentation: allocate the guard counters now, while we are certainly
# not capturing. The thread that READS them starts much later, from
# gpu_worker after capture. See guard_telemetry.start_reader.
guard_telemetry.prealloc(device)
self.dtype = self.model_config.dtype
self.kv_cache_dtype = self.dtype
if self.cache_config.cache_dtype != "auto":
@@ -1708,6 +1713,10 @@ class GPUModelRunner(LoRAModelRunnerMixin):
randomize_inputs: bool = False,
) -> ModelRunnerOutput | IntermediateTensors | None:
if not dummy_run:
# Bounds-guard instrumentation: raise on the engine thread if a bounds guard fired.
# A Python bool; adds no device sync to the step. Late and
# rank-local -- see guard_telemetry.check_pending.
guard_telemetry.check_pending()
# Update the request states.
self.update_pp_decode_requests()
self.finish_requests(scheduler_output)