[II] Bound InstantTensor staging for oversized tensors - #326
Conversation
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>
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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. Comment |
Behavior
Treats
INSTANTTENSOR_BUFFER_SIZEas the maximum individual tensor payload admitted to InstantTensor GPU staging.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_SIZEretain their existing loading behavior.INSTANTTENSOR_COPYand 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:
git diff --checkpass.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.