Skip to content

vllm.v1.worker.gpu.sample.output

Classes:

  • SamplingMaskTensors –

    Device-side masks pending async D2H: compact ids, plus the bitmask as

SamplingMaskTensors

Bases: NamedTuple

Device-side masks pending async D2H: compact ids, plus the bitmask as the exact fallback for rows wider than max_num_kept.

Methods:

  • cat –

    Join request-contiguous chunks that share one output layout.

  • from_logits –

    Capture the finite-logit support of every row with a sampled token.

  • tolists –

    Convert fixed output rows to the scheduler's CSR representation.

cat(chunks) classmethod

Join request-contiguous chunks that share one output layout.

from_logits(logits, cu_num_logits, num_sampled_tokens, max_num_kept, rows_per_request=1) classmethod

Capture the finite-logit support of every row with a sampled token.

tolists(num_sampled_tokens=None)

Convert fixed output rows to the scheduler's CSR representation.

_compact_sampling_mask_kernel(logits_ptr, logits_row_stride, logits_col_stride, cu_num_logits_ptr, num_sampled_tokens_ptr, token_ids_ptr, token_ids_row_stride, packed_mask_ptr, packed_mask_row_stride, counts_ptr, vocab_size, max_num_kept, ROWS_PER_REQUEST, BLOCK_SIZE)

Per row: first max_num_kept finite-logit ids, the full count, the bitmask.