[CUDA] Fix beam search of num_beams > 32 #23599
Merged
+35
−15
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
ORT_BEAM_SEARCH_USE_FAST_TOPK
to enable/disable fast topk path.Motivation and Context
This bug was introduced in #16272
Beam search uses fast cuda kernel when number of beams <= 32. When beam size is larger than that threshold, we use another code path (slower cuda kernel) to get topk. In such
slow topk path
, topk_scores shall be passed to beam scorer but it is not.This bug will cause incorrect result when num_beams > 32. It was not found previously since such large beam size is rarely used.