Skip to content

[https://nvbugs/7114472][fix] Regenerate stage-KV FMHA cubins with current trtllm-gen - #23123

Open
Ethkuil wants to merge 6 commits into
NVIDIA:mainfrom
Ethkuil:user/zhixinl/fix-stage-kv-pdl
Open

Ethkuil wants to merge 6 commits into
NVIDIA:mainfrom
Ethkuil:user/zhixinl/fix-stage-kv-pdl

Conversation

@Ethkuil

@Ethkuil Ethkuil commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Description

The 4 stage-KV FMHA cubins from #21997 were generated before #22089 updated trtllm-gen, so they still read the sequence lengths before griddepcontrol.wait (the PDL race #22089 fixed in the other FMHA cubins). test_stage_kv_cubins_match_the_kernel_inputs_they_were_built_against fails on main and is waived on B200/B300.

  • Regenerate the cubins (SM100/SM103 only) with the current trtllm-gen on GB200 and GB300, and remove the waivers.
  • Move the hash tests, which only read files, from the Blackwell-only GPU module to CPU pre-merge (tests/unittest/scripts), with a failure message that says how to regenerate.

Test Coverage

  • GB200 and GB300, rebuilt from source with these cubins: test_fmha_paged_context_fp8.py 23 passed.
  • tests/unittest/scripts/test_gen_stage_kv_cubins.py: the 5 moved cases, selected by the existing unittest/scripts entry of l0_cpu.
  • SASS of all 4 cubins: no global/TMA load before the first griddepcontrol.wait.
  • The cubin payloads are byte-identical to the ones [https://nvbugs/7114472][fix] Regenerate stage-KV FMHA cubins #22611 generated independently.

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-compatible or api-breaking. For api-breaking, include BREAKING in 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.

Dev Engineer Review

  • Diff totals are 9 files, +153/-112. The numstat per-file counts sum to these totals.
  • The four FmhaSm100a/FmhaSm103a *StageKv256E4.cubin.tar.zst archives are binary. Numstat shows 2 added and 2 removed lines each, so the payloads cannot be reviewed in the diff.
  • kernelMetaInfoStageKv.h (+6/-6) updates per-kernel SHA-256 values for four entries. Configurations and kernel references are unchanged.
  • gen_stage_kv_cubins.py (+1/-1) changes only the hash-input comment, which now points to test_gen_stage_kv_cubins.py.
  • The PDL fix (sequence-length reads before griddepcontrol.wait) rests on author-reported SASS inspection. The diff does not verify it.
  • Byte-identity with #22611 artifacts is author-reported only.
  • The CI failure for bd179a5 and the later passing run for 83ecd65 are not verifiable from the diff.

QA Engineer Review

  • test_fmha_paged_context_fp8.py (-95): removes the stage-KV cubin hash-match test, the parametrized hash-coverage test, and the regeneration test.
  • tests/unittest/scripts/test_gen_stage_kv_cubins.py (+138): new CPU-only file. It covers recorded hash matching, hash changes after header edits, header-block preservation, and stale-archive removal.
  • waives.txt (+0/-2): removes the DGX_B200 and DGX_B300 skips for test_stage_kv_cubins_match_the_kernel_inputs_they_were_built_against (nvbugs/7114472). No entries are added. The earlier raw-summary claim of four added entries is incorrect.
  • tests/integration/test_lists/test-db/l0_cpu.yml lists unittest/scripts (line 558), so the new CPU file is collected by that entry.
  • The author reports 23 passing test_fmha_paged_context_fp8.py cases on GB200 and GB300. This is not CI evidence.
  • Coverage verdict: needs follow-up. Confirm the paged-context FP8 GPU tests pass on B200 and B300 after the waiver removal. Confirm the failed CI run is resolved.

Per-File QA Perspective

  • Four stage-KV cubin archives: regenerated binaries. QA should confirm the paged-context FP8 path runs on SM100 and SM103.
  • kernelMetaInfoStageKv.h: hash values change for four kernels. QA should confirm kernel selection and launch settings are unchanged.
  • gen_stage_kv_cubins.py: comment only. No QA impact.
  • waives.txt: two skips removed. QA should confirm the FP8 paged-context tests pass on B200 and B300.
  • test_fmha_paged_context_fp8.py: hash and regeneration tests removed. Coverage moves to the new CPU file.
  • test_gen_stage_kv_cubins.py: new CPU-only tests. Covered by the unittest/scripts entry in l0_cpu.yml.

…rrent trtllm-gen

NVIDIA#21997 generated the 4 stage-KV cubins (SM100/SM103 only) with the
trtllm-gen libraries from before NVIDIA#22089, so they still read the sequence
lengths before griddepcontrol.wait: the PDL race that NVIDIA#22089 fixed in
all other FMHA cubins. Regenerate them with gen_stage_kv_cubins.py on
GB200 and GB300. Kernel selection and launch configuration are
unchanged, and the archives keep the tar metadata of the existing ones.

Remove the B200/B300 waivers of the stage-KV consistency test, which
passes again.

Signed-off-by: zhixinl <zhixinl@nvidia.com>
The stage-KV hash and header tests only read repository files, but they
sat in the Blackwell-only GPU module. Move them to
tests/unittest/scripts, which the CPU pre-merge stage runs, and make the
consistency test's failure say what is stale and how to regenerate the
cubins.

Signed-off-by: zhixinl <zhixinl@nvidia.com>
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The SM100 and SM103 stage-KV metadata records have updated kernel hashes. CPU-only script tests now check hash consistency and generator behavior. The integration waiver list has additions and removals.

Changes

Stage-KV hash consistency

Layer / File(s) Summary
Refresh stage-KV kernel metadata
cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/kernelMetaInfoStageKv.h
The SM100 and SM103 persistent and static-context entries retain their configurations and kernel references, with updated hashes.
Move and extend generator checks
tests/unittest/scripts/test_gen_stage_kv_cubins.py, scripts/trtllm_gen_fmha_stage_kv/gen_stage_kv_cubins.py, tests/unittest/_torch/attention/test_fmha_paged_context_fp8.py
CPU-only script tests check recorded hashes, required inputs, input edits, and regeneration behavior. The generator comment points to the new test file. The attention test file no longer contains the generator checks.

Integration test waivers

Layer / File(s) Summary
Update integration test waivers
tests/integration/test_lists/waives.txt
The waiver list adds DGX_B200 and DGX_B300 test entries and removes DGX_B200 and DGX_B300 FMHA paged-context cubin-matching entries.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: chzblych, brnguyen2, chang-l

Merge Risk: Minimal · up to 7d186 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Security architecture risk: Minimal · up to 83ecd

The update preserves the existing kernel interface and moves the consistency checks to an existing pre-merge job. The reviewed changes did not establish a new security exposure or weaken failure containment or rollback guarantees.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title follows the repository template: it has an NVBugs ID, a [fix] type, and a short summary. It names the main change, which is regenerating the stage-KV FMHA cubins with the current trtllm-gen.…
Description check Passed The description covers the problem, the fix, and the test coverage. It explains that the four stage-KV cubins were built before the trtllm-gen update and so read sequence lengths before griddepcontrol…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title follows the repository template: it has an NVBugs ID, a [fix] type, and a short summary. It names the main change, which is regenerating the stage-KV FMHA cubins with the current trtllm-gen. It does not mention the test-file move or the waiver removal, but that is expected for a concise title.

Full details: Description check

Explanation

The description covers the problem, the fix, and the test coverage. It explains that the four stage-KV cubins were built before the trtllm-gen update and so read sequence lengths before griddepcontrol.wait. It lists the cubin regeneration on GB200 and GB300, the waiver removal, and the move of the hash tests to the CPU pre-merge path. The test coverage section lists the validation runs. The PR checklist is marked as reviewed. The description does not use the template's ticket-and-type title format in the body, but the title does follow it, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9780924 and 7d18690.

Files ignored due to path filters: 4

  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/FmhaSm100aKernel_QkvE4m3OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContextStageKv256E4.cubin.tar.zst is excluded by !**/*.zst
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/FmhaSm100aKernel_QkvE4m3OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128StaticContextStageKv256E4.cubin.tar.zst is excluded by !**/*.zst
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/FmhaSm103aKernel_QkvE4m3OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContextStageKv256E4.cubin.tar.zst is excluded by !**/*.zst
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/FmhaSm103aKernel_QkvE4m3OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128StaticContextStageKv256E4.cubin.tar.zst is excluded by !**/*.zst
Files selected for processing: 2

  • scripts/trtllm_gen_fmha_stage_kv/gen_stage_kv_cubins.py
  • tests/integration/test_lists/waives.txt
Files with no reviewable changes: 1

  • tests/integration/test_lists/waives.txt
Files skipped from review as they are similar to previous changes: 1

  • scripts/trtllm_gen_fmha_stage_kv/gen_stage_kv_cubins.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

…he generator

spec_from_file_location can return None, which pyrefly flags. Assert it
as tests/unittest/scripts/test_check_pip_install.py does.

Signed-off-by: zhixinl <zhixinl@nvidia.com>
@yuxianq

yuxianq commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

@yunruis, could you help to review this PR as trt-llm-torch-attention-devs? Thanks~

Assignment explanation
Componentskernels/trtllm-gen (80%); integration/attention-tests (20%)
Tagsalgorithm:dense (100%); phase:prefill (100%); features:quantization (50%); features:paged-kv (50%)
PR effort4 points — The four artifacts share one regeneration. The substantive review is checking load ordering in both scheduling variants on each SM and confirming that the moved tests still detect stale build inputs.
ImportanceImportant — The four changed digests select executable FMHA payloads for SM100 and SM103. The reported fix orders sequence-length reads after griddepcontrol.wait, where an early read can use stale lengths during attention.
Affinity (0–1)0.783 component/tag match; 0.587 after PIC preference
Affinity evidenceMerged authorship 2 × √points; first review 1 × √points; global normalization 0.763969
Outstanding points at selection40 → 44 (+4)
Points already reserved on this PR0
Effective weight1
Completed review points (preceding 168 hours)18
Combined points after assignment62
Demand-derived target57.00 points (soft share)
Additional fair share before assignment0.00 points
Share explanationWhole PR / qualification or coverage constraint exceeds a soft share; assignment is allowed.
Selection ruleaffinity with 0.3-share guard
Assignment scope (yunruis)all

Affinity and workload are snapshots at selection, not live counters. Existing reservations on this PR are counted once.

@yuxianq
yuxianq requested review from yunruis and removed request for PerkzZheng, QiJune and heyuhhh December 1, 2026 07:21
@Ethkuil

Ethkuil commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

/bot run

@yunruis

yunruis commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

please update wiki doc in trtllm-gen

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #88347 [ run ] triggered by Bot. Commit: bd179a5 Link to invocation

@yunruis yunruis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attention part LGTM.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements.

@Ethkuil Ethkuil changed the title [https://nvbugs/7114472][fix] Regenerate stage-KV FMHA cubins with current trtllm-gen [NVBug 7114472][fix] Regenerate stage-KV FMHA cubins with current trtllm-gen Dec 1, 2026
@Ethkuil Ethkuil changed the title [NVBug 7114472][fix] Regenerate stage-KV FMHA cubins with current trtllm-gen [https://nvbugs/7114472][fix] Regenerate stage-KV FMHA cubins with current trtllm-gen Dec 1, 2026
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #88347 [ run ] completed with state FAILURE. Commit: bd179a5
/LLM/main/L0_MergeRequest_PR pipeline #73356 completed with status: 'ABORTED'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@trtllm-agent-review trtllm-agent-review left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. It regenerates the four SM100/SM103 stage-KV FMHA cubins with the current trtllm-gen, so they wait for the PDL predecessor before reading sequence lengths, moves their file-only hash tests to CPU pre-merge and drops the two B200/B300 waives.

Reviewed at commit bd179a5620 (9 files, +149/−112).

The four archives were fetched from LFS and disassembled for the SASS check.

Approve: no Blocker found. 3 suggestions below are nice to have.

Nice to have (3): 3 inline, 0 below
  • (N3: Missing or ineffective tests) This check hashes only the trtllm-gen export headers, so a trtllm-gen update that changes only the generator libraries leaves the four stage-KV cubins stale while CPU pre-merge stays green. (test_gen_stage_kv_cubins.py:60)
  • (R3: Repository rules) The new test file's functions have no annotations, against CODING_GUIDELINES.md's "Always annotate functions". (test_gen_stage_kv_cubins.py:25)
  • (R1: PR process) #22611 is a competing fix for the same bug on the same files: close it when this PR merges, and decide what happens to its write_archive change. (test_gen_stage_kv_cubins.py:1)
What this review checked
  • The moved hash test fails against the base revision's kernelMetaInfoStageKv.h, which records 3e76c3ff… while the headers now hash to 1ff5959e…, and prints the new regenerate message. All five moved cases pass at this commit, and the unittest/scripts entry of l0_cpu.yml selects them.
  • Each of the four new archives holds one cubin whose sha256 matches its entry in kernelMetaInfoStageKv.h, and the header is byte-identical to #22611's. In the new SASS no global or TMA load comes before the first griddepcontrol.wait; the old cubins had eight.
  • Both removed waives cite this PR's bug, and no test list, QA list, duration entry or other waive still names the old test ids.
  • Not covered: No GPU run: the regenerated cubins were not executed, and the B200/B300 pre-merge results were not yet available.
  • Not covered: The E4 softmax-loop reordering was not checked in the SASS.

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.

@trtllm-agent-review

Copy link
Copy Markdown
Collaborator

What this PR changes, by code owner

For each code owner (a team or a person) of files this PR changes: what it changes there. The review above has the findings.

trt-llm-torch-attention-devs · 7 files
Swaps in the four SM100/SM103 stage-KV FMHA cubins (FP8 paged context, head dim 256) regenerated with the current trtllm-gen, so they wait for the PDL predecessor before reading sequence lengths, and records their new digests. Kernel selection and launch settings are unchanged; the file-only hash tests move to CPU.

Files
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/FmhaSm100aKernel_QkvE4m3OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContextStageKv256E4.cubin.tar.zst
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/FmhaSm100aKernel_QkvE4m3OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128StaticContextStageKv256E4.cubin.tar.zst
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/FmhaSm103aKernel_QkvE4m3OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContextStageKv256E4.cubin.tar.zst
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/FmhaSm103aKernel_QkvE4m3OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128StaticContextStageKv256E4.cubin.tar.zst
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/cubin/kernelMetaInfoStageKv.h
  • scripts/trtllm_gen_fmha_stage_kv/gen_stage_kv_cubins.py
  • tests/unittest/_torch/attention/test_fmha_paged_context_fp8.py

trt-llm-devs · 1 file
Adds the stage-KV cubin generator's checks, moved from the Blackwell GPU attention tests to CPU pre-merge: the recorded kernel-input hash must match the current trtllm-gen headers, now with a message saying how to regenerate, plus the hash-coverage and header-regeneration cases.

Files
  • tests/unittest/scripts/test_gen_stage_kv_cubins.py

Other files · 1 file
Removes the B200 and B300 waives of the stage-KV hash test, which passes again with the regenerated cubins and now runs on CPU under a new path.

Files
  • tests/integration/test_lists/waives.txt

CODING_GUIDELINES.md asks to annotate every function.

Signed-off-by: zhixinl <zhixinl@nvidia.com>
@Ethkuil

Ethkuil commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #88378 [ run ] triggered by Bot. Commit: 83ecd65 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #88378 [ run ] completed with state SUCCESS. Commit: 83ecd65
/LLM/main/L0_MergeRequest_PR pipeline #73384 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

CI Report

Link to invocation

Signed-off-by: zhixinl <zhixinl@nvidia.com>

@dc3671 dc3671 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Regenerating the four stage-KV cubins is the right fix for 7114472; the merge from main after the last CI run does not touch the FMHA kernel inputs the hash covers.

@Ethkuil

Ethkuil commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #88887 [ run ] triggered by Bot. Commit: 7d18690 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #88887 [ run ] completed with state SUCCESS. Commit: 7d18690
/LLM/main/L0_MergeRequest_PR pipeline #73843 completed with status: 'FAILURE'

CI Report

⚠️ Resource Maintenance — Test Coverage Reduced:

Resource maintenance in LLM/main/L0_Test-x86_64-Single-GPU #5743: AWS-PDX-SLURM-1 is unavailable for maintenance on 2026-12-02 17:00-23:00 UTC; H100_PCIe-PyTorch-Perf-1 was retired from main.
Affected stages:
DGX_B300-PyTorch-1
DGX_B300-PyTorch-2
DGX_B300-PyTorch-3
DGX_B300-PyTorch-4

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants