Repository navigation
[Model Loader] Direct reload: lay the checkpoint out where a relocated weight now starts - #65281
Merged
aoshen02 merged 4 commits intoNov 3, 2026
Merged
Conversation
…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>
ZJY0516
approved these changes
Nov 3, 2026
Contributor
Author
|
/ci run |
|
✅ Triggered Buildkite CI #99464 for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_layoutrecords each weight'sstorage_offsetbefore post-load processing. On a reload,begin_direct_reloadviews 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_fusionin DeepSeek-V4 doesindexer_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 currentstorage_offset()instead of the recorded one. Onlyreload/direct.pychanges (+4/−1).Test Plan
test_reload_into_weight_moved_to_an_offset. The toy model's post-load processing movesproj.weightinto 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.pyon GB300, run with this PR and with main'sdirect.py.VLLM_RELOAD_MODE=direct: cold GSM8K (400, 5-shot), then reload original → perturbed → original, plus adata_ptrreport. This also needs a separate fix for aKeyErrorin 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.pydirect.pycompressor.fused_wkv_wgate.weight)🤖 Generated with Claude Code