[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:
@@ -92,6 +92,7 @@ from vllm.v1.outputs import (
|
||||
ModelRunnerOutput,
|
||||
)
|
||||
from vllm.v1.utils import compute_iteration_details, report_usage_stats
|
||||
from vllm.v1.worker import guard_telemetry
|
||||
from vllm.v1.worker.sentinel.gpu_worker_sentinel import WorkerSentinel
|
||||
from vllm.v1.worker.startup_plan import (
|
||||
maybe_apply_startup_plan,
|
||||
@@ -1045,6 +1046,12 @@ class Worker(WorkerBase):
|
||||
# gate so subsequent `execute_model` / `sample_tokens` calls enforce it.
|
||||
enable_gpu_sync_check()
|
||||
|
||||
# Bounds-guard instrumentation: same moment, same reason. The guard counters
|
||||
# were allocated in the model runner constructor, but the thread that READS
|
||||
# them must not exist during capture -- a .tolist() from a second thread
|
||||
# while a capture is active is what cudaStreamCaptureModeGlobal rejects.
|
||||
guard_telemetry.start_reader()
|
||||
|
||||
return CompilationTimes(
|
||||
language_model=self.compilation_config.compilation_time,
|
||||
encoder=self.compilation_config.encoder_compilation_time,
|
||||
@@ -1582,6 +1589,13 @@ class Worker(WorkerBase):
|
||||
def shutdown(self) -> None:
|
||||
gc.unfreeze()
|
||||
|
||||
# Bounds-guard instrumentation: synchronous final read of the guard
|
||||
# counters, so a hit on the LAST step is reported before teardown.
|
||||
try:
|
||||
guard_telemetry.drain()
|
||||
except Exception: # noqa: BLE001
|
||||
logger.exception("guard telemetry FINAL DRAIN failed")
|
||||
|
||||
# has_kv_transfer_group can be None during interpreter shutdown.
|
||||
if ensure_kv_transfer_shutdown is not None:
|
||||
ensure_kv_transfer_shutdown()
|
||||
|
||||
Reference in New Issue
Block a user