[None][perf] Add selectable SafeTensors weight-load policies#16562
Draft
chienchunhung wants to merge 2 commits into
Draft
[None][perf] Add selectable SafeTensors weight-load policies#16562chienchunhung wants to merge 2 commits into
chienchunhung wants to merge 2 commits into
Conversation
Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
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.
What changed
Adds an experimental native TRT-LLM
WeightLoadPlanfor selecting the SafeTensors checkpoint-loading policy. The default ordered plan is:Configure it with
TRTLLM_HF_WEIGHT_LOAD_PLANorHfWeightLoader(weight_load_plan=...). A single policy is strict; a comma-separated string or tuple is an ordered fallback plan.direct_rank_readshared_host_producergpu_broadcastlegacy_fallbackFor eligible dense HF/AUTO SafeTensors checkpoints, the default chooses
direct_rank_read. If the existing raw-weight cache is enabled and no plan is explicitly supplied, legacy behavior is preserved. Explicit cooperative policies take precedence and warn that the cache is bypassed.Why
Cold starts on large checkpoints can be storage-bound. The new plan makes the I/O policy explicit and lets us compare:
without coupling checkpoint source selection (local/HF cache/MX/GMS) to transport and placement policy.
Distributed safety
The cooperative paths add:
The implementation uses regular buffered
preadto warm the OS page cache. It does not claimO_DIRECT, GDS, or direct final GPU placement.What
gpu_broadcastis intended to meanA producer per node or NVLink/NVSwitch island reads bounded chunks, copies them to a producer GPU once, and distributes rank-ready weights over CUDA P2P/NCCL. Replicated tensors can use broadcast; TP/EP-sharded tensors require scatter or grouped send/receive, and PP ranks receive only their owned layers. Whether this beats parallel per-rank H2D depends on topology and shard layout, so this PR reserves the policy without silently routing it through legacy I/O.
Validation
py_compile: passedgit diff --check: passedReal multi-rank MPI validation and cold-cache storage benchmarks remain required before this leaves draft status.