Feature: k2_horizon_uno decode is about 20% slower than needed (no CUDA graph; LoRA branch computed on rows whose mask is 0)

Aperta
#2,054 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp, python, pytorch

Direzione di ricerca

Read families/k2_horizon_uno/README.md, especially section 7, then trace the Uno native runtime and engine profiles used by the k2-horizon-7b-uno manifest in linear_spec_lora mode. Investigate CUDA graph replay for each supported row count and how prompt and verify calls can use an engine without LoRA. Done means both changes are measured against the reported bf16 baselines and decoding behavior is checked for regressions.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Request type: Improvement to existing behavior

Problem and use case

families/k2_horizon_uno runs speculative decoding with one dynamic engine that takes 1 to 8 rows per call and a per-row LoRA mask (draft rows mask 1; prompt and verify rows mask 0). Two costs on main, found during the FP8 study recorded in families/k2_horizon_uno/README.md (#2039, section 7):

  1. The Uno native runtime never enables CUDA graphs. A bf16 8-row call launches about 830 kernels; the host loop spends about 6 ms per 8-row call against 5.3 to 5.7 ms when the same call is replayed as a CUDA graph.
  2. The LoRA branch is computed for every row of every call, including prompt and verify calls whose mask is all 0. The branch (rank 128 on all 7 projections, in bf16) is 19% to 23% of a call: the bf16 engine without the branch is 1.21x to 1.24x faster.

Both are larger than what FP8 gives on this family (FP8 was measured and not shipped, see the README).

Proposed outcome

  1. Replay the decode calls as CUDA graphs in the Uno native runtime (per row count used).
  2. Skip the LoRA branch when the mask of a call is all 0, for example with a second engine profile (or engine) without LoRA for prompt and verify calls.

Model and target details

IFM/K2-Horizon-7B-Uno @ ec92bbd768f4a404319625204544782e3377bcd7 (the k2-horizon-7b-uno manifest, linear_spec_lora mode) on the K2-Horizon-7B base; bf16; TensorRT 11.4; B200 / B300; max_sequence_length 1024.

Alternatives considered

FP8 of the base projections (measured, not shipped): the 8-row call is 0.96x (B200) and 0.88x (B300) of bf16 without a CUDA graph, because the bf16 LoRA branch and the kernel count stay.

Additional context

The same study found that speculative decode equals the engine's own greedy autoregressive output on 13 of 14 prompts only (bf16): 8-row and 1-row calls differ in the last bits, which changes the argmax at near ties.

Lingua principale
Python
Stelle
288
Fork
73
Merge medio
1g 3h
PR unite (30g)
273

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA/TensorRT-Model-Connect

Tutte le issue di NVIDIA/TensorRT-Model-Connect

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.