[Bug]: trtllm-gen persistent context FMHA hangs on SM103 (B300/GB300): synccheck "Missing wait"
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 5/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- backend, performance
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 15.2k
- Forks
- 3k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 477
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from NVIDIA/TensorRT-LLM
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xPossibly taken @NimaVaziri claimed this today. OpenPytorch
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainers usually reply within 1 day
-
Inference runtime Windows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
NVIDIA/TensorRT-LLM#23394 ·
Maintainers usually reply within 1 day
-
[Bug]: MMLU subsampling changes when evaluators are interleavedPossibly taken @LeNeLeNeWo claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NVIDIA/TensorRT-LLM#23273 ·
Maintainers usually reply within 1 day
-
Trace-replay Pareto window includes the drain when sessions finish out of admission orderPossibly taken @sbeierle claimed this 3 days ago. OpenTesting
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
NVIDIA/TensorRT-LLM#23077 ·
Maintainers usually reply within 1 day
-
LongBench V2 blog command breaks on inline comments after continuationsPossibly taken @ddlw claimed this 25 days ago. OpenDoc
Difficulty 1/5 Under an hour Newbie friendliness 91/100
NVIDIA/TensorRT-LLM#21879 ·
Maintainers usually reply within 1 day
All issues in NVIDIA/TensorRT-LLM
Similar issues
-
[Resource]: SpaicelyOpenresource-submission validation-passed
Difficulty 1/5 Under an hour Newbie friendliness 68/100
hesreallyhim/awesome-claude-code#3875 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bvis/aegis-hass#725 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
#1643 unrecoverable split: 1 digest with a 403 — two earlier captures of the same URL are real 200sOpen
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Robin-IA/Congressional-Letters-Dev#1684 ·
Maintainers usually reply within 1 day