IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python function

window_row_plan

window_row_plan()​

max.pipelines.speculative.gated_delta_rollback.window_row_plan(merged_offsets, num_accepted, num_draft_tokens, total_rows, device)

source

Plans the replay over the verify’s per-row window copy.

The verify copies each row of at most K + 1 tokens into one K + 1 slot, so request r’s rows start at r * (K + 1) and a row longer than the window, which the verify committed itself, replays nothing (ring_accepted_lengths()).

Parameters:

  • merged_offsets (TensorValue) – [batch + 1] offsets of the verified sequence.
  • num_accepted (TensorValue) – [batch] accepted draft tokens per request.
  • num_draft_tokens (TensorValue) – Scalar K on device.
  • total_rows (Dim) – Row count of the window copy the replay gathers from.
  • device (DeviceRef) – Device the plan is built on.

Returns:

which row of the window copy feeds each replay row, and the ragged offsets over them.

Return type:

(row_indices, replay_offsets)