Repository navigation
[None][perf] Precompile PrimTS sparse MLA in decoder warmup and reuse decode views - #22274
Conversation
Vendor validation:
|
Vendor validation:
|
Vendor validation:
|
Vendor validation:
|
Vendor validation:
|
9d8394d to
562d15e
Compare
|
/bot run --disable-fail-fast |
Vendor validation:
|
|
PR_Github #85822 [ run ] triggered by Bot. Commit: |
Vendor validation:
|
|
PR_Github #85822 [ run ] completed with state
|
Vendor validation:
|
Vendor validation:
|
562d15e to
632b0b9
Compare
Vendor validation:
|
|
/bot run --disable-fail-fast |
|
PR_Github #85959 [ run ] triggered by Bot. Commit: |
|
PR_Github #85959 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #86073 [ run ] triggered by Bot. Commit: |
|
PR_Github #86073 [ run ] completed with state
|
Start a fresh per-rank process pool on the first eligible decoder warmup. Load the vendored kernels under their canonical module names so workers share the serving cache without initializing TensorRT-LLM or MPI. Join the pool before KV-cache sizing and prepare subsequent plans locally. Signed-off-by: Yuxian Qiu <[email protected]>
Check the on-disk export of each distinct sparse MLA specialization during the first eligible warmup. Dispatch only misses that can compile in parallel, and load all plans on the serving rank. Signed-off-by: Yuxian Qiu <[email protected]>
Determine worker dispatch from the current specialization inventory on every eligible pass. This also lets a later warmup compile newly required variants in parallel. Signed-off-by: Yuxian Qiu <[email protected]>
Signed-off-by: Yuxian Qiu <[email protected]>
Signed-off-by: Yuxian Qiu <[email protected]>
…er runtime Signed-off-by: Yuxian Qiu <[email protected]>
…fixes Signed-off-by: Yuxian Qiu <[email protected]>
Signed-off-by: Yuxian Qiu <[email protected]>
…contracts Signed-off-by: Yuxian Qiu <[email protected]>
Signed-off-by: Yuxian Qiu <[email protected]>
…rmup Signed-off-by: Yuxian Qiu <[email protected]>
Signed-off-by: Yuxian Qiu <[email protected]>
Signed-off-by: Yuxian Qiu <[email protected]>
Signed-off-by: Yuxian Qiu <[email protected]>
…sabled Signed-off-by: Yuxian Qiu <[email protected]>
Vendor validation:
|
…ations Signed-off-by: Yuxian Qiu <[email protected]>
Signed-off-by: Yuxian Qiu <[email protected]>
0bd35f8 to
dbf148f
Compare
|
/bot run --disable-fail-fast |
Vendor validation:
|
|
PR_Github #86865 [ run ] triggered by Bot. Commit: |
|
PR_Github #86865 [ run ] completed with state |
----- BEGIN VENDOR PROMOTION V1 -----
{
"attribution": {
"46f062fd522eb0306050905bd9c209c9827cd01f": {
"method": "same-edits",
"upstream_base": "b8ef7f2312fd80d719ee2c62184cd936de0f0161",
"upstream_head": "32922a2d93b78d5f447a5899906011fd245abbcd"
},
"4c8cbed57690b325a1d9b7b062f56ab4667ae420": {
"method": "outside-vendor-scope",
"refresh_policy": "retain"
},
"8411b090e4ef93e25373643a42a47049212241b0": {
"method": "outside-vendor-scope",
"refresh_policy": "retain"
},
"a25e87e0350bc7334d400c5d9b2993ef6ecbaa76": {
"method": "same-edits",
"upstream_base": "db2373490172a31dbbdc489ef82fe174e6d88f06",
"upstream_head": "a2ba1d5c16954460f05857db63a10c3f5c028d5a"
},
"a49f1bcbb3bd20fc3d951cfedde06359be989d3c": {
"method": "same-edits",
"upstream_base": "7eae60fb4f9ee437df67ba9891f7b6691a12fee0",
"upstream_head": "654211d0d884935d15c50287483e9da371a7726e"
},
"a6c6a379df3807413e90dccfa3bde548361a27f5": {
"method": "same-edits",
"upstream_base": "db2373490172a31dbbdc489ef82fe174e6d88f06",
"upstream_head": "a2ba1d5c16954460f05857db63a10c3f5c028d5a"
},
"b4a09ed0dd46631784d286781c074bb24bc8f332": {
"method": "same-edits",
"upstream_base": "db2373490172a31dbbdc489ef82fe174e6d88f06",
"upstream_head": "a2ba1d5c16954460f05857db63a10c3f5c028d5a"
},
"c6a60294d9c594a8ac941189d905c88c87fc1aca": {
"method": "same-edits",
"upstream_base": "db2373490172a31dbbdc489ef82fe174e6d88f06",
"upstream_head": "a2ba1d5c16954460f05857db63a10c3f5c028d5a"
},
"d81912f0b125722e40ea4a4e66cd6fc71aee2614": {
"method": "same-edits",
"upstream_base": "db2373490172a31dbbdc489ef82fe174e6d88f06",
"upstream_head": "a2ba1d5c16954460f05857db63a10c3f5c028d5a"
},
"f601f0b683d25fdfd341547e51726be53607496f": {
"method": "same-edits",
"upstream_base": "db2373490172a31dbbdc489ef82fe174e6d88f06",
"upstream_head": "a2ba1d5c16954460f05857db63a10c3f5c028d5a"
},
"faa2c77be8a00c2be46846601228c0f7417e7ec6": {
"method": "same-edits",
"upstream_base": "b966a5b24c6c942247000abd335c9a3cff83db6a",
"upstream_head": "5880ee354be10310b589865e92f91987bfb65167"
},
"fddc8c0d75b46049bd49b48ec81cdbc2a36d33f8": {
"method": "same-edits",
"upstream_base": "b966a5b24c6c942247000abd335c9a3cff83db6a",
"upstream_head": "5880ee354be10310b589865e92f91987bfb65167"
}
},
"attribution_scope": {
"include": [
"**/*.py"
],
"source": "flashinfer/attention/prims_ts"
},
"canonical_branch": "trtllm-prims-ts-dev-20261107",
"canonical_url": "https://github.com/yuxianq/flashinfer.git",
"changes": [
{
"commits": [
"4c8cbed57690b325a1d9b7b062f56ab4667ae420",
"8411b090e4ef93e25373643a42a47049212241b0"
],
"refresh_policy": "retain",
"unpaired_reason": "No changes to files selected by the vendor lock source/include. No whole-commit upstream equivalence is claimed.",
"upstream_base": null,
"upstream_head": null,
"upstream_merge": null,
"upstream_pr": null
},
{
"commits": [
"46f062fd522eb0306050905bd9c209c9827cd01f"
],
"upstream_base": "b8ef7f2312fd80d719ee2c62184cd936de0f0161",
"upstream_head": "32922a2d93b78d5f447a5899906011fd245abbcd",
"upstream_merge": "504035ddab474b0b90c8ee48f0347963d4619dc6",
"upstream_pr": "flashinfer-ai/flashinfer#9087"
},
{
"commits": [
"c6a60294d9c594a8ac941189d905c88c87fc1aca",
"a25e87e0350bc7334d400c5d9b2993ef6ecbaa76",
"f601f0b683d25fdfd341547e51726be53607496f",
"a6c6a379df3807413e90dccfa3bde548361a27f5",
"b4a09ed0dd46631784d286781c074bb24bc8f332",
"d81912f0b125722e40ea4a4e66cd6fc71aee2614"
],
"upstream_base": "db2373490172a31dbbdc489ef82fe174e6d88f06",
"upstream_head": "a2ba1d5c16954460f05857db63a10c3f5c028d5a",
"upstream_merge": null,
"upstream_pr": "flashinfer-ai/flashinfer#9395"
},
{
"commits": [
"a49f1bcbb3bd20fc3d951cfedde06359be989d3c"
],
"upstream_base": "7eae60fb4f9ee437df67ba9891f7b6691a12fee0",
"upstream_head": "654211d0d884935d15c50287483e9da371a7726e",
"upstream_merge": "4433ef48d1eabaab82c7cdd33244aabedd810aa8",
"upstream_pr": "flashinfer-ai/flashinfer#9446"
},
{
"commits": [
"faa2c77be8a00c2be46846601228c0f7417e7ec6",
"fddc8c0d75b46049bd49b48ec81cdbc2a36d33f8"
],
"upstream_base": "b966a5b24c6c942247000abd335c9a3cff83db6a",
"upstream_head": "5880ee354be10310b589865e92f91987bfb65167",
"upstream_merge": null,
"upstream_pr": "flashinfer-ai/flashinfer#9767"
}
],
"consumer_base": "main",
"consumer_merge": "7099075c4d2d1ffdef402a9d83d89e10d3f8b0ea",
"consumer_pr": "#22274",
"contributor_metadata": {
"metadata_digest": "3727b5d5e03b7cbc61edfde45ae1f1be7185d601b3648303f5c1a9208883d710",
"pr_author": "yuxianq",
"source_head": "dbf148f14d8851f69cc8e5253218cbec0f45fc3c"
},
"kind": "promotion",
"previous": "69527ce04c4ca765f9f46ff0aa55b50ac776ba29",
"promoted": "d81912f0b125722e40ea4a4e66cd6fc71aee2614",
"source_branch": "cute-dsl-precompile-api--prims-ts-vendor-20261124",
"source_url": "https://github.com/yuxianq/flashinfer.git",
"upstream_base": "911d6a9d62308b6c8a5249e8dc4aabc7518020f1",
"upstream_branch": "main",
"upstream_observed_main": "4d5a6ce322587d247fb192f97a0d23eeba9e3412",
"upstream_repository": "flashinfer-ai/flashinfer",
"vendor": "flashinfer-prims-ts",
"version": 1
}
----- END VENDOR PROMOTION V1 -----
Signed-off-by: Yuxian Qiu <[email protected]>
…9395) <!-- .github/pull_request_template.md --> ## 📌 Description Separate processes can compile different CuTe DSL kernels concurrently. Within a process, CuTe compiler entry is serialized to protect shared compiler options. A per-kernel file lock deduplicates builds, and a module lock protects invalidation and export. Cache hits verify the identity of the published metadata marker across the object read, including on read-only filesystems. Cache-filling workers use `compile_and_persist(force=False)` to reuse a specialization published by another worker while they wait. The default still forces a rebuild. MoE callers that need an executable use `build_and_load()`. If a sibling invalidates an export during a load, the caller can use its retained kernel. A spec that previously exported without an engine can rebuild an executable when JIT is enabled. `BatchSparseMLADecodePagedTSWrapper.plan(compile=False)` resolves the finalized specialization and workspace size, leaves `compiled=None`, and allocates no launch tensors. A caller-provided workspace is still validated. After planning, `is_kernel_cached()` checks the on-disk object and metadata without loading or compiling it. Call `plan()` with its default `compile=True` before `run()`. With the persistent disk cache enabled, cacheable PrimTS MoE GEMMs honor `FLASHINFER_DISABLE_JIT=1`. A warm hit loads normally. A cold miss raises `MissingJITCacheError`, so deployments using that flag must populate the cache first. The MoE autotuner can defer a missing-kernel error until the first forward requiring that tactic. PrimTS attention probes and executable plans share one source digest per process and strict-key setting. Each probe still checks the on-disk object and metadata, so it sees kernels published by other workers. On `2b2da3572`, 176 targeted CPU tests and two B200 tests passed, including a cold wrapper probe, compile and reload. ## 🔍 Related Issues TensorRT-LLM uses these APIs to schedule missing warmup variants. Steady-state sparse tensor-view reuse is tracked separately in #9767. Both PRs target `main` and can be reviewed independently. [TensorRT-LLM integration](NVIDIA/TensorRT-LLM#22274) ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [ ] I have installed the hooks with `pre-commit install`. - [ ] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests On `a2ba1d5c1`, the eight CPU files from the maintainer’s scoped run passed locally on Python 3.10.22 (223 tests). The two changed test files also passed on Python 3.12 (109 tests). The three previously failing cases were reproduced before the fix. The MXFP8 worker test now verifies `compile_and_persist(force=False)`, and the thread-isolation test catches `concurrent.futures.TimeoutError`. On `72c8bbfab`, 164 targeted CPU tests passed, along with the targeted B200 deferred-plan, executable launch, and D576 checks. With JIT disabled, the shared build/load path tries the existing artifact and raises `MissingJITCacheError` on a miss before requesting a build lock. In a fresh unprivileged process on B200, a missing artifact in a read-only CuTe cache produced that error and its cached sibling loaded and ran with bitwise-correct output. On `a1d5a1715`, 110 targeted CPU tests passed. The B200 sparse MLA caller-workspace/eager test and the batch-invariant GEMM shared-object launch test both passed. Cold MoE tactic precompilation on one B200 with CuTe DSL 4.8.0 took a median **20.889 s** on the merge base (`db2373490`) and **20.208 s** on this change. Each revision ran in three fresh processes with empty caches. The BF16 SwiGLU case used 64 tokens, hidden size 1024, intermediate size 512, eight experts and top-2 routing. Four distinct tactic pairs compiled and published eight FC1/FC2 kernels per run. All outputs matched across revisions and passed the PyTorch reference. The measurement covers tactic fan-out, compilation, publication and reload. Input setup, tactic selection and routing are outside the timing. On review-fix head `91225f625`, 106 CPU tests passed covering CuTe cache concurrency, consistent generations, read-only hits, engine-less export, and the batch-invariant JIT cache. The B200 sparse MLA workspace and batch-invariant GEMM shared-object launch tests both passed. All 86 CPU JIT cache tests passed, including concurrent compilation for different kernels and single publication for duplicate requests. The B200 caller-workspace test covered deferred planning, rejection of an uncompiled run, and disk-cache misses and hits. The B200 dense CP graph smoke test passed after the compile-path refactor. Changed-file pre-commit checks passed. - [x] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). - [ ] This PR requires **full-scope** CI, not targeted tests (expensive; justify below). Reason: <!-- e.g. cross-cutting change to shared infrastructure --> Targeted CI paths: `tests/cpu/jit/test_cute_dsl_cache.py` `tests/attention/test_attention_ts_sparse_mla.py` `tests/attention/test_attention_ts_mla_cp.py` ## 🔬 Experimental Track <!-- Only for PRs submitted under the experimental policy (CONTRIBUTING.md → "Experimental APIs and Backends"). Leave this section untouched for normal PRs. --> - [ ] This PR is **experimental**: it adds or changes code under `flashinfer/experimental/` and/or an `@flashinfer_experimental_api`. Tracking issue: # - [ ] The tracking issue names an owner, the reason for the experimental path, and a graduation plan with a target release. - [ ] Core changes are limited to a thin entry point (signature, shared validation, feature-gate check, backend selection, handoff). - [ ] Tests live in `tests/experimental/` and were validated on the intended hardware; a runnable example is included. - [ ] Nothing is registered in `flashinfer/aot.py`, and no experimental backend is reachable from `backend="auto"` without `FLASHINFER_ALLOW_EXPERIMENTAL_AUTO_BACKENDS=1`. (Calling an `@flashinfer_experimental_api` or naming a backend explicitly is itself the opt-in and needs no environment variable.) - [ ] **Test scope declared below.** The experimental CI lane runs exactly these targets, so keep them as narrow as the change allows. <!-- Required for experimental PRs. Replace the commented lines below with your targets. Do not delete the fence or change its `experimental-tests` tag — the experimental-track watcher reads it verbatim to decide which targets to ask CI for. --> ```experimental-tests # One target per line: a directory or a file. (A pytest ::selector is not # supported -- the sharding runner cannot consume one.) Must be under # tests/experimental/ and must exist. Delete these comment lines and add yours, e.g. # # tests/experimental/test_my_backend.py # tests/experimental/my_backend/ # # Declaring the whole tree (tests/experimental/) is allowed but means every # experimental PR pays for every other feature's tests, in every matrix cell. ``` ## Downstream measurements of the combined integration DeepSeek-V4-Flash ran on four B200s with TP4/EP4, attention data parallelism, and 256 input and output tokens. Warmup times below are rank-0 wall time. These historical runs include the TensorRT-LLM worker-pool changes and the combined FlashInfer feature series. They predate this PR split. Each row group compares revisions from the same allocation. | PrimTS cache and comparison | Mode | First warmup | First PrimTS phase | |---|---|---:|---:| | Cold, main-base `c9c07e04` → standalone pool `e9e140d7` | Eager | 418.2 → 195.1 s | Included in attention warmup on main | | Warm, main-base `c9c07e04` → cache check `715858bac0` | Eager | 42.50 → 42.95 s | 5.10 s with the cache check | | Same warm comparison | CUDA graph | 48.00 → 47.30 s | 5.15 s with the cache check | On a cold PrimTS cache, grouping all 12 specializations in one pool saved **223.1 s** in the first warmup (one process per version). In the warm comparison, the earlier standalone pool without the cache check took **20.2 s eager / 20.0 s graph** in its first PrimTS phase on the same node (one reference process per mode). Querying disk membership saved about **15 s** in that phase. Main and the cache-check version each ran in two fresh processes per mode. The final implementation checks the cache again when the executor binds its serving resources. We isolated this change on a separate exclusive four-B200 node with the same FlashInfer code, comparing `715858bac0` against its flag-removal patch, subsequently committed as `3fcfb3f572`. | Final pass, warm disk cache | First-pass-only policy | Check every pass (TRT-LLM) | |---|---:|---:| | Eager PrimTS phase / total final warmup | 0.85 / 5.65 s | 3.15 / 6.45 s | | CUDA-graph PrimTS phase / total final warmup | 2.60 / 16.35 s | 3.55 / 16.65 s | Both versions launched **zero workers** with all 12 exports available and four workers enabled per rank. The additional 12 checks took **1.35 s** in a separate two-pass probe. The full PrimTS phase also includes local planning and rank synchronization. If two new variants first appear on the final pass, the new policy can compile them in parallel. <details> <summary>Steady-state time per output token</summary> | Execution | Main-base → cache check, ms/token | First-pass-only → every pass, ms/token | |---|---:|---:| | Eager C8 | 116.728 → 117.878 | 113.246 → 113.072 | | Eager C128 | 121.362 → 121.814 | 117.265 → 117.218 | | CUDA graph C8 | 7.755 → 7.842 | 7.346 → 7.345 | | CUDA graph C128 | 11.913 → 12.454 | 11.685 → 11.697 | Columns are separate experiments. Each used before/after/after/before process order, two warmup batches and three measured batches per concurrency in each process. In the main-base comparison, eager paired differences changed sign with run order. Graph C128 averaged 4.5% slower and included one 14.33 ms/token candidate batch. In the isolated flag comparison the largest absolute difference was 0.174 ms/token. Outputs, graph replay and KV capacity matched within each mode. Weight-file page cache and weight-loading times varied across fresh processes. </details> ## Reviewer Notes Please check lock ordering, the cache recheck before compilation, and whether the disk probe and executable plan identify the same artifact. Prepared with AI assistance. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Sparse MLA planning can defer compilation, check whether a planned kernel is cached, and compile it later. Running a deferred plan before compilation now raises an error. * Added a check for whether an attention kernel is available in the compilation cache. * **Improvements** * Builds for different kernels can proceed concurrently, while builds for the same kernel remain serialized. * Valid cached artifacts are preferred, with compiled kernels available as a fallback when no valid artifact can be loaded. * Cache loading validates artifacts and accounts for the current device. Unsupported cache keys can still proceed with compilation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Yuxian Qiu <[email protected]>
…llow-up on the dev tip Pin tensorrt_llm/_torch/attention/backends/prims_ts to kris1025/flashinfer linquanh/trtllm-prims-ts-dev-ds41-followup-r3 at d8c40b52f9. That branch is the PrimTS dev branch main pins (yuxianq/flashinfer trtllm-prims-ts-dev-20261107 at d81912f0b, NVIDIA#22274) plus: - the FlashInfer main PrimTS changes the dev branch lacks, in order: flashinfer-ai/flashinfer#6988, NVIDIA#9315, NVIDIA#9375 and NVIDIA#9224 (NVIDIA#9087, NVIDIA#9222, NVIDIA#5489 and NVIDIA#8549 are already on it). Where they meet the dev branch's CUTLASS DSL 4.9 task-API changes (runtime_domain_end, consumer_work_stage, _resolve_domain, ContextTask), the conflict resolutions keep the upstream logic in the dev branch's form; - the DeepSeek-V4.1 sparse MLA decode commits of flashinfer-ai/flashinfer#9701: the FP8+NVFP4 one-CTA Keep-AB decode, PDL after the prologue, FP8 tiles TMA-gathered into the retained K/V tile, the TMA-staged Q slot released after the last QK, and their tests; - one commit that puts the loops and stage reads NVIDIA#9315 and NVIDIA#9375 added in that same form; on the CuTe DSL 4.7/4.8 task API it changes nothing. The compatibility patch is main's, regenerated for the new pin, plus one adaptation: _hardware.py's SM107 check imports flashinfer.cute_dsl.availability absolutely, since its relative import would leave the vendored package. The vendored tree differs from main's only in the 29 files the follow-up commits change, and main's PrimTS users run on it unchanged. Signed-off-by: linquanh <[email protected]>
…llow-up on the dev tip Pin tensorrt_llm/_torch/attention/backends/prims_ts to kris1025/flashinfer linquanh/trtllm-prims-ts-dev-ds41-followup-r3 at d8c40b52f9. That branch is the PrimTS dev branch main pins (yuxianq/flashinfer trtllm-prims-ts-dev-20261107 at d81912f0b, NVIDIA#22274) plus: - the FlashInfer main PrimTS changes the dev branch lacks, in order: flashinfer-ai/flashinfer#6988, NVIDIA#9315, NVIDIA#9375 and NVIDIA#9224 (NVIDIA#9087, NVIDIA#9222, NVIDIA#5489 and NVIDIA#8549 are already on it). Where they meet the dev branch's CUTLASS DSL 4.9 task-API changes (runtime_domain_end, consumer_work_stage, _resolve_domain, ContextTask), the conflict resolutions keep the upstream logic in the dev branch's form; - the DeepSeek-V4.1 sparse MLA decode commits of flashinfer-ai/flashinfer#9701: the FP8+NVFP4 one-CTA Keep-AB decode, PDL after the prologue, FP8 tiles TMA-gathered into the retained K/V tile, the TMA-staged Q slot released after the last QK, and their tests; - one commit that puts the loops and stage reads NVIDIA#9315 and NVIDIA#9375 added in that same form; on the CuTe DSL 4.7/4.8 task API it changes nothing. The compatibility patch is main's, regenerated for the new pin, plus one adaptation: _hardware.py's SM107 check imports flashinfer.cute_dsl.availability absolutely, since its relative import would leave the vendored package. The vendored tree differs from main's only in the 29 files the follow-up commits change, and main's PrimTS users run on it unchanged. Signed-off-by: linquanh <[email protected]>
Dev Engineer Review
run_precompile_workersnow returnsNoneinstead ofbool. In non-strict mode, worker errors log a warning and return. Warmup continues with uncompiled kernels, and the caller cannot detect this. The first forward may still compile.run(validate=False)skips per-call validation. The caller must meet trusted-input conditions. The code does not check violations at runtime. The cache bound is not stated.3rdparty/vendor_sources.lock.yamltracks branchcute-dsl-precompile-api--prims-ts-vendorat commitbe630d2bef243b7475ff352bfdc6974512ef57f9. The objectives name the same commit. The source work is not merged upstream, so promotion depends on the source PR merging.#71066,#71185, and#71286reported failures. Failing tests are not identified. Pipeline#86382was aborted. Current-head CI status is not available.QA Engineer Review
test_prims_ts_sparse_mla_fmha.py(+396/-464): workspace-size cache reset, warmup profile selection, row-count coverage, largest-workspace-first ordering, cache-miss-only worker dispatch, strict and non-strict worker failures, timeout cleanup. Two prepared-launch tests were removed.test_phase_selective_forward.py(+4): checks that the"prims_ts"event follows the FMHA prewarm event.test_warmup.py(+58): CPU-only test of_prewarm_prims_ts_sparse_mlaordering, skip conditions, and barriers.test_dspark_model_engine_runtime.py(+8/-5): passesmax_total_draft_tokens=5and checks metadata construction.c7b6964da9added a process-group timeout-cleanup test and a warmup test for a distinct exact-row plan that reuses the compiled kernel. The author reports both passed on B200.validate=Falseprepared-launch path.Per-File QA Perspective
3rdparty/vendor_patches/flashinfer-prims-ts.patch: Addsprecompile_only,probe_cached,KernelBusy, andKernelNotCached. Verify that warm-up fails when JIT or the CuTe DSL cache is disabled.3rdparty/vendor_sources.lock.yaml: Points the entry to the new branch and commit. Verify the digests match the intended pin._prims_ts_worker.py(new): Standalone worker that imports PrimTS from a suppliedsys.path. Verify process-group cleanup when the parent exits.prims_ts_precompile.py: Starts workers only for two or more misses. Verify timeout cleanup and non-strict warning behavior.prims_ts_sparse_mla.py: Addswarmup_prims_ts_sparse_mlaand removes the per-forward variant scan. Verify warmup duration and plan loading in the serving process.prims_ts_dsa_sparse_mla.py: Marks a profile warmed only when variants exist. Verify that empty candidate sets leave profiles unwarmed.sparse/deepseek_v4/module.py: Moves epilogue-fusion checks intosupports_dsv4_epilogue_fusion. Verify fusion selection is unchanged.pyexecutor/engine/runners/decoder/warmup.py: Adds a PrimTS prewarm phase with TP or TP×CP synchronization. Verify it skips context-only and SWA-limited caches._cute_dsl_compat.py(new): AddsJitSpecCuteDslandbuild_and_load_cute_dsl_kernel. Verify fallback to the in-memory kernel when disk persistence fails.pyexecutor/engine/metadata.pyandrunners/decoder/metadata.py: Passmax_total_draft_tokensonly toTrtllmAttentionMetadatasubclasses. Verify other backends are unaffected.Description
Move DeepSeek-V4 PrimTS sparse MLA compilation from the first eligible forward into decoder warmup. Each pass scans every reachable row count.
plan(compile=False)obtains the finalized compile spec and workspace size without allocating launch buffers. With parallel compilation enabled,is_kernel_cached()checks each distinct kernel on disk.run(validate=False)path with independent input-view caches.d81912f0b125722e40ea4a4e66cd6fc71aee2614on the fork branchcute-dsl-precompile-api--prims-ts-vendor-20261124. It includes the current TensorRT-LLM vendor baseline69527ce04and the reviewed PrimTS changes. Upstream tracks compile caching and deferred planning in FlashInfer #9395 and sparse MLA run-time view reuse in FlashInfer #9767. With the pinned FlashInfer 0.7.3 runtime, TensorRT-LLM supplies the per-kernel JIT locking in its local compatibility module. FlashInfer cache PR · Original TRT-LLM implementationThe vendor topic includes the VC attention fixes from #22494, promoted to the canonical source by #22819, alongside the dense MLA and Helix changes from #19395. All ten commits that touch vendored files match the declared upstream PRs by normalized edits. The local cache adapter can be removed once the pinned FlashInfer release includes #9395's cache API and locking. #22659 also updates this pin. Whichever integration lands second should replay its source changes on the promoted tip and retain deferred planning, membership probing, and the dense CP launch ABI.
Sparse warmup prepares all eligible local PrimTS profiles whenever the library is enabled, regardless of its position in the FMHA list. Dispatch uses the actual forward inputs. With JIT disabled, prewarm loads available artifacts and defers each missing variant to a forward that selects it. The pinned FlashInfer 0.7.3 compatibility loader performs that lookup without requesting a build lock, so a read-only cache can contain a subset of the deployment’s variants. Eager generation derives its kernel profile through the same library method. The supervisor reports worker output on failure and terminates surviving descendants on both timeout and abnormal exit. Positive infinity allows an unlimited worker wait. DSA gets its top-k from runtime indices and attempts its optional scan on the first eligible eager forward. In non-strict mode a failed representative leaves subsequent batches free to plan their own rows.
The configured draft limit is applied before the first forward. Workers check that their artifact was published and the supervisor terminates its process group if the rank dies. On B300, two cold workers published both variants in 48.14 s. A separate JIT-disabled process loaded both in 0.49 s with zero workers. In a separate rank-kill check, the supervisor and pool descendants stopped within 0.70 s.
Downstream performance
DeepSeek-V4-Flash ran on four B200s with TP4/EP4, attention data parallelism, and 256 input and output tokens. Warmup times below are rank-0 wall time. The measurements predate the rebase. Each row group compares revisions from the same allocation.
c9c07e04→ standalone poole9e140d7c9c07e04→ cache check715858bac0On a cold PrimTS cache, grouping all 12 specializations in one pool saved 223.1 s in the first warmup (one process per version). In the warm comparison, the earlier standalone pool without the cache check took 20.2 s eager / 20.0 s graph in its first PrimTS phase on the same node (one reference process per mode). Querying disk membership saved about 15 s in that phase. Main and the cache-check version each ran in two fresh processes per mode.
The final implementation checks the cache again when the executor binds its serving resources. We isolated this change on a separate exclusive four-B200 node with the same FlashInfer code, comparing
715858bac0against its flag-removal patch, subsequently committed as3fcfb3f572.Both versions launched zero workers with all 12 exports available and four workers enabled per rank. The additional 12 checks took 1.35 s in a separate two-pass probe. The full PrimTS phase also includes local planning and rank synchronization. If two new variants first appear on the final pass, the new policy can compile them in parallel.
Steady-state time per output token
Columns are separate experiments. Each used before/after/after/before process order, two warmup batches and three measured batches per concurrency in each process. In the main-base comparison, eager paired differences changed sign with run order. Graph C128 averaged 4.5% slower and included one 14.33 ms/token candidate batch. In the isolated flag comparison the largest absolute difference was 0.174 ms/token. Outputs, graph replay and KV capacity matched within each mode. Weight-file page cache and weight-loading times varied across fresh processes.
Sparse MLA wrapper microbenchmark
The earlier public
run()comparison used TRT-LLM main-basec9c07e04and feature revision9d8394d2with FlashInfer81f96025f. It included the warmed prepared dispatch on main. The benchmark used BF16, 64 heads, fixed KV pools, and one process per source.Values are host microseconds per call. Persistent inputs improved 11.1–18.8% and one-use inputs improved 1.1–8.0%. Replacing inputs while keeping the prior tensors alive cost 0.90–2.15 µs more per call (5.3–12.3%). Output/LSE hashes and native arguments matched in all 18 cases. The fixture used 768 physical cache rows and fixed per-profile pools.
In a separate B200 wrapper experiment on FlashInfer #9767 (
5880ee354), bypassing only the query, index and output view caches saved 0.956 µs per host call on average with ephemeral adapter inputs. It cost 0.082–0.356 µs per call with persistent inputs across six profiles. Two fresh processes exercised both orders. Numerical results and all 17 launch arguments matched. We retained the general cache. These timings isolate the wrapper and exclude model-level TPOT.Test Coverage
On
dbf148f14d, after rebasing onto the #22819 merge (86967b879a), 33 targeted tests passed on B200 with zero skips. The run used stock FlashInfer 0.7.3 and a CI wheel with the same C++ tree as the rebased branch. Coverage included cold worker-to-parent handoff, sparse MLA reload, speculative rows, the launch ABI, and the promoted VC attention grouped-token and FP8 numerical cases.Separate 512-row D512 and D576 discovery scans on this head each made zero PyTorch CUDA allocation requests. All 1,024 finalized compile identities and workspace sizes, and every representative row, matched the pre-rebase result. In a fresh unprivileged process with a genuinely read-only partial cache, prewarm deferred the missing kernel and loaded the cached sibling, which produced bitwise-identical output.
On
0bd35f8ad5, the B200 worker-to-parent regression passed with stock FlashInfer 0.7.3. The test forbids requesting the lock directory for both a missing kernel and cached siblings.On
002a9767e9, four targeted B200 regression cases and two cold-cache dispatch checks passed. With JIT disabled and an empty PrimTS cache, prewarm completed in both orders. The fallback-first forward matched its reference, and the PrimTS-first forward raisedMissingJITCacheErrorfor the requested kernel. A mixed-cache case verified that warmup continued loading available variants after a miss.On
29257e701dafter rebasing onto4af2d530, all 64 targeted B200 tests passed with zero skips. The run used stock FlashInfer 0.7.3, CuTe DSL 4.8.0 and a TensorRT-LLM CI wheel built from the same C++ tree. Coverage includes the vendored-import regression, all ten sampler cases that failed in Jenkins #71596, four public trusted-launch ABI configurations, dense MLA graph replay, sparse warmup followed by zero new kernel compilations, worker cleanup, TP/CP failure propagation, and DSA exact-row fallback.Two additional single-B200 Helix tests passed against the vendored provider. The page-boundary case exercised logical CP ranks 0, 1 and 2 and compared merged output and LSE with the reference. The CP8 case exercised nonzero-rank CUDA graph replay. This validates the launch ABI on one device. A third additional test passed for packed sparse partial-head BF16 graph replay. Total on the rebased revision: 67 passed, zero skipped.
The vendor tree verifies against its published SHA. The cumulative pre-commit checks passed. The advisory type checker reported the existing
gen_offsetwarning in the unchanged FP8 path.d346fb95e1, the packed dense launch-bounds and sparse caller-workspace/cache-membership tests both passed on B200. Six B200 cases passed on the separate FlashInfer PR tree, including the latest upstream KV-bounds ABI.e466dcb2, both affected Qwen3.8-Flash-Next FP8 test files collected on B300 (120 cases). Four snapshot and cached-replay cases passed, including graph replay.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.