Skip to content

[TPU] Fix the test_sampler #17820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged

Conversation

bythew3i
Copy link
Contributor

@bythew3i bythew3i commented May 7, 2025

TLDR: this PR is temporary quick fix for broken CI for tests/v1/tpu/test_sampler.py. Kernel fix is WIP.

After #16458, for the test_sampler_different in tests/v1/tpu/test_sampler.py, we will use (32, 32) block shape instead of (128, 32) block shape. However, this triggers some correctness issue. The root cause is kernel assumes kv_cache has no NAN value. We should fix that in kernel! Meanwhile, just to unblock current CI for TPU, we can reduce max_num_batched_tokens to make the test pass and this should not affect correctness testing. (I have no idea why when max_num_batched_tokens==512, the kv cache will have uninitialized NAN value.)

Signed-off-by: Jevin Jiang <[email protected]>
Copy link

github-actions bot commented May 7, 2025

👋 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 can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

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.

🚀

@mergify mergify bot added v1 tpu Related to Google TPUs labels May 7, 2025
@bythew3i
Copy link
Contributor Author

bythew3i commented May 7, 2025

@bythew3i
Copy link
Contributor Author

bythew3i commented May 7, 2025

Can you PTAL? @mgoin Thanks!

@mgoin
Copy link
Member

mgoin commented May 7, 2025

Cc @NickLucche

Copy link
Member

@mgoin mgoin 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 fix, let's see if CI is green!

@mgoin mgoin added ready ONLY add when PR is ready to merge/full CI is needed ci/build labels May 7, 2025
@yaochengji
Copy link
Collaborator

Yeah, it's strange when theres's NaN as kv cache is initialized by using torch.zeros, see https://github.com/vllm-project/vllm/blob/main/vllm/v1/worker/tpu_model_runner.py#L1281.

The NaN value should be introduced during the model execution, then it is written to kv cache.

Copy link
Collaborator

@yaochengji yaochengji 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 fix!

@NickLucche
Copy link
Contributor

kernel assumes kv_cache has no NAN value. We should fix that in kernel!

The NaN part is a bit concerning, can we dig into the reason as of why we're producing nan values at runtime? I think the kernel assumption is fine as we can't recover from that situation anyway.

@mgoin mgoin merged commit a463555 into vllm-project:main May 8, 2025
73 checks passed
princepride pushed a commit to princepride/vllm that referenced this pull request May 10, 2025
RichardoMrMu pushed a commit to RichardoMrMu/vllm that referenced this pull request May 12, 2025
mawong-amd pushed a commit to ROCm/vllm that referenced this pull request May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build ready ONLY add when PR is ready to merge/full CI is needed tpu Related to Google TPUs v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants