[Bug] GVR V2 top-k: rows with more than k copies of +inf come back unwritten (32-bit wrap in the key-space narrowing)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 40/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- machine-learning
Direzione di ricerca
The bug is in the key-space narrowing of GvrMainKernel.kern (around line 7049) and GvrClusKernel._body (around line 18796) in tensorrt_llm/_torch/kernels/blackwell/top_k/gvr_topk_decode_self_sampling_host.py, where rhi can wrap past 0xFFFFFFFF. Run the repro from the issue on a B200 first; it should print 0 unwritten rows and 0 out-of-range indices for every case. The issue proposes a saturation fix at both sites, which you can check against the repro and the existing top-k tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[by Claude Code]
Summary. run_varlen in tensorrt_llm/_torch/kernels/blackwell/top_k/gvr_topk_decode_self_sampling_host.py
(main at 2bbe88067c50) leaves whole output rows unwritten, or writes indices outside the row, when a row holds more
than k copies of +inf (or of finite scores above 2^127) next to a few finite scores. Seen on B200 on the one-CTA
slabs (K = 512, 1024, 2048), the SPLIT slab and the clus engine.
Repro (B200; ~1 minute including compiles):
import torch
from tensorrt_llm._torch.kernels.blackwell.top_k import gvr_topk_decode_self_sampling_host as gvr
for k, rows, width in [(512, 148, 130944), (2048, 64, 65536)]:
for value in (float("inf"), 3.1e38):
torch.manual_seed(0)
lens = [k + 2, 3 * k // 2 + 1, 3 * k // 2 + 7, 2 * k - 1, 2 * k + 1]
n_r = [lens[r % len(lens)] for r in range(rows)]
x = torch.randn(rows, width, device="cuda")
for r, n in enumerate(n_r):
x[r, torch.randperm(n, device="cuda")[: n - 4]] = value # n - 4 flood copies, 4 finite scores
out = torch.full((rows, k), -7, dtype=torch.int32, device="cuda")
seq = torch.tensor(n_r, dtype=torch.int32, device="cuda")
gvr.run_varlen(x, seq, out, max_seq_len=width)
torch.cuda.synchronize()
o = out.to(torch.int64)
unwritten = (o == -7).any(1)
outside = ((o < 0) | (o >= seq.unsqueeze(1))).any(1) & ~unwritten
print(f"k={k} value={value}: {int(unwritten.sum())} rows unwritten, {int(outside.sum())} with an index "
f"outside the row (expected 0, 0)")
Output on B200 at 2bbe88067c50:
k=512 value=inf: 62 rows unwritten, 0 with an index outside the row (expected 0, 0)
k=512 value=3.1e+38: 46 rows unwritten, 0 with an index outside the row (expected 0, 0)
k=2048 value=inf: 0 rows unwritten, 23 with an index outside the row (expected 0, 0)
k=2048 value=3.1e+38: 0 rows unwritten, 14 with an index outside the row (expected 0, 0)
Cause. In the crossing refine's key-space narrowing (GvrMainKernel.kern, e.g. line 7049, and
GvrClusKernel._body, e.g. line 18796), rhi = nlo + ((1 << sh2u) - 1) is not saturated. The range starts at the
least staged key, so the bin holding the flood's keys can end past 0xFFFFFFFF; rhi wraps below rlo, the descent
stops under the crossing keys, and nothing is emitted for the row.
Fix (as applied in FlashInfer's port, flashinfer-ai/flashinfer#7104): saturate after the update,
rhi = nlo + ((cutlass.Uint32(1) << sh2u) - cutlass.Uint32(1))
if cutlass.Uint32(rhi) < nlo:
rhi = cutlass.Uint32(0xFFFFFFFF)
at both sites. It cost nothing measurable there (B200: 1.000x warm, 1.001x cold).
Note (speed only). The register family's bracket arms fold +-inf into the bracket min / max, so a row holding a
single +inf (DeepSeek-V4.1's block top-k sets each row's newest block score to +inf) gets an infinite bracket and
takes the key-space escape. FlashInfer #7104 folds only finite scores (fabs(x) != inf) and sends the two crossings
the histogram then cannot rank to the escape; on B200 that took V4.1 block rows (K = 2048, 4,101 keys) from 7.5-7.7 us
to 3.8-3.9 us.
- Lingua principale
- Python
- Stelle
- 15.2k
- Fork
- 3k
- Merge medio
- 2g 21h
- PR unite (30g)
- 477
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/TensorRT-LLM
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xForse già presa @NimaVaziri l’ha presa oggi. ApertaPytorch
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NVIDIA/TensorRT-LLM#23406 ·
I maintainer di solito rispondono entro 1 giorno
-
Inference runtime Windows
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
NVIDIA/TensorRT-LLM#23394 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: MMLU subsampling changes when evaluators are interleavedForse già presa @LeNeLeNeWo l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NVIDIA/TensorRT-LLM#23273 ·
I maintainer di solito rispondono entro 1 giorno
-
Trace-replay Pareto window includes the drain when sessions finish out of admission orderForse già presa @sbeierle l’ha presa 3 giorni fa. ApertaTesting
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
NVIDIA/TensorRT-LLM#23077 ·
I maintainer di solito rispondono entro 1 giorno
-
LongBench V2 blog command breaks on inline comments after continuationsForse già presa @ddlw l’ha presa 25 giorni fa. ApertaDoc
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
NVIDIA/TensorRT-LLM#21879 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di NVIDIA/TensorRT-LLM
Issue simili
-
[Resource]: SpaicelyApertaresource-submission validation-passed
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
hesreallyhim/awesome-claude-code#3875 · 1 commento ·
-
[Bug]: Ajax Pro login issueApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
bvis/aegis-hass#725 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
#1643 unrecoverable split: 1 digest with a 403 — two earlier captures of the same URL are real 200sAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
Robin-IA/Congressional-Letters-Dev#1684 ·
I maintainer di solito rispondono entro 1 giorno