[MRV2] Miscellaneous code cleanup (#57980)

This commit is contained in:
Nick Hill
2026-09-23 01:51:52 -07:00
committed by GitHub
parent 36bc694889
commit afec265bca
24 changed files with 163 additions and 326 deletions
+3 -14
View File
@@ -17,12 +17,7 @@ if TYPE_CHECKING:
class InputBuffers:
def __init__(
self,
max_num_reqs: int,
max_num_tokens: int,
device: torch.device,
):
def __init__(self, max_num_reqs: int, max_num_tokens: int, device: torch.device):
self.max_num_reqs = max_num_reqs
self.max_num_tokens = max_num_tokens
self.device = device
@@ -474,11 +469,7 @@ def combine_sampled_and_draft_tokens(
num_reqs = idx_mapping.shape[0]
num_speculative_steps = draft_tokens.shape[-1]
logits_indices = torch.empty(
num_logits,
dtype=torch.int64,
device=input_ids.device,
)
logits_indices = torch.empty(num_logits, dtype=torch.int64, device=input_ids.device)
_combine_sampled_and_draft_tokens_kernel[(num_reqs,)](
input_ids,
idx_mapping,
@@ -711,9 +702,7 @@ def expand_idx_mapping(
) -> tuple[torch.Tensor, torch.Tensor]:
num_reqs = idx_mapping.shape[0]
expanded_idx_mapping = idx_mapping.new_empty(total_num_logits)
expanded_local_pos = torch.empty(
total_num_logits, dtype=torch.int32, device=idx_mapping.device
)
expanded_local_pos = idx_mapping.new_empty(total_num_logits)
_expand_idx_mapping_kernel[(num_reqs,)](
idx_mapping,
expanded_idx_mapping,