NVIDIA / NVIDIA/TensorRT-LLM

Parallelize unfinished beam finalization across beams

Open
#17,928 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Customized kernels
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.