vllm.config.profiler ¶
Classes:
-
ProfilerConfig–Dataclass which contains profiler config for the engine.
ProfilerConfig ¶
Dataclass which contains profiler config for the engine.
Methods:
-
compute_hash–WARNING: Whenever a new field is added to this config,
Attributes:
-
active_iterations(int) –Number of active iterations for PyTorch profiler schedule.
-
capture_torch_profiler(bool) –If
True, enables a torch profiler during CUDA graph capture on rank 0. -
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_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
-
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.
Source code in vllm/config/profiler.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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 ¶
If True, enables a torch profiler during CUDA graph capture on rank 0. Traces are saved to a capture_traces subdirectory under torch_profiler_dir. Requires profiler to be set to 'torch'.
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_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.
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.
compute_hash() ¶
WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if it affects the computation graph.
Provide a hash that uniquely identifies all the configs that affect the structure of the computation graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states.
Source code in vllm/config/profiler.py
_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.