vllm.config.profiler
¶
Classes:
-
ProfilerConfig–Dataclass which contains profiler config for the engine.
Functions:
-
validate_profile_iteration_bounds–Validate iteration bounds supplied for one profiling session.
-
validate_profile_prefix–Validate a trace filename prefix supplied for one profiling session.
ProfilerConfig
¶
Dataclass which contains profiler config for the engine.
Methods:
-
compile_factors–This config does not affect the compiled graph.
Attributes:
-
active_iterations(int) –Number of active iterations for PyTorch profiler schedule.
-
capture_torch_profiler(bool) –Deprecated and has no effect: only the removed Model Runner V1 profiled CUDA
-
delay_iterations(int) –Number of engine iterations to skip before starting profiling.
-
detailed_trace_annotation(bool) –If
True, uses detailed annotations with roofline metrics (sk, sqsq, -
ignore_frontend(bool) –If
True, disables the front-end profiling of AsyncLLM when using the -
max_iterations(int) –Maximum number of engine iterations to profile after starting profiling.
-
profiler(ProfilerKind | None) –Which profiler to use. Defaults to None. Options are:
-
proton_backend(ProtonBackend | None) –Proton GPU backend.
Nonelets Proton select CUPTI automatically. -
proton_context(ProtonContext) –Proton context source.
shadowrecords explicit scopes with low -
proton_data(ProtonData) –Proton output type.
treeproduces Hatchet data andtrace -
proton_graph_attribution(bool) –Observe CUDA graph capture so replayed kernels can be attributed.
-
proton_hook(ProtonHook | None) –Optional Proton hook. Use
tritonto add Triton launch metadata. -
proton_mode(str | None) –Optional backend-specific Proton mode string, such as
pcsampling. -
proton_output_format(ProtonOutputFormat | None) –Optional format passed to Proton when finalizing a profile.
None -
proton_profiler_dir(str) –Directory to save Triton Proton profiles. Each worker writes a
-
should_profile_frontend(bool) –Whether the frontend CPU profiler should be enabled.
-
torch_profiler_activities(list[TorchProfilerActivity] | None) –Activities recorded by workers using the torch profiler. When unset,
-
torch_profiler_dir(str) –Directory to save torch profiler traces. Both AsyncLLM's CPU traces and
-
torch_profiler_dump_cuda_time_total(bool) –If
True, dumps total CUDA time in torch profiler traces. Enabled by default. -
torch_profiler_record_shapes(bool) –If
True, records tensor shapes in the torch profiler. Disabled by default. -
torch_profiler_use_gzip(bool) –If
True, saves torch profiler traces in gzip format. Enabled by default -
torch_profiler_with_flops(bool) –If
True, enables FLOPS counting in the torch profiler. Disabled by default. -
torch_profiler_with_memory(bool) –If
True, enables memory profiling in the torch profiler. -
torch_profiler_with_stack(bool) –If
True, enables stack tracing in the torch profiler. Enabled by default -
wait_iterations(int) –Number of wait iterations for PyTorch profiler schedule.
-
warmup_iterations(int) –Number of warmup iterations for PyTorch profiler schedule.
active_iterations = Field(default=5, ge=1)
class-attribute
instance-attribute
¶
Number of active iterations for PyTorch profiler schedule. This is the number of iterations where profiling data is actually collected. Defaults to 5 active iterations.
capture_torch_profiler = False
class-attribute
instance-attribute
¶
Deprecated and has no effect: only the removed Model Runner V1 profiled CUDA graph capture. It will be removed in a future release.
delay_iterations = Field(default=0, ge=0)
class-attribute
instance-attribute
¶
Number of engine iterations to skip before starting profiling. Defaults to 0, meaning profiling starts immediately after receiving /start_profile.
detailed_trace_annotation = False
class-attribute
instance-attribute
¶
If True, uses detailed annotations with roofline metrics (sk, sqsq,
sqsk) in profiler trace events. If False, uses simple annotations with
only context/generation request counts and token counts.
Disabled by default.
ignore_frontend = False
class-attribute
instance-attribute
¶
If True, disables the front-end profiling of AsyncLLM when using the
'torch' profiler. This is needed to reduce overhead when using delay/limit options,
since the front-end profiling does not track iterations and will capture the
entire range.
max_iterations = Field(default=0, ge=0)
class-attribute
instance-attribute
¶
Maximum number of engine iterations to profile after starting profiling. Defaults to 0, meaning no limit.
profiler = None
class-attribute
instance-attribute
¶
Which profiler to use. Defaults to None. Options are:
- 'torch': Use PyTorch profiler.
- 'cuda': Use CUDA profiler.
- 'proton': Use Triton Proton profiler.
proton_backend = None
class-attribute
instance-attribute
¶
Proton GPU backend. None lets Proton select CUPTI automatically.
proton_context = 'shadow'
class-attribute
instance-attribute
¶
Proton context source. shadow records explicit scopes with low
overhead; python records Python call stacks.
proton_data = 'tree'
class-attribute
instance-attribute
¶
Proton output type. tree produces Hatchet data and trace
produces a Chrome trace.
proton_graph_attribution = False
class-attribute
instance-attribute
¶
Observe CUDA graph capture so replayed kernels can be attributed.
Requires Triton >= 3.7 and proton_data='tree'.
proton_hook = None
class-attribute
instance-attribute
¶
Optional Proton hook. Use triton to add Triton launch metadata.
proton_mode = None
class-attribute
instance-attribute
¶
Optional backend-specific Proton mode string, such as pcsampling.
proton_output_format = None
class-attribute
instance-attribute
¶
Optional format passed to Proton when finalizing a profile. None
uses the default format for proton_data.
proton_profiler_dir = ''
class-attribute
instance-attribute
¶
Directory to save Triton Proton profiles. Each worker writes a separate rank-qualified file.
should_profile_frontend
property
¶
Whether the frontend CPU profiler should be enabled.
torch_profiler_activities = Field(default=None, min_length=1)
class-attribute
instance-attribute
¶
Activities recorded by workers using the torch profiler. When unset, each worker uses its platform default: CPU; CPU and CUDA; or CPU and XPU.
torch_profiler_dir = ''
class-attribute
instance-attribute
¶
Directory to save torch profiler traces. Both AsyncLLM's CPU traces and worker's traces (CPU & GPU) will be saved under this directory. Note that it must be an absolute path.
torch_profiler_dump_cuda_time_total = True
class-attribute
instance-attribute
¶
If True, dumps total CUDA time in torch profiler traces. Enabled by default.
torch_profiler_record_shapes = False
class-attribute
instance-attribute
¶
If True, records tensor shapes in the torch profiler. Disabled by default.
torch_profiler_use_gzip = True
class-attribute
instance-attribute
¶
If True, saves torch profiler traces in gzip format. Enabled by default
torch_profiler_with_flops = False
class-attribute
instance-attribute
¶
If True, enables FLOPS counting in the torch profiler. Disabled by default.
torch_profiler_with_memory = False
class-attribute
instance-attribute
¶
If True, enables memory profiling in the torch profiler.
Disabled by default.
torch_profiler_with_stack = True
class-attribute
instance-attribute
¶
If True, enables stack tracing in the torch profiler. Enabled by default
as it is useful for debugging. Can be disabled via
--profiler-config.torch_profiler_with_stack=false CLI flag.
wait_iterations = Field(default=0, ge=0)
class-attribute
instance-attribute
¶
Number of wait iterations for PyTorch profiler schedule. During wait, the profiler is completely off with zero overhead. This allows skipping initial iterations before warmup begins. Defaults to 0 (no wait period).
warmup_iterations = Field(default=0, ge=0)
class-attribute
instance-attribute
¶
Number of warmup iterations for PyTorch profiler schedule. During warmup, the profiler runs but data is discarded. This helps reduce noise from JIT compilation and other one-time costs in the profiled trace. Defaults to 0 (schedule-based profiling disabled, recording all iterations). Set to a positive value (e.g., 2) to enable schedule-based profiling.
compile_factors()
¶
This config does not affect the compiled graph.
If a field starts affecting it, return
get_compile_factors(self, ignored_factors) with every other field in
ignored_factors.
_is_uri_path(path)
¶
Check if path is a URI (scheme://...), excluding Windows drive letters.
Supports custom URI schemes like gs://, s3://, hdfs://, etc. These paths should not be converted to absolute paths.
validate_profile_iteration_bounds(delay_iterations, max_iterations)
¶
Validate iteration bounds supplied for one profiling session.
validate_profile_prefix(prefix)
¶
Validate a trace filename prefix supplied for one profiling session.