Skip to content

[Core] Register persistent device tensors held outside modules - #95

Open
aoshen02 wants to merge 40 commits into
mainfrom
wu/split-01-framework
Open

aoshen02 wants to merge 40 commits into
mainfrom
wu/split-01-framework

Conversation

@aoshen02

@aoshen02 aoshen02 commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Overview

Adds a way to register every persistent device tensor as a parameter or buffer of the module that owns it, and a CI check that no new unregistered tensor appears. Sleep mode level 2, CUDA-graph address checks and weight reload only see parameters and buffers, so a tensor stored anywhere else comes back stale or freed after sleep/wake or a weight update. Context: weight reload RFC vllm-project#54477, tracker vllm-project#50079.

This is the first of a split series; follow-ups register the remaining sites per area and delete their entries from the CI allowlist. Follow-ups, each stacked only on this PR: #96 (Sentence-Transformers projector, sleep-mode bug fix), #97 (attention), #98 (linear kernels and schemes), #99 (MoE, NVFP4 sleep-mode bug fix), #100 (shared layers and model_executor models), #101 (DeepSeek-V4 / Kimi-K3), #102 (GLM5-next, Inkling, dots3).

Claims

  • set_derived_buffer and register_constant_buffer give model code one way to keep weight-derived tensors and constants as non-persistent buffers, so state_dict() and checkpoints are unchanged.
  • Non-module holders (quant methods by default) list their tensors in persistent_tensors(). register_held_tensors(model) registers them on the holding module after post-load and after layerwise reload.
  • Layerwise reload refills derived buffers in place instead of leaving stale copies.
  • test_initialization.py::can_initialize fails when an architecture keeps an unregistered device tensor, except for paths in KNOWN_UNREGISTERED. Today's remaining sites are listed there and are removed by the follow-ups.

Validation

GB200, image nightly-dev-arm64-cu130-ac9126e58aa7 overlaid with this change only.

Check Result
test_initialization, all 396 registered architectures, dummy weights, oracle without the allowlist 363 pass with zero unregistered tensors. 29 report only paths now in KNOWN_UNREGISTERED. 4 fail the same way on main: DeepSeek-V4.1 (IndexError), LongcatFlashNgram (no cacheable KV group), Ultravox and HCXVisionV2 (transformers 5.18).
The 29 with the allowlist 29/29 pass
Unit tests: tests/model_executor/test_utils.py (set_derived_buffer, register_held_tensors through views, dtypes and wrapper subclasses, layerwise reload keeps derived state registered) pass
pre-commit, mypy pass

Gated checkpoints were swapped for ungated mirrors of the same architecture.

Details

  • register_held_tensors registers each declared tensor as _held_<attr>_<name>, deduplicated per storage view (pointer, offset, shape, stride, dtype) and through traceable wrapper subclasses such as TorchAO. Rerunning it replaces every _held_* buffer; a holder still on meta keeps the imported buffer.
  • Layerwise reload points derived buffers at their kernel storage before a layer is reprocessed, so set_derived_buffer refills them in place, and keeps a buffer that processing rebinds. The sharded RDT engine shares that preparation.
  • Runtime state (KV caches, per-step scratch, workspaces, compile artifacts) is exempt by attribute name, with the reason in RUNTIME_STATE_ATTRS.
  • The oracle only sees tensors reachable from module attributes; shape-keyed runtime caches (lru_cache, module globals) count as runtime state.

Not a duplicate. I searched open PRs for register buffer sleep mode, named_buffers sleep, unregistered tensors, persistent tensors buffer and derived buffer reload. @Ronald1995's Weight Reload series (vllm-project#53509, vllm-project#58991, vllm-project#58995, vllm-project#58999, vllm-project#59000, vllm-project#59002, vllm-project#59003, vllm-project#53510) and vllm-project#50521 / vllm-project#48539 make individual derived tensors reload-correct. This PR adds one registration contract and a CI check over every architecture; overlapping sites will rebase onto whichever lands first.

AI assistance. Written with Claude Code. Claude Fable 5.1, Codex (gpt-6-astra) and Kimi K3 audited the combined change in two rounds. The submitter reviewed every changed line and ran the checks above.


Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (Mandatory for agents, optional for humans).

  • AI assistance was used during the creation of this PR.

  • Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.

  • Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.

  • Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.

  • Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.

🤖 Generated with Claude Code

yewentao256 and others added 30 commits October 2, 2026 20:05
…mprovement for concurrency 1 (vllm-project#57443)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
…image (vllm-project#59288)

Signed-off-by: Shang Wang <samshang.wang@mail.utoronto.ca>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: Shengqi Chen <harry-chen@outlook.com>
…2641)

Signed-off-by: DOCCA0 <2947323341@qq.com>
Co-authored-by: Robert Shaw <114415538+robertgshaw2-redhat@users.noreply.github.com>
…llm-project#59568)

Signed-off-by: Milosz Grunwald <milosz.grunwald@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
…dding correctness (vllm-project#59333)

Signed-off-by: Divakar Verma <divakar.verma@amd.com>
Signed-off-by: Nils Matteson <nilsmatteson@icloud.com>
…ct#59661)

Signed-off-by: Nils Matteson <nilsmatteson@icloud.com>
…vllm-project#56679)

Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Signed-off-by: Andreas Karatzas <andreas.karatzas@protonmail.com>
Signed-off-by: Stefan Koncarevic <stefan.koncarevic@amd.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: Stefan Koncarevic <stefan.koncarevic@amd.com>
…-project#59850)

Signed-off-by: khluu <khluu000@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… zeroing (vllm-project#59504)

Signed-off-by: Yifan Qiao <yifanqiao@inferact.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Codex <noreply@openai.com>
…ect#51274)

Signed-off-by: Markus Hartikainen <markus.hartikainen@amd.com>
Signed-off-by: Hartikainen <mahartik@amd.com>
…t#56851 Phase 1) (vllm-project#58588)

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
…-project#56860) (vllm-project#56984)

Signed-off-by: aoshen02 <aoshen02@users.noreply.github.com>
Co-authored-by: aoshen02 <aoshen02@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… the GIL (vllm-project#59441)

Signed-off-by: whx-sjtu <xiaowang990929@gmail.com>
Co-authored-by: Codex <noreply@openai.com>
…t#54706)

Signed-off-by: AIwork4me <AIwork4me@users.noreply.github.com>
Co-authored-by: AIwork4me <AIwork4me@users.noreply.github.com>
Co-authored-by: JartX <sagformas@epdcenter.es>
…59462)

Signed-off-by: Wei Zhao <51183510+wzhao18@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: aoshen02 <aoshen@inferact.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…treams (vllm-project#47933)

Signed-off-by: Ting Sun <suntcrick@gmail.com>
Signed-off-by: Flora Feng <4florafeng@gmail.com>
Co-authored-by: Flora Feng <4florafeng@gmail.com>
…onse (vllm-project#59859)

Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
Signed-off-by: sfeng33 <4florafeng@gmail.com>
Co-authored-by: Flora Feng <4florafeng@gmail.com>
…ct#56691)

Signed-off-by: Ylean <61880605+Woolgathererer@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
…lm-project#59159)

Signed-off-by: Yongqi Wang <yongqi.wang@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
Co-authored-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com>
…llm-project#59521)

Signed-off-by: aarushjain29 <aarushi.jain2@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
divyvasal and others added 10 commits October 4, 2026 11:13
… backend (vllm-project#58457)

Signed-off-by: Divy <divy@coralbricks.ai>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
…dd GLM-4-9B and Phi-4 to batch-invariant tested models (vllm-project#53692)

Signed-off-by: Yifan Da <1363818765@qq.com>
Signed-off-by: LioEinaudi <zhao3024667639@gmail.com>
Signed-off-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
Co-authored-by: Yifan Da <1363818765@qq.com>
Co-authored-by: CodeBuddy <noreply@codebuddy.dev>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
…lm-project#40986)

Signed-off-by: 1fanwang <1fannnw@gmail.com>
Co-authored-by: Robert Shaw <114415538+robertgshaw2-redhat@users.noreply.github.com>
…llm-project#59106)

Signed-off-by: Prudhvivuda <prudhvi12042001@gmail.com>
Signed-off-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…oject#59889)

Signed-off-by: TyroneNel <71038642+TyroneNel@users.noreply.github.com>
Signed-off-by: TyroneNel <Tyrone.Nel@gmail.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…riance (vllm-project#59377)

Signed-off-by: Shenglei Fu <117230642+ShengleiFu@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
…-project#58560)

Signed-off-by: bluemelov <hannes.b2411@eva.space>
Signed-off-by: Yifan Qiao <yifanqiao@inferact.ai>
Co-authored-by: bluemelov <hannes.b2411@eva.space>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Yifan Qiao <yifanqiao@inferact.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ints (vllm-project#59990)

Signed-off-by: Vadim Gimpelson <vadim.gimpelson@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
…RV2 resume (vllm-project#57816)

Signed-off-by: Kam Basra <kameldipbasra@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Sleep mode level 2 saves and restores only named_buffers(); CUDA-graph
address checks and weight reload also see only parameters and buffers. A
persistent device tensor kept anywhere else comes back stale or freed.

- set_derived_buffer: fill a None placeholder registered in __init__, then
  copy later values in place; shape/dtype changes raise.
- register_constant_buffer: a non-persistent constant no checkpoint
  provides, so layerwise reload does not wait for it.
- persistent_tensors() on non-module holders, with QuantizeMethodBase
  returning held_tensors(self) by default; held_tensors and
  dataclass_tensors build it.
- register_held_tensors(model) runs after process_weights_after_loading and
  after layerwise reload, and registers each declared tensor on the module
  holding the object as _held_<attr>_<name>, deduplicated per storage view.
- Layerwise reload points derived buffers at their kernel storage before
  reprocessing a layer and keeps a derived buffer that processing rebinds;
  the sharded RDT engine shares the same preparation.
- test_initialization asserts that no unregistered device tensor remains
  (tests/models/utils.py::find_unregistered_tensors), except attributes in
  KNOWN_UNREGISTERED, which follow-up changes remove as they register them.

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