Skip to content

[Model Loader] Direct reload: lay the checkpoint out where a relocated weight now starts - #65281

Merged
aoshen02 merged 4 commits into
vllm-project:mainfrom
aoshen02:wu/direct-reload-relocated-offset
Nov 3, 2026
Merged

aoshen02 merged 4 commits into
vllm-project:mainfrom
aoshen02:wu/direct-reload-relocated-offset

Conversation

@aoshen02

@aoshen02 aoshen02 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Purpose

With VLLM_RELOAD_MODE=direct, a weight that post-load processing moves into another storage at an offset is reloaded into the wrong place.

record_checkpoint_layout records each weight's storage_offset before post-load processing. On a reload, begin_direct_reload views the weight back to that layout in the storage the weight lives in now. If post-load processing moved the weight into a different storage (e.g. set_ into a fused buffer), the recorded offset belongs to the old storage. The new checkpoint is then written over the neighbouring weight, and the moved weight itself keeps its old bytes.

Example: on ROCm, prepare_compressor_gemm_fusion in DeepSeek-V4 does indexer_weight.set_(fused_weight[main_size:]). On a reload, the indexer compressor weight was written over the main compressor rows. DeepSeek-V4-Pro GSM8K after reloading the original weights dropped from 0.96 to 0.885.

Fix

Also record the storage's data_ptr. If the weight's storage has changed by reload time, use its current storage_offset() instead of the recorded one. Only reload/direct.py changes (+4/−1).

Test Plan

  • New test_reload_into_weight_moved_to_an_offset. The toy model's post-load processing moves proj.weight into a new buffer at an offset. A reload must match a fresh cold start and keep every address.
  • tests/model_executor/model_loader/test_direct_reload.py on GB300, run with this PR and with main's direct.py.
  • DeepSeek-V4-Pro (heterogeneous, TP8, CUDA graphs, compressor GEMM fusion on) on MI355X with VLLM_RELOAD_MODE=direct: cold GSM8K (400, 5-shot), then reload original → perturbed → original, plus a data_ptr report. This also needs a separate fix for a KeyError in the DeepSeek-V4 ROCm preshuffle scales (stacked on [Model Loader] Refill weight-derived tensors in place on every post-load rerun #64692).

Test Result

test_direct_reload.py
this PR 36 passed
main direct.py new test fails
DeepSeek-V4-Pro, MI355X cold reload orig reload perturbed reload orig moved tensors
before (KeyError worked around) 0.96 0.885 – – 30 (indexer compressor.fused_wkv_wgate.weight)
this PR 0.965 0.9675 0.035 0.9575 0 / 3480

🤖 Generated with Claude Code

aoshen02 and others added 3 commits November 3, 2026 07:08
…d weight now starts

`record_checkpoint_layout` records each weight's storage offset at load time.
When post-load processing moves a weight into another storage (rebinding it,
or `set_` into a buffer it shares, e.g. the DeepSeek-V4 ROCm compressor GEMM
fusion), that offset points into the old storage, so `begin_direct_reload`
viewed the checkpoint at the wrong place in the new buffer and the reload
overwrote the neighbouring weight. Record the storage too, and use the
weight's current offset when it has moved.

Signed-off-by: aoshen02 <aoshen@inferact.ai>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s storage

Signed-off-by: aoshen02 <aoshen@inferact.ai>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s test

Signed-off-by: aoshen02 <aoshen@inferact.ai>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

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.

@hao-aaron hao-aaron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@aoshen02

aoshen02 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/ci run

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #99464 for commit 6f077a5f0d96.

@aoshen02
aoshen02 merged commit 66360a5 into vllm-project:main Nov 3, 2026
109 checks passed
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.

3 participants