vllm.models.hy_v4.nvidia.dfly_inputs
¶
Fused DFly draft input preparation.
Three launches replace the per-step torch ops: one per request for the query block and sampling state, one per KV group for the query slots, and one for the sparse indices of every draft layer.
Functions:
-
build_dfly_reuse_indices–Fill
out[layer, :padded_batch * query_width]for every draft layer. -
prepare_dfly_inputs–Fill the query block of
padded_batchrequests. Rows pastnum_reqs
_build_dfly_reuse_indices_kernel(out_ptr, out_layer_stride, out_row_stride, snapshot_ptr, snapshot_slot_stride, snapshot_row_stride, layer_snapshot_slots_ptr, active_ptr, source_rows_ptr, anchors_ptr, TARGET_TOPK, LOCAL_WINDOW, QUERY_WIDTH, OUT_WIDTH, BLOCK_SIZE)
¶
Per query row: target top-k history, local window, then causal block.
Source code in vllm/models/hy_v4/nvidia/dfly_inputs.py
build_dfly_reuse_indices(out, snapshots, layer_snapshot_slots, active, source_rows, anchors, target_topk, local_window, query_width, padded_batch)
¶
Fill out[layer, :padded_batch * query_width] for every draft layer.
Source code in vllm/models/hy_v4/nvidia/dfly_inputs.py
prepare_dfly_inputs(*, input_ids, positions, is_padding, query_start_loc, seq_lens, active, source_rows, anchors, target_hidden_out, mrope_positions, draft_idx_mapping, out_temperature, out_seeds, target_query_start_loc, target_positions, idx_mapping, num_sampled, num_rejected, last_sampled, target_hidden, mrope_delta, temperature, seeds, max_model_len, mask_token_id, query_width, num_reqs, padded_batch)
¶
Fill the query block of padded_batch requests. Rows past num_reqs
are inactive padding, and num_reqs=0 gives an all-padding block for
dummy runs and capture.
Source code in vllm/models/hy_v4/nvidia/dfly_inputs.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 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 | |