Skip to content

[II] Bound InstantTensor staging for oversized tensors - #326

Closed
voipmonitor wants to merge 1 commit into
dev/infernal-invocationfrom
agent/ii-instanttensor-oversized-fallback
Closed

[II] Bound InstantTensor staging for oversized tensors#326
voipmonitor wants to merge 1 commit into
dev/infernal-invocationfrom
agent/ii-instanttensor-oversized-fallback

Conversation

@voipmonitor

Copy link
Copy Markdown

Behavior

Treats INSTANTTENSOR_BUFFER_SIZE as the maximum individual tensor payload admitted to InstantTensor GPU staging.

  • Selected tensors at or below the limit use the existing InstantTensor path.
  • Selected tensors above the limit load directly from their indexed safetensors file on CPU.
  • Safetensors index and weight-prefix filtering occur before GPU-versus-CPU assignment.
  • Duplicate fallback names, overlap between GPU and CPU selections, invalid buffer values, and empty selections fail explicitly.

Status: implemented and qualified.

Technical reason

InstantTensor otherwise enlarges its reusable GPU staging ring to the checkpoint's largest tensor. A checkpoint with a small desired ring and a few exceptionally large dense tensors cannot honor the memory bound. Loading only those exceptional tensors from CPU keeps the ring bounded while retaining GPU-direct streaming for the rest of the checkpoint.

Compatibility

Deployments without INSTANTTENSOR_BUFFER_SIZE retain their existing loading behavior. INSTANTTENSOR_COPY and borrowed-buffer semantics are unchanged. The fallback applies only to tensors already selected by the checkpoint index and weight-prefix filters.

The CPU path can be slower for an oversized tensor. It is a bounded-memory fallback, not a replacement for InstantTensor streaming.

Validation

Validation used the PyTorch 2.13/CUDA 13.3 Kimi-K3 image:

  • Five CPU metadata, selection, and copy-contract tests pass.
  • One CUDA integration test passes with an 8 MiB staging limit: the 1 MiB tensor is yielded on CUDA, the 9 MiB tensor is yielded on CPU, and both values match their safetensors source exactly.
  • Ruff, formatter verification, Python compilation, and git diff --check pass.

Review scope

This pull request replaces only the oversized-tensor staging responsibility contained in #317. Deferred online-quantization ownership is reviewed independently.

The bounded-staging behavior derives from Luke Alonso's implementation in commit 88721d90dcd90a1f5236b9ecf7e94798245e43bf; the commit retains co-author attribution.

Treat INSTANTTENSOR_BUFFER_SIZE as the largest tensor payload admitted to GPU staging. Selected tensors above that limit bypass the InstantTensor ring and load from their indexed safetensors file on CPU; all remaining tensors retain the existing InstantTensor path.

Index and prefix filtering apply before choosing the fallback, duplicate or overlapping selections fail, and configurations without the buffer limit retain identical behavior.

Validation: five CPU contract tests and one CUDA integration test pass. The CUDA test proves that a small tensor is yielded from CUDA while a tensor larger than the configured 8 MiB staging limit is yielded from CPU with exact values. Ruff, formatting, Python compilation, and whitespace validation pass.

Co-authored-by: Luke Alonso <lalonso@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@voipmonitor, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 24f4c2fa-b313-4057-be77-abd6ecf82b76

📥 Commits

Reviewing files that changed from the base of the PR and between ad848fc and 1bd693b.

📒 Files selected for processing (2)
  • tests/model_executor/model_loader/instanttensor_loader/test_weight_utils.py
  • vllm/model_executor/model_loader/weight_utils.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@voipmonitor

Copy link
Copy Markdown
Author

The behavior implemented by this pull request is preserved unchanged in vLLM #382 as commit 5fb77775ac4c. Stable Git patch IDs match. Review and merge #382; this pull request is closed to avoid duplicate review.

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.

1 participant