vllm.v1.worker.ubatch_utils ¶
Classes:
Functions:
-
create_sm_control_context–Reserve SMs for communication kernels while microbatches overlap.
-
get_num_ubatches–How many microbatches a step is split into; 1 when microbatching is off.
-
slice_query_start_locs–Creates a new query_start_loc that corresponds to the requests in
-
split_attn_metadata–Creates a new CommonAttentionMetadata instance that corresponds to the
SMControlContextManager ¶
Methods:
-
__init__–Context manager for controlling SM (Streaming Multiprocessor)
Source code in vllm/v1/worker/ubatch_utils.py
__init__(comm_sms, set_comm_sms, set_compute_sms) ¶
Context manager for controlling SM (Streaming Multiprocessor) allocation. Upon entering the context, it sets the number of SMs allocated for communication and computation to comm_sms and total_sms - comm_sms respectively. Upon exiting, it restores the allocation to use all available SMs (i.e. total_sms).
Parameters:
-
(comm_sms¶int) –The number of SMs to allocate for communication. (The remainder will be used for computation.)
-
(set_comm_sms¶Callable[[int], None]) –A function that sets the number of SMs for communication.
-
(set_compute_sms¶Callable[[int], None]) –A function that sets the number of SMs for computation.
Source code in vllm/v1/worker/ubatch_utils.py
_make_metadata_with_slice(ubatch_slice, attn_metadata) ¶
This function creates a new CommonAttentionMetadata that corresponds to the requests included in ubatch_slice
Source code in vllm/v1/worker/ubatch_utils.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
create_sm_control_context(parallel_config) ¶
Reserve SMs for communication kernels while microbatches overlap.
Source code in vllm/v1/worker/ubatch_utils.py
get_num_ubatches(parallel_config) ¶
How many microbatches a step is split into; 1 when microbatching is off.
slice_query_start_locs(query_start_loc, request_slice) ¶
Creates a new query_start_loc that corresponds to the requests in request_slice.
Note: This function creates a new tensor to hold the new query_start_locs. This will break cudagraph compatibility.
Source code in vllm/v1/worker/ubatch_utils.py
split_attn_metadata(ubatch_slices, common_attn_metadata) ¶
Creates a new CommonAttentionMetadata instance that corresponds to the requests for each UBatchSlice in ubatch_slices.
Note: This function does not modify common_attn_metadata