Skip to content

[Refactor] Clean up maybe_padded_num_tokens#5971

Closed
gcanlin wants to merge 1 commit intovllm-project:mainfrom
gcanlin:padded-num
Closed

[Refactor] Clean up maybe_padded_num_tokens#5971
gcanlin wants to merge 1 commit intovllm-project:mainfrom
gcanlin:padded-num

Conversation

@gcanlin
Copy link
Copy Markdown
Collaborator

@gcanlin gcanlin commented Jan 17, 2026

What this PR does / why we need it?

After torchair's removal, we don't need maybe_padded_num_tokens anymore. This PR cleans up it and didn't introduce other changes.

Does this PR introduce any user-facing change?

NO.

How was this patch tested?

Will be tested by CI.

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
@gcanlin gcanlin requested a review from MengqingCao as a code owner January 17, 2026 11:17
@github-actions
Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a clean refactoring that removes the maybe_padded_num_tokens variable, which is no longer needed after the removal of torchair. The changes are consistent across the modified file, including updates to function signatures, return types, and variable usage. The refactoring is well-contained and improves code clarity by removing obsolete logic. I have reviewed the changes and they look good to be correct and safe. No issues were found.

@gcanlin
Copy link
Copy Markdown
Collaborator Author

gcanlin commented Jan 17, 2026

cc @yiz-liu

@gcanlin gcanlin changed the title [Refactor] clean up maybe_padded_num_tokens [Refactor] Clean up maybe_padded_num_tokens Jan 17, 2026
# Otherwise, it's just max_tokens_across_dp_cpu
(maybe_padded_num_tokens, num_tokens_across_dp,
(num_input_tokens, num_tokens_across_dp,
with_prefill) = self._sync_metadata_across_dp(num_input_tokens,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if maybe_padded_num_tokens is useless, why not update _sync_metadata_across_dp as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, _sync_metadata_across_dp doesn't have additional logic to handle maybe_padded_num_tokens. Could you give some guidances for it?

Copy link
Copy Markdown
Collaborator Author

@gcanlin gcanlin Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe_padded_num_tokens is added for NPUTorchairModelRunner, which overrides _sync_metadata_across_dp and returns maybe_padded_num_tokens. But after some torchair related logic had been removed, maybe_padded_num_tokens is totally same as num_input_tokens for now. So we still need to make num_input_tokens to accept the return value of _sync_metadata_across_dp.

Reference:
[1] #2582
[2] https://github.com/yiz-liu/vllm-ascend/blob/005b9af81676cb7b103d51bee3840861d3e70c96/vllm_ascend/torchair/torchair_model_runner.py#L73

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@gcanlin gcanlin closed this Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants