Skip to content

[MoE Refactor] Move capture state out of FusedMoE/MoERunner#41997

Closed
bnellnm wants to merge 11 commits into
vllm-project:mainfrom
neuralmagic:fix-capture
Closed

[MoE Refactor] Move capture state out of FusedMoE/MoERunner#41997
bnellnm wants to merge 11 commits into
vllm-project:mainfrom
neuralmagic:fix-capture

Conversation

@bnellnm
Copy link
Copy Markdown
Collaborator

@bnellnm bnellnm commented May 7, 2026

Purpose

Move capture related state out of FusedMoE since it is going away and MoERunner is being refactored.

Related to: #39917

cc @yzong-rh , @TomerBN-Nvidia

Test Plan

Ran tests/model_executor/test_routed_experts_capture.py

Test Result


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.

BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing (anything written below this line will be removed by GitHub Actions)

bnellnm added 2 commits May 7, 2026 21:04
Signed-off-by: Bill Nell <bnell@redhat.com>
Signed-off-by: Bill Nell <bnell@redhat.com>
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 refactors the routing capture mechanism for MoE layers by centralizing the logic for writing to the routing replay buffer within the FusedMoERouter and introducing a layer ID mapping system in RoutedExpertsCapturer. The manual buffer writing previously handled in MoeRunner has been removed. A critical issue was identified in fused_moe_router.py where the select_experts method remains decorated with @AbstractMethod despite now having a concrete implementation, which would prevent the instantiation of its subclasses.

Comment thread vllm/model_executor/layers/fused_moe/router/fused_moe_router.py Outdated
@bnellnm bnellnm changed the title [MoE Refactor] Move capture state out of FusedMoE [MoE Refactor] Move capture state out of FusedMoE/MoERunner May 7, 2026
bnellnm added 2 commits May 7, 2026 21:17
Signed-off-by: Bill Nell <bnell@redhat.com>
Signed-off-by: Bill Nell <bnell@redhat.com>
@bnellnm bnellnm marked this pull request as ready for review May 8, 2026 19:03
@bnellnm bnellnm requested review from mgoin and pavanimajety as code owners May 8, 2026 19:03
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Comment thread vllm/model_executor/layers/fused_moe/routed_experts_capturer.py Outdated
bnellnm added 3 commits May 11, 2026 18:39
Signed-off-by: Bill Nell <bnell@redhat.com>
Signed-off-by: Bill Nell <bnell@redhat.com>
@bnellnm bnellnm requested a review from zyongye as a code owner May 11, 2026 18:57
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 11, 2026

Documentation preview: https://vllm--41997.org.readthedocs.build/en/41997/

@mergify mergify Bot added the documentation Improvements or additions to documentation label May 11, 2026
@bnellnm bnellnm requested a review from yzong-rh May 11, 2026 19:38
Copy link
Copy Markdown
Contributor

@yzong-rh yzong-rh 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

Comment thread vllm/model_executor/layers/fused_moe/layer.py Outdated
@bnellnm
Copy link
Copy Markdown
Collaborator Author

bnellnm commented May 20, 2026

The original PR that required this change got reverted, so I'm closing this.

@bnellnm bnellnm closed this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants