Repository navigation
Conversation
|
/bot run |
Vendor validation:
|
|
PR_Github #86253 [ run ] triggered by Bot. Commit: |
Vendor validation:
|
a062deb to
3ebb708
Compare
|
/bot run |
|
PR_Github #88614 [ run ] triggered by Bot. Commit: |
|
PR_Github #88614 [ run ] completed with state
|
|
/bot run |
|
PR_Github #88622 [ run ] triggered by Bot. Commit: |
3ebb708 to
14391f2
Compare
|
/bot run |
|
PR_Github #88630 [ run ] triggered by Bot. Commit: |
|
PR_Github #88622 [ run ] completed with state |
trtllm-agent-review
left a comment
There was a problem hiding this comment.
Thanks for the PR. Adds a PrimTS sparse MLA provider for DeepSeek-V4.1's CSA2 attention that reads the fp8 SWA and NVFP4 MAIN caches directly and becomes the default for kv_cache_config.dtype: fp8 on SM100/SM103/SM107.
Reviewed at commit 14391f2621 (85 files, +24,312/−2,412).
Re-review of the slice of the changes since the earlier review at 81a32d2 that touches lines this PR adds (params.py, _prims_ts_quantization.py, most of _prims_ts_packed.py, one prims_ts.py hunk, and the mHC file the PR no longer carries); it rechecks that review's seven Blockers and posts only Blockers and possible blockers.
This re-review covered the most important 999 of the 5,020 lines the PR changed since 81a32d29d0, the commit the bot last reviewed (3,039 of source code, 1,862 of tests, 119 of docs and data): the files of its earlier Blockers first, then source code, tests, docs and data. It did not review the other 4,021 (2,040 of source code, 1,862 of tests, 119 of docs and data), in 67 files, which need a code owner's review: trt-llm-torch-attention-devs (42 files), trt-llm-oss-compliance (15 files), trt-llm-doc-owners (3 files), trt-llm-kv-cache-manager-devs (1 file), trt-llm-disagg-devs (7 files), trt-llm-kernels-devs (1 file), trt-llm-models-devs (3 files), trt-llm-moe-devs (1 file), trt-llm-runtime-devs (3 files), trt-llm-devs (5 files), trt-llm-qa-function (1 file), trt-llm-infra-devs (3 files), trt-llm-multi-gpu-ci-review (2 files).
Re-review: request changes: 2 Blockers need fixing before merge.
Blockers (2)
- (B1: Correctness)
dtype: fp8still stores SWA as 512-byte E4M3 rows that clip at ±448 by default on every CSA2 provider; the reply defers accuracy evidence without a tracking ticket. (params.py:31) - (B1: Correctness) PrimTS, the
dtype: fp8default on SM100/SM103/SM107, still saturates Q, SWA and decoded MAIN at ±448 by default, and the new scales cap or skip MAIN depending on the kernel route. (_prims_ts_quantization.py:37)
What this review checked
- The earlier Blockers A1, A2, A3, A7 and A13 are fixed at 14391f2: plan constants sit first in each arena (
_prims_ts_packed.py:684-702), SWA slots resolve before_selection_startis recorded (module.py:1857-1861), owner tags keep the epoch below the sign bit (_prims_ts_bank.py:522-526), any explicituse_fp8_stagingkeeps the native provider (params.py:265-268), and the PDL test's writer is the attention's direct predecessor. - The Q and SWA scale folding is arithmetically consistent on each PrimTS route: the gather and producer routes scale Q.K and the output by
2**efor MAIN decoded into the SWA rows' domain, the NVFP4 MAIN route takes2**eas the SWA pool's tensor scale (_prims_ts_packed.py:1815-1917), every E4M3 Q handed torun()is at the plan's Q scale, and the scale exponents and the PDL setting are part of the in-process and persistent kernel cache keys. - The workspace reservation and the layers resolve the same provider (both read
kv_cache_dtypefromextra_attrsand the lowereduse_fp8_staging), and nothing in the tree still references the removedmhc_ob_boundary.py. - Not covered: No GPU run; the probe, the scale folds and the kernel routes were traced from code.
- Not covered: Only the 999-line slice of the changes since 81a32d2 was reviewed; the other 4021 changed lines of new code were read only where the slice reaches them.
- Not covered: No CI result for the reviewed head.
Automated review by trtllm-agent-review. If a point is wrong, reply in its thread. Once you have pushed code changes and replied in every Blocker thread, the bot re-checks the Blockers within a few hours. A Blocker you think should not be fixed needs no code change: reply in its thread with the reason and the evidence.
|
PR_Github #88630 [ run ] completed with state
|
trtllm-agent-review
left a comment
There was a problem hiding this comment.
Reply check: the code has not changed, and the Blockers of the earlier review are resolved.
- [Blocker] (B1: Correctness) answered (deferred to a follow-up):
kv_cache_config.dtype: fp8, which on main meant 528-byte SWA records with a UE8M0 scale per 32 channels, now stores SWA for every CSA2 provider as 512-byte E4M3 rows at one process-wide scale that defaults to unit, so SWA values above +-448 saturate without error. (formats.py:27) - [Blocker] (B1: Correctness) answered (deferred to a follow-up): PrimTS, the default for
dtype: fp8on SM100/SM103/SM107, still rounds Q and decodes SWA and MAIN to E4M3 at a unit scale by default, so magnitudes above 448 saturate silently; the opt-in power-of-two scales are fixed per process, never reach MAIN on the NVFP4 MAIN kernel route, and an amax below 448 makes the bank and producer routes clip decoded MAIN at 448*2^e. (_prims_ts_quantization.py:41)
…llow-up on the dev tip Pin tensorrt_llm/_torch/attention/backends/prims_ts to kris1025/flashinfer linquanh/trtllm-prims-ts-dev-ds41-followup-r5 at c3e7d63d13. That branch is the PrimTS source main pins (bastianhagedorn/flashinfer trtllm-prims-ts-decode-corr-cluster-acquire-20261124b at 9497c8892c, NVIDIA#21852: the dev branch trtllm-prims-ts-dev-20261107 plus the cluster-scope acquire of flashinfer-ai/flashinfer#9224) plus: - the FlashInfer main PrimTS changes the dev branch lacks, in order: flashinfer-ai/flashinfer#6988, NVIDIA#9315 and NVIDIA#9375 (NVIDIA#9087, NVIDIA#9222, NVIDIA#5489, NVIDIA#8549 and NVIDIA#9224 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 of flashinfer-ai/flashinfer#9701 as it merged: the FP8+NVFP4 one-CTA Keep-AB decode, PDL after the prologue with the wait ahead of TMEM allocation, FP8 tiles TMA-gathered into the retained K/V tile, the TMA-staged Q slot released after the last QK, a WS lane's four MXFP8 block scales stored as one word, 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 <linquanh@nvidia.com>
… on SM100/SM103/SM107 Add CSA2PrimsTS, a CSA2 compute provider that runs the vendored PrimTS sparse MLA kernels directly on the persistent packed caches, FP8 SWA and NVFP4 MAIN, through the kernel's kv_producer extension, for context and generation tiles. - Selection: CSA2Params.compute_backend="auto" picks PrimTS on SM100, SM103 and SM107 unless packed attention or explicit FP8 staging asks for the native provider. TRTLLM_CSA2_COMPUTE_BACKEND=trtllm selects native. - KV cache: the SWA encoding follows KvCacheConfig.dtype: 512-byte unit-scale E4M3 rows for "fp8", the 528-byte scaled rows otherwise. Context and generation instances must use the same encoding. - Generation: selections are prepared beside the layer projections, on a side stream where they are final before them. The compaction kernel claims one epoch-tagged owner slot per selected MAIN row, so the selection bank decodes each owned row once to E4M3 (outputs bitwise identical); a Reuse layer of a generation-only forward decodes its bank beside its projections. Layers of one staging group share one compact metadata buffer and one bank. 64-head tiles over E4M3 SWA rows run the vendored FP8+NVFP4 one-CTA Keep-AB kernel, which decodes each selected NVFP4 MAIN record itself; persistent grids of it use the static scheduler. Tiles of at most 32 heads that would run the packed producer read the selections as published (raw selections). Every generation step the backend admits takes the direct decode, which now also reads the 512-byte E4M3 SWA records. Packed attention and the compaction launch with PDL when TRTLLM_ENABLE_PDL is on. The MLA decode launches pass context-parallel rank 0, and MXFP8OutputQuant declares stages_ws_sw128_rows. - Context: the warp-specialized schedule writes the MXFP8 O-A input itself. On the fp8 KV cache, 64-head eager context phases whose rows share one converted-KV bank run the fused sparse context kernel (csa2_sparse_context), as the native provider does. The context MAIN bank grows past its reserved 64 MiB on demand, up to 1 GiB, and prefill pass graphs dispatch attend_rows to PrimTS. Context chunks of a new length reuse their kernels (about 0.2 instead of 2.6 ms of host time per layer), and a tile whose Q projection made the unit-scale E4M3 Q, or whose plan writes the MXFP8 O-A input, gets no BF16 buffer for it. - O-A/O-B: from 4K rows the grouped MXFP8 O-A, and from 128 MiB of input the dense MXFP8 O-B, walk each 256-row input block's output columns first (same bits); the O-B of a prequantized O-A input writes into the layer output. dense_mxfp8_gemm_compiled takes the rows a graph capture would run. - Plans precompile every kernel variant at the first plan, before CUDA Graph capture, and new batch shapes no longer recompile the Triton helpers. Arena plans keep their plan-time constants at fixed offsets, owner claims keep the selection in 24 bits below the epoch, SWA-only tiles take the gather kernel, a tile-memo hit restores the layer's MAIN bank, and an overlapped SWA or Reuse decode resolves its SWA slots before its early compaction. GB300 AgentX, 60-minute windows, token throughput per GPU, PrimTS (kv fp8) against native (kv fp8_ds_mla), as the generation changes landed: the DEP points went from -13.0%, -13.5% and -12.4% (c7000, c7900, c5100) to +0.8%, +2.0% and +1.9%, and c7600 stays within its 5% run-to-run spread of native; the TEP8 points c240, c140 and c84 measured +3.2%, +0.1% and 0.0%, and with every admitted step on the direct decode their generation step matches native's. The NVFP4 MAIN kernel takes 15.8 / 27.1 / 51.4 / 106.4 us at 152 / 252 / 504 / 1252 rows against native csa2_sparse_decode's 19.2 / 33.1 / 71.8 / 140.8 us (64 heads, 128 SWA + 512 MAIN selections, CUDA-graph replay). On c7900 the PrimTS context KV cache is within 1% of native's, with an equal prefix-cache hit rate. These were measured on the bring-up branch's vendored PrimTS. Tests: the CSA2 PrimTS backend, module, metadata, producer and quantization suites; PrimTS and native prefills compared bit for bit on every row whose selections match (an exact Top-K score tie may pick either row); the native-provider module tests pinned to trtllm-gen only on SM100-family GPUs; and the B300 and B200 CSA2 entries split into three to fit the per-entry timeout. The CSA2 README documents the provider and its override. Signed-off-by: linquanh <linquanh@nvidia.com>
…rimTS query kv_cache_config.dtype="fp8" stores SWA rows as 512-byte unit-scale E4M3, and PrimTS reads Q as unit-scale E4M3, both clipping every magnitude above 448. Each can now hold E4M3(x / 2**e) at one process-wide power-of-two scale: - TRTLLM_CSA2_SWA_FP8_AMAX names the largest SWA magnitude (default 448, so e = 0 and every row keeps its bytes); e is the smallest exponent with 448 * 2**e >= amax, from -8 to 3, the three binades native context staging can spend. Writers (both quantize kernels and pack_rows) divide by 2**e before rounding, which is exact; QuantizeJobSpec carries e. Native readers (gather dequant, PackedAttention, the direct decode, and staging, where a swa_fp8 row acts as a scaled SWA row whose every group byte is 127 + e) multiply it back exactly. PrimTS's NVFP4 MAIN kernel takes 2**e as its FP8 SWA pool's tensor scale; the gather and producer kernels fold it into Q.K and the output instead, so the MAIN rows they read decode into the same domain (decode_main_bank, decode_main_records and dedup_main_records take scale_exponent; PackedKvProducer.main_scale_exponent descales NVFP4 records). The scaled E2M1-to-E4M3 conversion passes its factor in a .b32 register. - TRTLLM_CSA2_Q_FP8_AMAX names the largest query magnitude (default 448, so e_q = 0; from -8 to 8). PrimTS's Q rounding (UnitScaleQuery) and the small-step RoPE multiply by 2**-e_q before rounding, and the gather, producer and NVFP4 MAIN kernels scale Q.K back. The fused prefill and FP8 decode Q projections still emit unit-scale E4M3 Q, so with e_q != 0 a PrimTS module rounds its BF16 Q itself; a context batch the fused context kernel serves keeps its unit-scale Q, which native staging scales. Each plan records the scales it was built for. MAIN rows the NVFP4 MAIN kernel decodes still saturate at 448. Every process that shares a cache, including the context and generation workers of a disaggregated deployment, must use the same SWA amax; KV transfers copy the bytes. Tests: the amax parsing; pack_rows and unpack_rows, both quantize kernels and the gather at several scales; selection-bank decode against the reference conversion; UnitScaleQuery and the small-step RoPE against independent references; the PrimTS gather, producer and NVFP4 MAIN kernels at e = 2 and e_q = 2 against unit-scale runs of the same bytes, bit for bit; and test_prims_ts_scales_keep_image_token_magnitudes, which feeds Q, SWA and MAIN about 600 times unit-normal through PrimTS on the fp8 KV cache: with both amax variables at 3584 it stays within the native x600 staging test's bound, and its error at unit scales must be over three times larger. Signed-off-by: linquanh <linquanh@nvidia.com>
…se where it cannot run there - An explicit use_fp8_staging keeps the native provider. Only True kept it on SM100, SM103 and SM107, so an explicit False, which the public field documents as pinning BF16 staging, selected PrimTS and attended in unit-scale E4M3. Either explicit value now selects trtllm-gen under auto, and a forced PrimTS provider rejects False as it rejects True; the backend tests pin BF16 staging only on the native provider. - auto selects PrimTS only for swa_fp8. PrimTS reads the 512-byte unit-scale E4M3 SWA rows of kv_cache_config.dtype="fp8" directly; the other KV dtypes (auto, bfloat16, fp8_ds_mla) store the 528-byte scaled records, for which the native fused decode serves 64-head generation tiles about twice as fast. select_csa2_backend takes the persistent SWA encoding; the backend passes its own, and the workspace reservation resolves it from the KV dtype the model loader records, so a native deployment reserves no PrimTS workspace. An explicit provider is not limited by the encoding. - auto raises where PrimTS cannot run on the fp8 KV cache. csa2_prims_ts_unsupported_reason() checks, per device and without compiling or allocating, the CuTe DSL toolchain (get_prims_ts_toolchain_unsupported_reason), the import of _prims_ts_packed with the vendored internals it builds on, and a host-side plan of its smallest launch. The native provider would read those SWA rows without its fused or direct decode and stage every generation step, so selection raises with the reason and the ways out (the requirements.txt toolchain, kv_cache_config.dtype=fp8_ds_mla, or TRTLLM_CSA2_COMPUTE_BACKEND=trtllm). The workspace reservation selects first, so it fails before any layer is built. test_hf_factory_auto_backend_and_staging, test_unsupported_prims_ts_default_raises, test_prims_ts_support_probe and the reservation test cover it; CPU-only tests, which model GPUs they do not run on, take PrimTS as supported (conftest). The README states the rules. Signed-off-by: linquanh <linquanh@nvidia.com>
…ities, shared code, warmup, docs
- Size and reserve the selection bank for one generation step: only tiles of up to the
step's query capacity take a selection bank, allocated at that capacity, and every plan
views one pair of index arrays of the same capacity, which the reservation charges (512
MAIN selections, 128 one-token requests, max_num_tokens 4096: 64 MiB instead of 1 GiB;
test_prims_ts_selection_bank_fits_its_reservation). A large plan sets up its Q rounding
only eagerly, and an MXFP8 output plan rejects output buffers on another device.
- A decoder pass graph attends small generation steps with the direct decode: attend_rows
and the eager forward both ask _direct_decode, so a padded one-row step no longer runs the
unit-scale E4M3 packed kernel in the graph and the BF16 direct decode eagerly (6 of 1024
logits beyond 2**-4 on two B200s; now at most 0.039 on that step and bitwise equal on every
other). The attention-DP pass-graph test runs both providers. The PDL test writes its
selections directly before the attention, with a control dependent that must read stale
ones.
- compute.py gives each provider a capability set (CSA2PrimsTS, CSA2FlashMLA,
CSA2FlashInfer, NATIVE_COMPUTE) that the module asks instead of compute_backend names, and
every MXFP8 O-A writer, gen_fmha and the fused decode included, sets output_mxfp8_written
on the module's state, which alone decides whether the module projects the MXFP8 input.
test_module_provider_predicates pins the module's choices before and after.
- Native staging and PrimTS share selection_forward_key and the scaled E2M1-to-E4M3
conversion (_fp8_codec.py, inline asm under both CuTe DSL frontends), and byte-level tests
require them to decode the same MAIN and SWA bytes; PrimTS's own context attention stays
within 1.25x the native fused kernel's error to BF16 staging.
- During the executor's warmup, a PrimTS arena variant's first plan sends the kernels the
persistent CuTe DSL cache lacks to the shared PrimTS precompile pool ("csa2_packed"
payloads); formats.py lets the workers import the CSA2 kernels' host code without
TensorRT-LLM's runtime. Without a pool, outside the warmup, or where it fails, the plan
compiles them itself.
- In an eager context phase a layer that publishes no MAIN rows reads the bank its KV
owner's Full layer decoded when the bank's key matches (forward, pool, plan tensors, bank
storage, scale) instead of decoding again; one decode of 250K MAIN rows takes 34 us on
B200.
- sparse-attention.md, kvcache.md, the CSA2 README and the 1.4 release notes give fp8 (512-
byte E4M3 rows at one power-of-two scale, PrimTS under auto) and fp8_ds_mla (528-byte
scaled records, the native provider with its fused and direct decodes) as different SWA
formats, and fp8_ds_mla as the way to keep main's behavior. l0_gr100 runs the PrimTS CSA2
tests.
On B200, test_prims_ts_fp8_producer.py (137 passed), test_kernel.py (257), test_backend.py
(242), the DeepSeek-V4 precompile tests and the decoder warmup tests pass.
Signed-off-by: linquanh <linquanh@nvidia.com>
…n size or storage scale PeerRegistrar validated head geometry only for head-sharded paged views, so a peer whose replicated regions differed in size registered, accepted requests and then failed every transfer in ReplicatedMapper. CSA2 workers with kv_cache_config.dtype fp8 and fp8_ds_mla are such a pair: their SWA records are 512 and 528 bytes. Registration now compares the bytes per layer of each replicated paged view, or the slot size of a ring view, whose slot count may differ, and names the view and kv_cache_config.dtype in its error. swa_fp8 rows also carry no scale: they hold E4M3(x / 2**e) at one process-wide exponent (TRTLLM_CSA2_SWA_FP8_AMAX), so two peers at different exponents registered and the receiver read the rows at its own scale. RankInfo now carries the CSA2 cache's exponent (CSA2CacheManager.swa_fp8_scale_exponent; omitted from the wire for caches without swa_fp8 rows), and both the sender's registrar and the receiver reject a peer at another exponent, naming the variable. The CSA2 mismatch test expects the rejection at registration; test_peer_registrar_requires_one_csa2_swa_fp8_scale and test_rank_info_carries_csa2_swa_fp8_scale_exponent cover the scale; test_peer.py, test_rank_info.py, test_csa2_kv_transfer.py and test_deepseek_v4_kv_transfer.py (310) pass. Signed-off-by: linquanh <linquanh@nvidia.com>
The cache sizing, the constructor's head_dim default and its check spelled CSA2's one latent KV head as a bare 512. _HEAD_DIM names it, as the other CSA2 modules do, and says which SWA row sizes it gives. Signed-off-by: linquanh <linquanh@nvidia.com>
…argument calls The producer probes are compiled with TVM-FFI's environment stream, so each call takes the pool, the indices and the output; the _Probe alias listed a fourth tensor argument that no call passes. Signed-off-by: linquanh <linquanh@nvidia.com>
14391f2 to
ed0e0bb
Compare
|
/bot run |
|
PR_Github #88910 [ run ] triggered by Bot. Commit: |
|
PR_Github #88910 [ run ] completed with state
|
bo-nv
left a comment
There was a problem hiding this comment.
Two issues need fixes before approval: generation can change the numerical value of the same MAIN record across batch sizes, and the generation worker can cache an incompatible SWA layout as a successful handshake. The inline comments include regression conditions for both and a separate workspace accounting follow-up.
| native_main = ( | ||
| main if main.shape[0] else state.buffers["dummy_main"].view(-1)[:main_bytes].view(1, -1) | ||
| ) | ||
| if nvfp4 is not None and _dense_rows(swa_cache) and _dense_rows(native_main, main_bytes): |
There was a problem hiding this comment.
[High] [Blocking] Please make the two generation paths agree on the decoded MAIN value before enabling this dispatch. With TRTLLM_CSA2_SWA_FP8_AMAX=112 (scale ¼), consider a GB300 REUSE layer with 64 local heads, early selection, 128 SWA slots and 512 MAIN slots. With sufficient capacity, 252 generation rows take the selection bank and 1,252 take this native NVFP4 path. A valid MAIN element of 256 (E2M1 4 × group scale 64) becomes 112 in the bank: 256 / ¼ saturates to 448 and is scaled back. The native path preserves 256. A request can therefore get a different attention output solely because other requests joined the batch. The earlier scale discussion identified clipping; the batch switch also affects values below 448. Please use a common MAIN quantization domain or gate the differing path for non-unit scales. A regression can hold one request’s Q, selected rows and sinks fixed, pad the batch across the dispatch boundary, and compare its output with a nonzero weight on that MAIN row.
| @@ -4686,6 +4686,7 @@ def _get_sender_info(self, params: DisaggregatedParams) -> RankInfo: | |||
| sender_info = RankInfo.from_bytes(message[0]) | |||
| validate_protocol_version(sender_info) | |||
| self._registrar.validate_bounded_replay_compatible(sender_info) | |||
| self._registrar.validate_swa_scale_compatible(sender_info) | |||
There was a problem hiding this comment.
[Medium] [Blocking] Please check replicated region sizes here before the generation worker caches the context peer as compatible. The earlier fix rejects a 512/528-byte mismatch in sender-side PeerRegistrar.register(). On the receiver, fp8 paired with fp8_ds_mla passes the exponent check because one exponent is absent, and validate_view_head_geometry() skips replicated SWA views. The receiver sends REGISTER_RANK_INFO without an acknowledgement and caches success, while the sender logs its registration error. A request can then wait for the transfer timeout, and subsequent requests reuse the incompatible peer. Both dtypes used 528-byte rows at the base. Please exercise prepare_rank_info() in both dtype directions and assert an immediate, cached PeerIncompatibleError naming the dtype, with no registration sent.
| "Run a PrimTS plan of more than _Q8_ARENA_ROWS rows once before CUDA Graph " | ||
| "capture with the Q dtype it captures" | ||
| ) | ||
| self._q8 = torch.empty( |
There was a problem hiding this comment.
[Medium] [Non-blocking] Please include this plan-owned Q8 allocation in workspace reporting and sizing. An 8,192-row prefill with 16 local heads and TRTLLM_CSA2_Q_FP8_AMAX=896 supplies BF16 Q and retains 64 MiB here in addition to the shared arena. _get_plan() snapshots wrapper.workspace_tensors before the first run, and that property only returns arena buffers. get_workspace_bytes() consequently misses the live allocation; the fixed reservation also excludes it. This can be followed up because ordinary eager tiles are replaced and we have not observed an OOM. The existing large-plan BF16-Q test could assert the extra storage is counted exactly once after the first run and again after plan reuse.
Dev Engineer Review
TRTLLM_CSA2_COMPUTE_BACKEND=trtllm. Confirm that this default is intended.use_fp8_stagingvalue selectstrtllm-gen. Forcing PrimTS rejectsFalseas it rejectsTrue.fp8meaning: Explicitfp8now selectsswa_fp8(512-byte unit-scale E4M3, no footer).fp8_ds_mla,auto, andbfloat16use the 528-byte layout. Existing deployments that rely onfp8need review.write_layer_rows,store_layer_rows,direct_sparse_decode, andselect_csa2_backend.dense_mxfp8_gemm_compiledgains a requiredrowsargument, which breaks existing callers. Check all call sites.flashinfer-prims-tsvendor entry points to a fork branch and commit, not an upstream release. Vendor promotion requires the source PR to merge.#71458,#71493, and#71553. The PR description attributes them to SM120 test selection and a B300 CSA2-entry timeout, addressed by commits 17 and 18. Current-head results are not available.QA Engineer Review
Changed test files and lists:
tests/unittest/_torch/attention/sparse/csa2/changed. These includetest_backend.py,test_cache_manager.py,test_direct_decode.py,test_fused_decode.py,test_indexer.py,test_kernel.py,test_metadata.py,test_module.py, and_utils.py.test_prims_ts_fp8_producer.pyandtest_prims_ts_fp8_quantization.pyare new.test_allreduce.pyandtest_deepseek_v41_attention_dp.pychanged.test_deepseek_v41_snapshots.pyanddisaggregated/test_csa2_kv_transfer.pyalso changed.l0_b200.yml,l0_b300.yml,l0_gb200_multi_gpus.yml,l0_gb300.yml,l0_gr100.yml, andtests/integration/defs/.test_durations.Test coverage:
fp8andfp8_ds_mlaSWA layouts, PrimTS producer and quantization, raw selections, MAIN bank decoding, CUDA Graph replay, and keys-as-M decode are covered.l0_b200andl0_b300split the aggregate CSA2 entry into three runs. The directory run excludestest_backend.pyand the PrimTS FP8 producer test, which run as separate entries. Confirm that no CSA2 file is dropped.nv_internalsources. This attribution is not verified.Coverage verdict: needs follow-up. Current-head CI results are not available. The reported failures and pending GB300 measurements are unresolved.
Per-File QA Perspective
_prims_ts_*.py,prims_ts.py,direct_decode.py,projection.py,kernel.py: New or changed kernel paths. Verify PrimTS output against native output and FP8 accuracy.backend.py,params.py,module.py: Backend selection changes and the default PrimTS path on SM100/103/107. Verify override behavior andfp8versusfp8_ds_mlarouting.cache_manager.py,quantization.py,metadata.py: Row width depends on the KV dtype. Verify sizing and disaggregated transfer consistency.mhc_*kernels,mhc_lowm.py,hyper_connection.py,modeling_deepseekv41.py: New Blackwell boundary and fusion paths. Verify graph-capture and multi-GPU all-reduce behavior.low_m_gemm.py,query_projection.py,csa2_weight_prefetch.py: Carveout and tile selection changes. Verify performance and correctness on Blackwell.3rdparty/vendor_patches/flashinfer-prims-ts.patch,vendor_sources.lock.yaml: New compile-cache modes and a fork pin. Verify the pinned commit builds.kvcache.md,ATTENTION_DEVELOPER_GUIDE.md, CSA2README.md): Document the newfp8semantics and the backend override. Verify they match the code..test_durations: Verify all split CSA2 entries run and new tests appear in the correct pre-merge lists.Description
Adds PrimTS as a CSA2 sparse MLA compute provider for DeepSeek-V4.1. PrimTS attends the packed SWA and NVFP4 MAIN KV caches directly in the vendored PrimTS MLA decode kernels, instead of staging them for the native kernel.
autopicks PrimTS forkv_cache_config.dtype: fp8; the other KV dtypes keep the native provider.TRTLLM_CSA2_COMPUTE_BACKEND=trtllm|prims_tsoverrides. Where PrimTS cannot run on the fp8 KV cache (CuTe DSL toolchain, vendored internals),autoraises and names the fixes.fp8now stores SWA as 512-byte E4M3 rows at one power-of-two scale (TRTLLM_CSA2_SWA_FP8_AMAX; unit by default, saturating at 448).fp8_ds_mlakeeps the 528-byte scaled records and the native provider, which is how to keepmain's behavior.TRTLLM_CSA2_Q_FP8_AMAXscales PrimTS's E4M3 query the same way. Disaggregated peers must use the same format and scale; registration rejects a mismatch.fp8) gives 3.2% to 5.2% higher P90 interactivity than native (kvfp8_ds_mla) on the attention-DP points and matches it on the TEP8 points; output throughput per GPU is within -0.6% to +3.5%. See Performance below.Commits:
Vendored PrimTS
Commit 1 pins
tensorrt_llm/_torch/attention/backends/prims_tstokris1025/flashinferlinquanh/trtllm-prims-ts-dev-ds41-followup-r5atc3e7d63d13:main's PrimTS pin (bastianhagedorn/flashinfertrtllm-prims-ts-decode-corr-cluster-acquire-20261124bat9497c8892c, #21852: the dev branchd81912f0bplus flashinfer-ai/flashinfer#9224) plus flashinfer-ai/flashinfer#6988, #9315 and #9375, and #9701 as it merged.-r5is-r4(76117c8a60) rebased onto that pin:-r4's cherry-pick of #9224 is already there, so the selected tree is unchanged.-r4is-r3(d8c40b52f9) plus #9701's last four commits, cherry-picked unchanged: a WS lane's four MXFP8 block scales stored as one word, the PDL wait moved ahead of TMEM allocation, and two tests. The compatibility patch ismain's plus one absolute import. All four upstream PRs have merged.Performance
GB300 NVL72 (OCI JHB), AgentX disaggregated serving of DeepSeek-V4.1-Flash NVFP4 with DSpark, at 14391f2 (the head before the rebase onto 86f778c; that rebase brings in only
main's changes). Both providers run the same wheel and image and differ only inkv_cache_config.dtype: PrimTS isfp8(autoselects PrimTS), native isfp8_ds_mlawithTRTLLM_CSA2_COMPUTE_BACKEND=trtllm. Each pair ran on one node set, PrimTS first and native after it, with a 45-minute measurement window, scored with the AgentX harness's metric code; no request failed. Values are PrimTS vs native.Test Coverage
tests/unittest/_torch/attention/sparse/csa2/(PrimTS backend, module, metadata, producer and quantization tests),tests/unittest/disaggregated/test_peer.py,test_rank_info.pyandtest_csa2_kv_transfer.py.l0_b200,l0_b300,l0_gb300andl0_gr100; the decoder pass-graph test for both providers inl0_gb200_multi_gpusandl0_gb300_multi_gpus.ci: full pre-merge approvedlabel.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.🤖 Generated with Claude Code