Skip to content

Conversation

@wxsIcey
Copy link
Contributor

@wxsIcey wxsIcey commented Oct 23, 2025

Purpose

Remove cuda hard-code in dual stream execution of FusedMoE

Test Plan

Test through the exsiting tests


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: Icey <1790571317@qq.com>
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 successfully removes hard-coded CUDA dependencies from the FusedMoE layer by replacing CUDA-specific stream operations with platform-agnostic abstractions. This is a valuable change for improving hardware portability. However, I've identified a critical issue that could lead to a runtime crash on TPU platforms due to the new implementation. I have provided a suggested fix to address this potential crash.

Signed-off-by: Icey <1790571317@qq.com>
@wxsIcey
Copy link
Contributor Author

wxsIcey commented Oct 23, 2025

I hope this PR can be included in the next version.

# and other execution modes
if envs.VLLM_DISABLE_SHARED_EXPERTS_STREAM:
logger.info_once("Disabling MoE shared_experts cuda stream")
if envs.VLLM_DISABLE_SHARED_EXPERTS_STREAM or current_platform.is_tpu():
Copy link
Contributor

Choose a reason for hiding this comment

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

why add tpu check here?

Copy link
Contributor

Choose a reason for hiding this comment

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

tpu using xla and the namespace is different from torch.cuda.xxx, maybe we could use torch_xla.core.xla_model for __getattr__ of tpu backend. not sure of that, maybe @DarkLight1337 could help to take a look?

Copy link
Member

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants