Repository navigation
[Fix] Don't free the multi-CTAs KV counter the decode graphs captured - #39175
Conversation
|
/rerun-test test/registered/kernel/attention/test_dsa_multi_ctas_counter.py test/registered/e2e/models/test_glm53_flash_b200.py test/registered/e2e/models/test_dsa_glm52_nvfp4_tp_mtp.py |
|
Results for 🚀 🚀 |
|
Results for 🚀 🚀 |
kpham-sgl
left a comment
There was a problem hiding this comment.
Can you remove the AI gen comments / docstrings
|
/rerun-test test/registered/kernel/attention/test_dsa_multi_ctas_counter.py test/registered/attention/unittests/dsa/test_dsa.py test/registered/e2e/models/test_glm53_flash_b200.py test/registered/e2e/models/test_dsa_glm52_nvfp4_tp_mtp.py test/registered/e2e/models/test_dsa_glm52_nvfp4_dp_mtp.py test/registered/e2e/models/test_dsa_glm52_pd_mtp_cp_layersplit.py test/registered/gb300/test_glm52_nvfp4.py test/registered/ep/test_flashinfer_a2a.py test/registered/e2e/models_large/test_glm52_fp8.py test/registered/e2e/models/test_glm53_flash_h200.py test/registered/e2e/models/test_dsa_glm52_tp_mtp.py test/registered/e2e/models/test_dsa_glm52_dp_mtp.py test/registered/e2e/models_large/test_deepseek_v32_indexcache.py test/registered/cp/test_dsa_prefill_cp.py test/registered/e2e/models/test_dsa_glm52_hisparse.py |
|
Resolves the rename conflict from #39966 by moving the new test to test/registered/kernels/ops/attention/. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
/rerun-test test/registered/kernels/ops/attention/test_dsa_multi_ctas_counter.py test/registered/attention/unittests/dsa/test_dsa.py test/registered/e2e/models/test_glm53_flash_b200.py test/registered/e2e/models/test_dsa_glm52_nvfp4_tp_mtp.py test/registered/e2e/models/test_dsa_glm52_nvfp4_dp_mtp.py test/registered/e2e/models/test_dsa_glm52_pd_mtp_cp_layersplit.py test/registered/gb300/test_glm52_nvfp4.py test/registered/ep/test_flashinfer_a2a.py test/registered/e2e/models_large/test_glm52_fp8.py test/registered/e2e/models/test_glm53_flash_h200.py test/registered/e2e/models/test_dsa_glm52_tp_mtp.py test/registered/e2e/models/test_dsa_glm52_dp_mtp.py test/registered/e2e/models_large/test_deepseek_v32_indexcache.py test/registered/cp/test_dsa_prefill_cp.py test/registered/e2e/models/test_dsa_glm52_hisparse.py |
|
Results for 🚀 🚀 🚀 🚀 🚀 🚀 |
Actually intended since this bug was easy to miss (query rows, not requests), but trimmed them |
Motivation
DeepseekSparseAttnBackend._forward_trtllmrebound the counter buffer:grow_..._if_neededreturns a newtorch.zeroswhen it grows, so the assignment frees the buffer the decode CUDA graphs captured. Later replays write through a dangling pointer.batch_sizeispage_table_1.shape[0]— query rows, not requests — so a prefill batch trips it, not decode. Reasoning in decode batch sizes (max_running_requests x draft_tokens) makesTRTLLM_MLA_MAX_BATCH_SIZE=8192look unreachable, which is why it hid.Stock main, default flags, GLM-5.3-Flash tp4 / 4x GB300, 8192 in / 1024 out, temporary logging on all 4 ranks:
Last capture ended 22 s before the first grow. Latent, not benign: a probe right after the grow did not land on the freed block, so today the stale writes hit memory nothing owns. Perturb the allocation pattern and it becomes a reproducible illegal access inside
fmhaSm100fKernel...DynamicTokenSparse, the kernel that consumes the counter.Modifications
_multi_ctas_kv_counter_for_ensure_multi_ctas_kv_counter_capacityinit_cuda_graph_statesizes formax(max_bs, max_num_tokens)before any capture; grow-only= Noneinit_cuda_graph_statesizes it for every backend, but only the TRT-LLM branch allocates oneCapture-time growth is then unreachable, and the assert guarding it is an invariant check rather than a live path.
Accuracy Tests
Not applicable — buffer lifetime only, no numerics touched.
Benchmarking and Profiling
GLM-5.3-Flash tp4 / 4x GB300, 8192 in / 1024 out, 3 runs each, same build:
TTFT is the number at risk (the oversized path now allocates per call across 11 DSA layers), so it was measured rather than assumed. All inside noise.
Checklist
test/registered/kernel/attention/test_dsa_multi_ctas_counter.py, 7 cases2 / 1 / 1failures,7passed unmutatedcheck_registered_tests.pyandgit diff --checkexit 0CI States
Latest PR Test (Base): ❌ Run #35569781506
Latest PR Test (Extra): ❌ Run #35569781243
Latest PR Test (AMD ROCm 10): ❌ Run #35569781574