Skip to content

[BUG] Exclude SKIP_TENSORS from get_layer_size() + new weight sync example for dpep - #37334

Merged
robertgshaw2-redhat merged 4 commits into
vllm-project:mainfrom
hao-aaron:layerwise-fix
Mar 19, 2026
Merged

[BUG] Exclude SKIP_TENSORS from get_layer_size() + new weight sync example for dpep#37334
robertgshaw2-redhat merged 4 commits into
vllm-project:mainfrom
hao-aaron:layerwise-fix

Conversation

@hao-aaron

@hao-aaron hao-aaron commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Purpose

get_layer_size() included SKIP_TENSORS buffers (e.g. _expert_map) when computing load_numel_total, but these buffers are never offloaded to meta device and never loaded via weight_loader. This caused load_numel to never reach load_numel_total for FusedMoE layers, preventing _layerwise_process from ever firing. As a result, all incoming expert weights accumulated indefinitely in info.loaded_weights until the GPU ran out of memory.

During initialize_layerwise_reload, each layer's load_numel_total is set by get_layer_size(), which summed the numel of all parameters and buffers. For SharedFusedMoE layers, this included _expert_map (a 128-element int32 buffer) and other EP-related buffers listed in SKIP_TENSORS. These buffers are intentionally skipped by restore_layer_on_meta — they stay on GPU and are never loaded through weight_loader. This created a permanent gap (128 elements) between load_numel (150,994,944) and load_numel_total (150,995,072), so the completion condition load_numel >= load_numel_total was never satisfied. The layer was never materialized/freed, and cached weights grew until OOM.

Test Plan

New weight sync example for dpep using Qwen/Qwen3-30B-A3B


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.

x
Signed-off-by: ahao-anyscale <ahao@anyscale.com>
@hao-aaron
hao-aaron requested a review from 22quinn as a code owner March 17, 2026 18:18

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 resolves a bug in get_layer_size by correctly excluding tensors that are not intended for loading, thereby preventing an OOM error with FusedMoE layers. The fix is sound and properly manages circular dependencies. Additionally, a new example for weight synchronization with FSDP is introduced. In this new example file, I identified a portability issue due to a hardcoded PYTHONPATH, which would hinder other users from running the example without changes. A fix has been suggested for this.

Comment thread examples/offline_inference/new_weight_syncing/rlhf_nccl_fsdp_ep.py Outdated
x
Signed-off-by: ahao-anyscale <ahao@anyscale.com>

@kylesayrs kylesayrs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Safe and good, thanks!

@mergify

mergify Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

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

@mergify mergify Bot added documentation Improvements or additions to documentation bug Something isn't working labels Mar 17, 2026
Signed-off-by: ahao-anyscale <ahao@anyscale.com>
@robertgshaw2-redhat robertgshaw2-redhat added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 18, 2026
@robertgshaw2-redhat
robertgshaw2-redhat enabled auto-merge (squash) March 18, 2026 22:29
@robertgshaw2-redhat
robertgshaw2-redhat merged commit 5f82706 into vllm-project:main Mar 19, 2026
51 checks passed
SouthWest7 pushed a commit to SouthWest7/vllm that referenced this pull request Mar 27, 2026
…ample for dpep (vllm-project#37334)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
khairulkabir1661 pushed a commit to khairulkabir1661/vllm that referenced this pull request Mar 27, 2026
…ample for dpep (vllm-project#37334)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
JiantaoXu pushed a commit to JiantaoXu/vllm that referenced this pull request Mar 28, 2026
…ample for dpep (vllm-project#37334)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
mtparet pushed a commit to blackfuel-ai/vllm that referenced this pull request Apr 9, 2026
…ample for dpep (vllm-project#37334)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
alankessler added a commit to alankessler/vllm that referenced this pull request Apr 13, 2026
…True

The layerwise reload mechanism wraps weight loaders for all tensors
not in SKIP_TENSORS. This prevents bias parameters from loading
correctly during online FP8 quantization, leaving them as zeros.

Qwen2 is the most visible case (bias=True on qkv_proj), but any
architecture with biased linear layers is affected.

Fixes: vllm-project#39663
Related: vllm-project#37334, vllm-project#38746

Signed-off-by: Alan Kessler <alankessler@gmail.com>
mystous pushed a commit to mystous/vllm_hybrid that referenced this pull request May 10, 2026
…ample for dpep (vllm-project#37334)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
my-other-github-account pushed a commit to my-other-github-account/vllm that referenced this pull request May 15, 2026
…ample for dpep (vllm-project#37334)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
my-other-github-account pushed a commit to my-other-github-account/vllm that referenced this pull request May 15, 2026
…ample for dpep (vllm-project#37334)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
mvanhorn pushed a commit to mvanhorn/vllm that referenced this pull request Jun 4, 2026
…ample for dpep (vllm-project#37334)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
plasticchris pushed a commit to plasticchris/vllm that referenced this pull request Jul 20, 2026
…ample for dpep (vllm-project#37334)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working 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.

3 participants