Reduce per-step TorchSampler RNG staging work
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- machine-learning, performance
Research direction
Start by reading TorchSampler._stage_fast_sampling_seeds and the internal seed manager; trace how persistent seed and offset buffers are filled during stage_in_graph_sampling and how eager sampling uses the allocating API. Compare the seeded and unseeded paths while preserving request-local streams, slot ownership, and padding semantics. Done means the live buffer prefix is prepared directly, host-only counters stay as Python integers, and the existing sampler and in-graph request-seed tests pass.
Written by the indexing model from the issue text.
Description
Motivation
On main at 1df5c23d, the PyTorch backend's TorchSampler._stage_fast_sampling_seeds creates temporary device seed/offset tensors and then copies them to the graph sampler's persistent input buffers on each decode step.
A warmed CUDA trace of three calls to stage_in_graph_sampling followed by sample_in_graph replay shows:
- Unseeded: six initialization kernels and six device-to-device copies for RNG metadata.
- Seeded: six host-to-device copies followed by six device-to-device copies; host seed/offset preparation also reads and updates CPU tensor scalars for each row.
The persistent destination buffers already exist. Their live prefix can be filled directly without changing request-local streams, slot ownership, or padding semantics.
Proposed change
Let the internal seed manager optionally receive the destination seed/offset tensors. Fuse unseeded initialization into one kernel; copy seeded/mixed host values directly into the destination through named device_copy sites. Keep host-only counters as Python integers. Preserve the existing allocating API for eager sampling.
This follows the fixed-capacity sampling-input preparation used by DeepInfer, adapted to TensorRT-LLM's existing RNG and copy contracts. It complements #19719, #18437 and #21974; it does not change the penalty/embedding-bias paths in #21864 or #22638.
Validation
The implementation has been tested on one NVIDIA H20 using current-main sampler sources over the official 1.4.0rc5 runtime: 44 in-graph/request-seed tests, plus 271 sampler/greedy tests (131 architecture/feature skips), and actual HTTP streaming service comparisons with Qwen3.5-0.8B and Qwen3-4B. Seeded outputs match the baseline. The measured benefit is workload-dependent: sampler staging improves, smaller-model seeded concurrent serving benefits, and Qwen3-4B TPOT remains approximately unchanged. The linked implementation PR will include the configurations and results.
- Dominant language
- Python
- Stars
- 15.2k
- Forks
- 3k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 477
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NVIDIA/TensorRT-LLM
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xPossibly taken @NimaVaziri claimed this today. OpenPytorch
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainers usually reply within 1 day
-
Inference runtime Windows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
NVIDIA/TensorRT-LLM#23394 ·
Maintainers usually reply within 1 day
-
[Bug]: MMLU subsampling changes when evaluators are interleavedPossibly taken @LeNeLeNeWo claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NVIDIA/TensorRT-LLM#23273 ·
Maintainers usually reply within 1 day
-
Trace-replay Pareto window includes the drain when sessions finish out of admission orderPossibly taken @sbeierle claimed this 3 days ago. OpenTesting
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
NVIDIA/TensorRT-LLM#23077 ·
Maintainers usually reply within 1 day
-
LongBench V2 blog command breaks on inline comments after continuationsPossibly taken @ddlw claimed this 25 days ago. OpenDoc
Difficulty 1/5 Under an hour Newbie friendliness 91/100
NVIDIA/TensorRT-LLM#21879 ·
Maintainers usually reply within 1 day
All issues in NVIDIA/TensorRT-LLM
Similar issues
-
[Resource]: SpaicelyOpenresource-submission validation-passed
Difficulty 1/5 Under an hour Newbie friendliness 68/100
hesreallyhim/awesome-claude-code#3875 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bvis/aegis-hass#725 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
#1643 unrecoverable split: 1 digest with a 403 — two earlier captures of the same URL are real 200sOpen
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Robin-IA/Congressional-Letters-Dev#1684 ·
Maintainers usually reply within 1 day