[https://nvbugs/6242591][fix] Fix bugs in Beam Search kernels#15621
Draft
wili-65535 wants to merge 1 commit into
Draft
[https://nvbugs/6242591][fix] Fix bugs in Beam Search kernels#15621wili-65535 wants to merge 1 commit into
wili-65535 wants to merge 1 commit into
Conversation
3a5b534 to
6ae77a8
Compare
Collaborator
Author
|
/bot run --disable-fail-fast |
Collaborator
|
PR_Github #55813 [ run ] triggered by Bot. Commit: |
Collaborator
|
PR_Github #55813 [ run ] completed with state
|
6ae77a8 to
73131cd
Compare
Signed-off-by: wili-65535 <12345678+wili@users.noreply.github.com>
73131cd to
d1af560
Compare
Collaborator
Author
|
/bot run --disable-fail-fast |
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.
Description
Fix bugs in the beam search V2 path with
beam_width >= 9andbeam_search_diversity_rate > 0.Root cause:
addCumLogProbscompares a candidate-slot indexi(range0..nBMIn*nBMOut*2-1) against a vocabulary token ID (endIds[slot]) for the EOS forcing condition on finished beams. The comparison is always false, so those candidates receive inflated scores, rank into the top-nBM every step, and continuously incrementnumBeamsCBA.== nBMinstead of>= nBM, so oncenumBeamsCBAexceedsnBMthe guard never triggers, leading to unbounded out-of-bounds writes into the CBA output buffer and eventual SIGSEGV.ias the parent beam index instead of(topId / nV) % nBM, producing wrong scores in the CBA.nBeamForNextStep < nBMOut), the state-update block reads uninitializedoutputIdsPtrslots, corruptingparentIdsPtr/outputIdsPtr/sequenceLengthsand the traceback chain.Changed Files
cpp/tensorrt_llm/kernels/beamSearchKernels.hpStage1Idsparameter to bothaddCumLogProbsoverloadscpp/tensorrt_llm/kernels/beamSearchKernels.cupStage1Idsfor EOS token lookup on finished beamscpp/tensorrt_llm/kernels/beamSearchKernels/beamSearchKernelsTemplate.h== nBMinto>= nBM; UseparentBeamin EOS scoringTest Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.