Skip to content

[PluggableLayer][1/N] Define PluggableLayer#32331

Merged
ProExpertProg merged 7 commits intovllm-project:mainfrom
whx-sjtu:pluggable_layer
Jan 20, 2026
Merged

[PluggableLayer][1/N] Define PluggableLayer#32331
ProExpertProg merged 7 commits intovllm-project:mainfrom
whx-sjtu:pluggable_layer

Conversation

@whx-sjtu
Copy link
Contributor

@whx-sjtu whx-sjtu commented Jan 14, 2026

EDIT: Reverted in #32725, reapplied in #32744

Purpose

First implementation of RFC #23786: Define PluggableLayer and apply to MLA as an example.

Test Plan

New ut waitted to be added.

Test Result

All ci should pass.

CC List

@ProExpertProg @wangxiyuan @jgong5 @Yikun


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.

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 introduces a new CustomLayer abstraction to handle out-of-tree layer replacements, refactoring this logic out of CustomOp. Existing layers like FusedMoE and MultiHeadLatentAttentionWrapper are updated to use CustomLayer. My review focuses on a critical syntax error and improving the clarity of the new CustomLayer implementation.

Copy link
Collaborator

@ProExpertProg ProExpertProg left a comment

Choose a reason for hiding this comment

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

Are we really not going to break OOT overriding of custom ops by removing register_oot from CustomOp?

@ProExpertProg
Copy link
Collaborator

Let's port the register_oot functionality and op_registry_oot over to the new layer and make them share the registry, but keep the functionality in CustomOp. That way CustomOp-based layers can slowly migrate over to the new layer abstraction without breaking anything

@whx-sjtu
Copy link
Contributor Author

Currently this PR indeed breaks the original register_oot function. My original intention was to further differentiate the definitions of CustomLayer and CustomOp, and to redefine the usage of CustomOp. However, it seems the RFC #32358 proposed by @ProExpertProg offers a better solution to this. Based on this, I believe my PR can focus on defining PluggableLayer while preserving as much existing functionality as possible.

@whx-sjtu whx-sjtu changed the title [WIP] Implement CustomLayer to complement for CustomOp [PluggableLayer][1/N] Define PluggableLayer Jan 15, 2026
@whx-sjtu
Copy link
Contributor Author

whx-sjtu commented Jan 15, 2026

Let's port the register_oot functionality and op_registry_oot over to the new layer and make them share the registry, but keep the functionality in CustomOp. That way CustomOp-based layers can slowly migrate over to the new layer abstraction without breaking anything

I will migrate register_oot functionality and op_registry_oot to PluggableLayer. But I think the enalbed and default_on mechanism which is introduced to control fine-grained CustomOp enabling, is not needed by PluggableLayer anymore, right? @ProExpertProg

@whx-sjtu whx-sjtu force-pushed the pluggable_layer branch 2 times, most recently from d43fc9b to 2ede0ea Compare January 15, 2026 07:34
@mergify
Copy link

mergify bot commented Jan 15, 2026

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

@mergify mergify bot added the documentation Improvements or additions to documentation label Jan 15, 2026
@whx-sjtu whx-sjtu changed the title [PluggableLayer][1/N] Define PluggableLayer [WIP][PluggableLayer][1/N] Define PluggableLayer Jan 15, 2026
@whx-sjtu whx-sjtu marked this pull request as ready for review January 15, 2026 09:37
@mergify
Copy link

mergify bot commented Jan 15, 2026

Hi @whx-sjtu, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy or markdownlint failing?
mypy and markdownlint are run differently in CI. If the failure is related to either of these checks, please use the following commands to run them locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10
# For markdownlint
pre-commit run --hook-stage manual markdownlint

@whx-sjtu whx-sjtu changed the title [WIP][PluggableLayer][1/N] Define PluggableLayer [PluggableLayer][1/N] Define PluggableLayer Jan 16, 2026
Copy link
Collaborator

@ProExpertProg ProExpertProg left a comment

Choose a reason for hiding this comment

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

Looks good to me! Let's see that tests pass, and then could you make a tracking issue with the list of all custom ops that should be ported over (the ones that only have 1 in-tree implementation)? Those with multiple in-tree implementations will be ported over later as we transition them to vLLM IR.

@ProExpertProg ProExpertProg added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 20, 2026
# - MyOp.enabled()
# - op_registry["my_op"].enabled()
op_registry: dict[str, type["CustomOp"]] = {}
op_registry_oot: dict[str, type["CustomOp"]] = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: type should be CustomOp or PluggableLayer

@wangxiyuan
Copy link
Contributor

Looks good to me! Let's see that tests pass, and then could you make a tracking issue with the list of all custom ops that should be ported over (the ones that only have 1 in-tree implementation)? Those with multiple in-tree implementations will be ported over later as we transition them to vLLM IR.

++, it'll make the workflow more clear

@whx-sjtu
Copy link
Contributor Author

Looks good to me! Let's see that tests pass, and then could you make a tracking issue with the list of all custom ops that should be ported over (the ones that only have 1 in-tree implementation)? Those with multiple in-tree implementations will be ported over later as we transition them to vLLM IR.

Sure

Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: whx-sjtu <2952154980@qq.com>
@mergify
Copy link

mergify bot commented Jan 20, 2026

Hi @whx-sjtu, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy or markdownlint failing?
mypy and markdownlint are run differently in CI. If the failure is related to either of these checks, please use the following commands to run them locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10
# For markdownlint
pre-commit run --hook-stage manual markdownlint

@whx-sjtu
Copy link
Contributor Author

whx-sjtu commented Jan 20, 2026

The tracker list is here: #32676. Note that for some custom ops like short_conv, it has forward_cuda and an empty forward_native. I'm not sure whether it might have other in-tree implementations and assign it to PluggableLayer for now. Could you please review and make sure of it with other related maintainers @ProExpertProg ? Thanks a lot.

Signed-off-by: whx-sjtu <2952154980@qq.com>
@ProExpertProg ProExpertProg enabled auto-merge (squash) January 20, 2026 16:10
@ProExpertProg ProExpertProg merged commit 4ca62a0 into vllm-project:main Jan 20, 2026
49 checks passed
robertgshaw2-redhat added a commit that referenced this pull request Jan 20, 2026
gopalsarda pushed a commit to gopalsarda/vllm that referenced this pull request Jan 20, 2026
Signed-off-by: whx-sjtu <2952154980@qq.com>
@mergify
Copy link

mergify bot commented Jan 21, 2026

⚠️ The sha of the head commit of this PR conflicts with #32744. Mergify cannot evaluate rules on this PR. ⚠️

dsuhinin pushed a commit to dsuhinin/vllm that referenced this pull request Jan 21, 2026
Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
monajafi-amd pushed a commit to monajafi-amd/vllm that referenced this pull request Jan 23, 2026
Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: mohammad najafi <mohammad.najafi@amd.com>
lapy pushed a commit to lapy/vllm that referenced this pull request Jan 27, 2026
Signed-off-by: whx-sjtu <2952154980@qq.com>
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 ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: Design a new Layer-Pluggable abstraction to work together with CustomOp

3 participants