[https://nvbugs/6618100][fix] Move the layout marker onto SampleStateTensorsHostTorch (the object actually… - #17826
Conversation
…e PP hand-off The stable-greedy fast path in _process_requests returns a compact 1-D new_tokens_host of shape (num_requests,) rather than the usual [step, slot, beam], and flagged that layout only on the outer SampleStateTorch. Pipeline parallelism transfers just sample_state.host around the ring, so non-final ranks rebuilt the state object with single_step_greedy defaulted to False and indexed the flat buffer as 3-D, raising "TypeError: 'int' object is not subscriptable" once per non-final PP stage and aborting the executor. Move the marker onto SampleStateTensorsHostTorch -- the object actually transferred -- so the buffer is self-describing and send/recv stay symmetric with no wire-format change, and dispatch on either copy. Also return the greedy branch's result directly in sampler_strategy.sample() instead of assigning temperature = None, which mypy rejects as incompatible with the float bound by the surrounding capture patterns. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan includes up to 12 reviews per rolling hour; 11 remain after this review. WalkthroughThe sampler moves ChangesGreedy state alignment
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The PR makes a localized state-layout fix and does not introduce an actionable merge-blocking risk; it is merge-ready after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Dup of #17828, close this PR. |
Summary
new_tokens_hostwas marked only on the outerSampleStateTorch, but PP transfers onlysample_state.host, so non-final ranks rebuilt the state withsingle_step_greedy=Falseand indexed the flat buffer as 3-D[step][slot][beam].SampleStateTensorsHostTorch(the object actually transferred) so the buffer is self-describing and send/recv stay symmetric with no wire-format change, and dispatch on either copy; plus an early return in the greedy branch ofsampler_strategy.sample()that clears the blocking pre-existing mypy error under both the CI pin and the ambient tool.pytest tests/unittest/llmapi/test_llm_multi_gpu_pytorch.py::test_tinyllama_logits_processor_tp2pp2 -vTest plan
Links
Dev Engineer Review
single_step_greedyfromSampleStateTorchtoSampleStateTensorsHostTorch.QA Engineer Review
single_step_greedyfromSampleStateTensorsHostTorch.tests/integration/test_lists/is not provided.test_tinyllama_logits_processor_tp2pp2.