File tree Expand file tree Collapse file tree
vllm/v1/worker/gpu/sample Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,13 +130,18 @@ def compute_topk_scores(
130130 else :
131131 scores = compute_token_logprobs (logits , logprob_token_ids )
132132 else :
133+ # Some requests specified logprob_token_ids. Build the [batch_size,
134+ # 1 + max_cols] token_ids matrix and validity mask on the GPU via a
135+ # single triton kernel, overriding the topk columns with per-request
136+ # tokens where applicable.
133137 assert logprob_token_ids_state is not None
134138 assert expanded_idx_mapping is not None
135139
136140 if num_logprobs > 0 :
137141 topk_token_ids = torch .topk (logits , num_logprobs , dim = - 1 ).indices
138142 topk_token_ids = topk_token_ids .to (torch .int32 )
139143 else :
144+ # This tensor just used as an int32 pointer, data not accessed.
140145 topk_token_ids = logprob_token_ids_state .token_ids .gpu
141146
142147 num_cols = max (num_logprobs , max_per_req_token_ids )
You can’t perform that action at this time.
0 commit comments