[Bug]: trtllm-gen persistent context FMHA hangs on SM103 (B300/GB300): synccheck "Missing wait"
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
- 5/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Ambito
- backend, performance
Direzione di ricerca
The path is FmhaDispatcher → TileScheduler::Persistent → fmhaSm103aKernel_…PersistentContext; reproduce with the supplied repro_issue.py under compute-sanitizer --tool synccheck, comparing max_num_tokens=256 and 16384. Compare the SM103 persistent context cubin SASS with the SM100a build, which waits on every iteration. The payload says the fix is in generated cubins, not this repository; done means regenerated SM103 context cubins where softmax WG1 waits on its ping-pong barrier on the last KV iteration, with a clean synccheck run.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
System Info
- GPU: NVIDIA B300 SXM6 AC (sm_103, 148 SMs), driver 580.126.20
- CPU: x86_64; OS: Ubuntu 24.04.4 LTS
- Container:
nvcr.io/nvidia/tensorrt-llm/release:1.3.0(TensorRT-LLM 1.3.0, torch 2.14.0a0+nv26.09) - compute-sanitizer 2026.1.1
- Also present in the cubins on
main@d7d81834c8ad(see additional notes)
Who can help?
@laikhtewari @kaiyux
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examplesfolder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
On SM103 the context attention path (FmhaDispatcher, which always uses TileScheduler::Persistent) launches fmhaSm103aKernel_…PersistentContext. Under compute-sanitizer --tool synccheck, this kernel reports Barrier error detected. Missing wait. as soon as a CTA has to process more than one tile, and the launch then fails.
The script builds a tiny random-weight Llama locally and starts LLM. The executor warmup runs a context-only forward of up to max_num_tokens tokens. max_num_tokens=16384 gives a context grid much larger than the 148 SMs, so CTAs take several tiles. max_num_tokens=256 (a single 256-token q-tile per head) is the control.
# repro_issue.py
# compute-sanitizer --tool synccheck --kernel-name kns=Sm103aKernel python3 repro_issue.py {256|16384}
import os, sys, tempfile
import torch
from transformers import LlamaConfig, LlamaForCausalLM
from tensorrt_llm import LLM, SamplingParams
from tensorrt_llm.llmapi import KvCacheConfig
def main():
max_num_tokens = int(sys.argv[1]) # the executor warmup runs a context-only batch of this many tokens
# Tiny random-weight Llama (bf16, 1 layer, 8 q / 2 kv heads, head_dim 128); nothing is downloaded.
path = os.path.join(tempfile.gettempdir(), "tiny-llama-h128")
if not os.path.exists(os.path.join(path, "config.json")):
torch.manual_seed(0)
cfg = LlamaConfig(hidden_size=1024, intermediate_size=1024, num_hidden_layers=1, num_attention_heads=8,
num_key_value_heads=2, head_dim=128, vocab_size=1024, max_position_embeddings=32768)
LlamaForCausalLM(cfg).to(torch.bfloat16).save_pretrained(path)
llm = LLM(model=path, skip_tokenizer_init=True, max_num_tokens=max_num_tokens, max_seq_len=16384,
max_batch_size=1, cuda_graph_config=None, kv_cache_config=KvCacheConfig(free_gpu_memory_fraction=0.1))
out = llm.generate([list(range(1, 201))], SamplingParams(max_tokens=1, detokenize=False, end_id=2, pad_id=2))
print("ok, generated", out[0].outputs[0].token_ids)
llm.shutdown()
if __name__ == "__main__": # required: the LLM API spawns MPI workers that re-import this file
main()
docker run --rm --gpus '"device=0"' --ipc=host -v $PWD:/w -w /w nvcr.io/nvidia/tensorrt-llm/release:1.3.0 \
compute-sanitizer --tool synccheck --kernel-name kns=Sm103aKernel python3 repro_issue.py 16384
Output (16384):
========= Barrier error detected. Missing wait.
========= at fmhaSm103aKernel_QkvBfloat16OBfloat16H128PagedKvCausalP32VarSeqQ256Kv128PersistentContext+0xc350
========= by thread (32,0,0) in block (0,1,0)
========= Barrier is located at shared address 0x288a0
========= Host Frame: tensorrt_llm::_v1::kernels::TllmGenFmhaKernel::run(...) in libtensorrt_llm.so
========= Host Frame: tensorrt_llm::_v1::kernels::FmhaDispatcher::run(...) in libtensorrt_llm.so
========= Host Frame: tensorrt_llm::_v1::common::op::AttentionOp::enqueueContext<__nv_bfloat16, ...KVBlockArray>(...) in libtensorrt_llm.so
========= ... (model_engine.py warmup)
...
[TRT-LLM] [E] [executor] Failed to initialize executor on rank 0: CUDA error: unspecified launch failure
========= ERROR SUMMARY: 1152 errors
max_num_tokens (warmup batch) |
tiles per CTA | synccheck | result |
|---|---|---|---|
| 256 | 1 | 0 errors | completes |
| 16384 | > 1 | 1,152 Missing wait | unspecified launch failure, executor init fails |
Expected behavior
synccheck reports 0 errors and the context kernel always completes, regardless of how many tiles each CTA processes.
actual behavior
- Under the sanitizer: whenever a CTA processes more than one tile, the kernel reports
Missing waiton a softmax mbarrier and the launch fails. - Without the sanitizer: the same kernel family hangs forever under serving load.
- We hit this in vLLM with FlashInfer, which ships the same trtllm-gen FMHA kernels.
- The GPU shows 100 % util, SM_ACTIVE ≈ 0.01 and DRAM 0, with no Xid.
- Switching to the static tile scheduler removed both the sanitizer errors and the hangs.
- We have not run TensorRT-LLM under serving load, so we have not seen the hang in TensorRT-LLM itself.
additional notes
Likely cause (SASS). The two softmax warpgroups alternate on a pair of ping-pong mbarriers: each waits on its own barrier and then arrives on the other's. In the SM103 persistent context cubins, warpgroup 1 skips its own wait on the last KV iteration of a tile:
PLOP3.LUT P0, PT, PT, PT, UP2, 0x80, 0x8 // P0 = last KV iteration of the tile
ISETP.GT.U32.AND P1, PT, R34, 0x3, PT // P1 = warp > 3 (softmax WG1)
@P0 BRA P1, <after wait> // WG1 on the last iteration: skip the wait
SYNCS.PHASECHK.TRANS64.TRYWAIT P0, [UR20], R36 // own ping-pong barrier
- One tile per CTA: harmless, because WG1 exits.
- Persistent CTA: WG1 starts the next tile and arrives on WG0's barrier again before the previous phase was waited on. This is the reported
Missing wait. If it gets two phases ahead, a parity wait may never return, which matches the hang. (This hang mechanism is inferred; we have not observed it directly.)
The SM100a builds of the same kernels have no such branch: both warpgroups wait on every iteration.
Workaround. FlashInfer selects TileScheduler::Static for SM103 context (flashinfer-ai/flashinfer#9702, merged; ragged path in a follow-up PR):
- outputs are bit-identical to Persistent;
- synccheck is clean;
- kernel latency changes by +0.2 to +0.6 % geomean over 10 shapes, and long-KV batches are about 1 % faster.
Requests
The root cause is in the generated cubins, which cannot be fixed from this repository. So:
- Could you fix this trtllm-gen persistent context FMHA kernel?
- Or could you forward this to the trtllm-gen FMHA kernel team? The fix would be for softmax WG1 to also wait on its ping-pong barrier on the last KV iteration when the tile scheduler is persistent, followed by regenerated SM103 context cubins.
thank you in advance 😄
Related: flashinfer-ai/flashinfer#9700, flashinfer-ai/flashinfer#9728, flashinfer-ai/flashinfer#9702.
Before submitting a new issue...
- Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.
- 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