better logging

Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
This commit is contained in:
Lucas Wilkinson 2025-05-23 18:34:08 +00:00
parent e4419df256
commit 37bdf9f324

View File

@ -3,6 +3,7 @@ import threading
import torch import torch
import torch._dynamo import torch._dynamo
import torch.profiler as profiler import torch.profiler as profiler
import os
from typing import Optional from typing import Optional
from torch.library import Library from torch.library import Library
from torch.library import custom_op, register_kernel from torch.library import custom_op, register_kernel
@ -135,8 +136,11 @@ def dump_ubatching_state():
""" """
Dump the current UBatchContext state for debugging. Dump the current UBatchContext state for debugging.
""" """
dp_rank = os.getenv("VLLM_DP_RANK", None)
for ctx in _CURRENT_CONTEXT.values(): for ctx in _CURRENT_CONTEXT.values():
print(f"UBatchContext: {ctx.id}\n" print(f"UBatchContext: {ctx.id} (dp_rank {dp_rank})\n"
f" Stream: {ctx.stream}, ({ctx.stream.query()})\n" f" Stream: {ctx.stream}, ({ctx.stream.query()})\n"
f" Original Stream: {ctx.original_stream}, ({ctx.original_stream.query()})\n" f" Original Stream: {ctx.original_stream}, ({ctx.original_stream.query()})\n"
f" CPU Wait Event: {ctx.cpu_wait_event}\n" f" CPU Wait Event: {ctx.cpu_wait_event}\n"