Skip to content

Conversation

@rjrock-amd
Copy link

@rjrock-amd rjrock-amd commented Nov 18, 2025

Resolves issue #28490.

Purpose

This PR moves the typecast after torch.cumsum, to prevent unwanted promotion to int64.

Test Plan

pytest -s -v 'tests/kernels/attention/test_prefix_prefill.py'

Test Result

160 passed, 224 skipped, 3 warnings in 178.15s


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Signed-off-by: Ryan Rock <ryan.rock@amd.com>
@mergify mergify bot added the rocm Related to AMD ROCm label Nov 18, 2025
Copy link
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 addresses an issue with torch.cumsum on AMD platforms by moving the type cast to int32 after the cumsum operation, preventing an unwanted promotion to int64. The change is correct and effectively resolves the issue for the line it modifies. However, the fix is incomplete as several other instances of the same code pattern exist within the same test file. I've added a comment to highlight these other locations that require the same fix to ensure test stability on AMD platforms.

b_seq_len = torch.tensor(seq_lens, dtype=torch.int32)
b_ctx_len = torch.tensor(ctx_lens, dtype=torch.int32)
b_start_loc = torch.cumsum(torch.tensor([0] + query_lens, dtype=torch.int32), dim=0)
b_start_loc = torch.cumsum(torch.tensor([0] + query_lens), dim=0).to(torch.int32)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

While this change correctly fixes the unwanted type promotion for b_start_loc, the same pattern that causes this issue appears to be present in other parts of this file. To ensure all tests pass reliably on AMD platforms, please consider applying a similar fix to:

  • b_seq_start_loc in this function (line 180)
  • b_start_loc in test_contexted_kv_attention_alibi (line 420)
  • b_seq_start_loc in test_contexted_kv_attention_alibi (line 423)

@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

Copy link
Member

@yewentao256 yewentao256 left a comment

Choose a reason for hiding this comment

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

Thanks for the work! Please also take a look what Gemini suggests and we can land this PR

Signed-off-by: Ryan Rock <ryan.rock@amd.com>
Copy link
Member

@yewentao256 yewentao256 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the work!

@yewentao256 yewentao256 added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 19, 2025
@yewentao256 yewentao256 merged commit 68d7231 into vllm-project:main Nov 19, 2025
17 checks passed
Victor49152 pushed a commit to Victor49152/vllm that referenced this pull request Nov 20, 2025
Signed-off-by: Ryan Rock <ryan.rock@amd.com>
@rjrock-amd rjrock-amd deleted the ci/amd_prefix_prefill branch November 20, 2025 19:43
LuminolT pushed a commit to LuminolT/vllm that referenced this pull request Nov 21, 2025
Signed-off-by: Ryan Rock <ryan.rock@amd.com>
Signed-off-by: LuminolT <lumischen01@gmail.com>
bigPYJ1151 pushed a commit that referenced this pull request Nov 25, 2025
Signed-off-by: Ryan Rock <ryan.rock@amd.com>
Signed-off-by: jiang1.li <jiang1.li@intel.com>
bringlein pushed a commit to bringlein/vllm that referenced this pull request Nov 26, 2025
Signed-off-by: Ryan Rock <ryan.rock@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants