Repository navigation
feat(inference): support request-local sampling seeds - #7828
Conversation
Signed-off-by: wdykas <wdykas@nvidia.com>
|
/review model=claude |
|
/review |
|
this has a scalability problem I need to figure out |
Replace per-request CUDA generator reseeding and exponential launches with a batched Philox kernel keyed by request seed, absolute token position, and vocabulary index. Preserve the CPU fallback and unseeded shared-generator behavior. Document the seeded CUDA stream change, cover replay across batch layouts and launch tiling under contention, and add a reproducible sampler benchmark. Validated with 333 focused tests on GB200. Signed-off-by: wdykas <wdykas@nvidia.com>
Keep the PR focused on production request-local sampling and necessary regression coverage. Remove the ad hoc benchmark, duplicate CUDA replay wrapper, and sampler position-override test already covered by the async-controller regression. Retain the required kernel determinism and distribution checks. Validated with 331 focused tests and formatting, lint, and kernel coverage checks. Signed-off-by: wdykas <wdykas@nvidia.com>
|
/ok to test f2bb8b7 |
Signed-off-by: wdykas <wdykas@nvidia.com>
Signed-off-by: wdykas <wdykas@nvidia.com>
|
/ok to test cdd420a |
|
|
||
|
|
||
| @triton.jit(do_not_specialize=["Seeds", "Positions"]) | ||
| def _request_seed_noise_kernel( |
There was a problem hiding this comment.
needed for perf. the naive way takes forever
|
/ok to test ca4e67c |
Signed-off-by: wdykas <wdykas@nvidia.com>
|
/ok to test e5a35e3 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/38096793901 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/38100823807 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/38145549091 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/38161303560 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/38165752174 |
torch_sampling.py is registered under the request-seed sampling kernel since NVIDIA#7828, so changes to it must update that kernel's determinism test. Replay an all-greedy batch with request seeds under side-stream contention, and check that it returns per-row argmax without advancing the shared RNG. Also update the sample_kernel docstring, which still described no_top_k/no_top_p as ignored. Signed-off-by: Waterpine <biansonghz@gmail.com>
What does this PR do?
Add optional request-local sampling seeds to dynamic Torch inference and both OpenAI-compatible completion endpoints. With a shared generator, moving a request between batches changes its draws even when its logits are unchanged. Explicit
seedassigns each draw by request seed and absolute token position, independently of request IDs, batch slots, or other requests' RNG consumption.iseed(seed + i) % 2**63, including streaming submissions.Issue tracking
Closes #7827