vllm.profiler.wrapper
¶
Classes:
-
ProtonProfilerWrapper–Worker profiler backed by
triton.profiler(Proton). -
TorchProfilerWrapper– -
WorkerProfiler–
Functions:
-
create_frontend_profiler–Create the CPU-only frontend profiler, which runs for the whole session
-
create_graph_capture_profiler–Create a profiler to observe CUDA graph capture, if configured.
-
create_worker_profiler–Create a profiler using a validated config and platform defaults.
-
get_default_torch_profiler_activities–Default torch profiler activities for the current platform.
-
validate_worker_profiler_config–Validate profiler selections against the worker's capabilities.
ProtonProfilerWrapper
¶
Bases: WorkerProfiler
Worker profiler backed by triton.profiler (Proton).
Methods:
-
capture_cuda_graphs–Keep a Proton session active while vLLM captures CUDA graphs.
-
set_output_name–Set the next run's output name after startup graph capture.
TorchProfilerWrapper
¶
Bases: WorkerProfiler
_maybe_add_version_metadata()
¶
Stamp the vLLM version (which embeds the git commit) into the trace.
add_metadata_json is a no-op until Kineto is initialized, which with a schedule only happens after the WAIT phase, so stamp once it's live.
WorkerProfiler
¶
Bases: ABC
Methods:
-
annotate_context_manager–Return a context manager to annotate profiler traces.
-
capture_cuda_graphs–Observe graph creation for backends that attribute replay activity.
-
set_output_name–Set the output name for the next profiling session.
-
set_profiler_kwargs–Set profiler keyword argument overrides for the next profiling session.
-
shutdown–Ensure profiler is stopped when shutting down.
-
start–Attempt to start the profiler, accounting for delayed starts.
-
step–Update the profiler state at each worker step,
-
stop–Attempt to stop the profiler, accounting for overlapped calls.
Attributes:
-
has_cuda_graph_session(bool) –Whether a capture-time session is retained to attribute replays.
-
is_running(bool) –Whether the underlying profiler is currently collecting data.
-
should_annotate(bool) –Whether worker iterations should receive profiler annotations.
has_cuda_graph_session
property
¶
Whether a capture-time session is retained to attribute replays.
is_running
property
¶
Whether the underlying profiler is currently collecting data.
should_annotate
property
¶
Whether worker iterations should receive profiler annotations.
_call_start()
¶
Call _start with error handling but no safeguards.
_call_stop()
¶
Call _stop with error handling but no safeguards.
_profiler_step()
¶
_start()
abstractmethod
¶
Start the profiler.
_stop()
abstractmethod
¶
Stop the profiler.
annotate_context_manager(name)
¶
Return a context manager to annotate profiler traces.
capture_cuda_graphs()
¶
Observe graph creation for backends that attribute replay activity.
set_output_name(worker_name)
¶
Set the output name for the next profiling session.
set_profiler_kwargs(profiler_kwargs)
¶
Set profiler keyword argument overrides for the next profiling session.
shutdown()
¶
Ensure profiler is stopped when shutting down.
start(*, delay_iterations=None, max_iterations=None)
¶
Attempt to start the profiler, accounting for delayed starts.
step()
¶
Update the profiler state at each worker step, to handle delayed starts and max iteration limits.
stop()
¶
Attempt to stop the profiler, accounting for overlapped calls.
create_frontend_profiler(profiler_config, *, worker_name)
¶
Create the CPU-only frontend profiler, which runs for the whole session rather than following engine iterations.
create_graph_capture_profiler(profiler_config, global_rank)
¶
Create a profiler to observe CUDA graph capture, if configured.
Applies only to backends that attribute graph replay activity which
need a session around capture (Proton with proton_graph_attribution).
create_worker_profiler(profiler_config, *, worker_name, local_rank, profiler_kwargs=None)
¶
Create a profiler using a validated config and platform defaults.
get_default_torch_profiler_activities()
¶
Default torch profiler activities for the current platform.
validate_worker_profiler_config(profiler_config)
¶
Validate profiler selections against the worker's capabilities.