vllm.v1.worker.ubatch_utils ¶
UBatchSlice dataclass ¶
Source code in vllm/v1/worker/ubatch_utils.py
_make_metadata_with_slice ¶
_make_metadata_with_slice(
ubatch_slice: UBatchSlice,
attn_metadata: CommonAttentionMetadata,
) -> CommonAttentionMetadata
This function creates a new CommonAttentionMetadata that corresponds to the requests included in ubatch_slice
Source code in vllm/v1/worker/ubatch_utils.py
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 | |
_pad_out_ubatch_slices ¶
_pad_out_ubatch_slices(
ubatch_slices: UBatchSlices,
num_total_tokens: int,
num_reqs_padded: int,
) -> UBatchSlices
Source code in vllm/v1/worker/ubatch_utils.py
check_ubatch_thresholds ¶
check_ubatch_thresholds(
config: ParallelConfig,
num_tokens: int,
uniform_decode: bool,
) -> bool
Source code in vllm/v1/worker/ubatch_utils.py
is_last_ubatch_empty ¶
maybe_create_ubatch_slices ¶
maybe_create_ubatch_slices(
should_ubatch: bool,
num_scheduled_tokens: ndarray,
num_tokens_padded: int,
num_reqs_padded: int,
num_ubatches: int,
split_point: list[int] | int | None = None,
) -> tuple[UBatchSlices | None, UBatchSlices | None]
Source code in vllm/v1/worker/ubatch_utils.py
slice_query_start_locs ¶
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 ¶
split_attn_metadata(
ubatch_slices: list[UBatchSlice],
common_attn_metadata: CommonAttentionMetadata,
) -> list[CommonAttentionMetadata]
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