vllm.v1.worker.dp_utils ¶
_get_device_and_group ¶
_get_device_and_group(parallel_config: ParallelConfig)
Source code in vllm/v1/worker/dp_utils.py
_post_process_dp_padding ¶
Source code in vllm/v1/worker/dp_utils.py
_post_process_ubatch ¶
Source code in vllm/v1/worker/dp_utils.py
_run_ar ¶
_run_ar(
should_ubatch: bool,
should_dp_pad: bool,
orig_num_tokens_per_ubatch: int,
padded_num_tokens_per_ubatch: int,
parallel_config: ParallelConfig,
) -> Tensor
Source code in vllm/v1/worker/dp_utils.py
_synchronize_dp_ranks ¶
_synchronize_dp_ranks(
num_tokens_unpadded: int,
num_tokens_padded: int,
should_attempt_ubatching: bool,
should_attempt_dp_padding: bool,
parallel_config: ParallelConfig,
) -> tuple[bool, Optional[Tensor]]
-
Decides if each DP rank is going to microbatch. Either all ranks run with microbatching or none of them do.
-
Determines the total number of tokens that each rank will run. When running microbatched or if should_attempt_dp_padding is True, all ranks will be padded out so that the run with the same number of tokens
tuple[
Name | Type | Description |
---|---|---|
should_ubatch | bool | Are all DP ranks going to microbatch |
num_tokens_after_padding | Optional[Tensor] | A tensor containing the total number of |
tuple[bool, Optional[Tensor]] | tokens per-microbatch for each DP rank including any DP padding. |
]
Source code in vllm/v1/worker/dp_utils.py
coordinate_batch_across_dp ¶
coordinate_batch_across_dp(
num_tokens_unpadded: int,
allow_microbatching: bool,
allow_dp_padding: bool,
parallel_config: ParallelConfig,
num_tokens_padded: Optional[int] = None,
uniform_decode: Optional[bool] = None,
num_scheduled_tokens_per_request: Optional[
ndarray
] = None,
) -> tuple[Optional[UBatchSlices], Optional[Tensor]]
Coordinates amongst all DP ranks to determine if and how the full batch should be split into microbatches.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_tokens_unpadded | int | Number of tokens without accounting for padding | required |
allow_microbatching | bool | If microbatching should be attempted | required |
allow_dp_padding | bool | If all DP ranks should be padded up to the same value | required |
parallel_config | ParallelConfig | The parallel config | required |
num_tokens_padded | Optional[int] | Number of tokens including any non-DP padding (CUDA graphs, TP, etc) | None |
uniform_decode | Optional[bool] | Only used if allow_microbatching is True. True if the batch only contains single token decodes | None |
num_scheduled_tokens_per_request | Optional[ndarray] | Only used if allow_microbatching is True. The number of tokens per request. | None |
tuple[
Name | Type | Description |
---|---|---|
ubatch_slices | Optional[UBatchSlices] | if this is set then all DP ranks have agreed to |
Optional[Tensor] | microbatch | |
num_tokens_after_padding | tuple[Optional[UBatchSlices], Optional[Tensor]] | A tensor containing the total number of |
tuple[Optional[UBatchSlices], Optional[Tensor]] | tokens per-microbatch for each DP rank including padding. Will be | |
tuple[Optional[UBatchSlices], Optional[Tensor]] | padded up to the max value across all DP ranks when allow_dp_padding | |
tuple[Optional[UBatchSlices], Optional[Tensor]] | is True. |
]
Source code in vllm/v1/worker/dp_utils.py
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 |
|