Parallelize unfinished beam finalization across beams
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.7k
- Forks
- 2.8k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 489
Description
Motivation
insertUnfinishedPathKernel launches a single CUDA thread and serially reconstructs every unfinished beam. At larger beam widths this creates a long serial tail during beam-search finalization, although reconstruction of distinct beams is independent.
Proposed change
Launch a 128-thread block, assign beams to threads, read the destination offset once through shared memory, synchronize, and update numBeamsCBA once after all beams are copied. Token reconstruction within each beam remains serial and preserves the current generated-suffix semantics.
Direct-kernel evidence
On an uncontended H100 (SM90, CUDA 13.0), beam width 80, generated length 5, nine repeats of 20,000 CUDA-event-timed launches after 1,000 warmups:
- current kernel median: 64.399017 us/call
- proposed kernel median: 5.086699 us/call
- delta: -92.1% (12.66x kernel speedup)
The baseline and candidate implementations were compiled into the same binary and their output buffers were compared before timing. This is isolated kernel evidence, not a claim of equal end-to-end request speedup.
Contributor 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.
Research direction
Start at insertUnfinishedPathKernel and trace the beam-finalization call path. Preserve serial token reconstruction and generated-suffix semantics while assigning independent beams to threads, then verify completion by comparing the current and candidate output buffers and checking the final beam count update.
Written by the indexing model from the issue text.
Assessment
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100