Repository navigation
[https://nvbugs/6862662][fix] Bound FP8 MLA page-table loads for partial tiles - #20415
Merged
Merged
Conversation
…ial tiles Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
Collaborator
Author
|
/bot run --disable-fail-fast |
Contributor
Collaborator
Author
|
@kris1025, could you help to review this PR as trt-llm-torch-attention-devs? Thanks~ Assignment explanation
Affinity and workload are snapshots at selection, not live counters. Existing reservations on this PR are counted once. |
Collaborator
|
PR_Github #78117 [ run ] triggered by Bot. Commit: |
Collaborator
|
PR_Github #78117 [ run ] completed with state |
kris1025
approved these changes
Oct 16, 2026
|
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. |
1 task done
SimengLiu-nv
pushed a commit
to SimengLiu-nv/TensorRT-LLM
that referenced
this pull request
Oct 26, 2026
….3: Bound FP8 MLA page-table loads for partial tiles Forward-port of release/1.3 PR NVIDIA#20415 (release/1.3 commit c98395b) to main. Adapted to main: the fix is applied to tensorrt_llm/_torch/attention/kernels/blackwell/mla/mla_decode_fp8.py, where NVIDIA#19275 moved the CuTe DSL MLA decode kernels, and the new test passes the FP8 softmax/output scales as device tensors at inputs[10:12], the runner input contract main adopted in NVIDIA#19960. Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com> Signed-off-by: Simeng Liu <simengl@nvidia.com>
SimengLiu-nv
pushed a commit
to SimengLiu-nv/TensorRT-LLM
that referenced
this pull request
Nov 2, 2026
….3: Bound FP8 MLA page-table loads for partial tiles Forward-port of release/1.3 PR NVIDIA#20415 (release/1.3 commit c98395b) to main. Adapted to main: the fix is applied to tensorrt_llm/_torch/attention/kernels/blackwell/mla/mla_decode_fp8.py, where NVIDIA#19275 moved the CuTe DSL MLA decode kernels, and the new test passes the FP8 softmax/output scales as device tensors at inputs[10:12], the runner input contract main adopted in NVIDIA#19960. Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com> Signed-off-by: Simeng Liu <simengl@nvidia.com>
SimengLiu-nv
pushed a commit
to SimengLiu-nv/TensorRT-LLM
that referenced
this pull request
Nov 2, 2026
….3: Bound FP8 MLA page-table loads for partial tiles Forward-port of release/1.3 PR NVIDIA#20415 (release/1.3 commit c98395b) to main. Adapted to main: the fix is applied to tensorrt_llm/_torch/attention/kernels/blackwell/mla/mla_decode_fp8.py, where NVIDIA#19275 moved the CuTe DSL MLA decode kernels, and the new test passes the FP8 softmax/output scales as device tensors at inputs[10:12], the runner input contract main adopted in NVIDIA#19960. Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com> Signed-off-by: Simeng Liu <simengl@nvidia.com>
SimengLiu-nv
pushed a commit
to SimengLiu-nv/TensorRT-LLM
that referenced
this pull request
Nov 3, 2026
….3: Bound FP8 MLA page-table loads for partial tiles Forward-port of release/1.3 PR NVIDIA#20415 (release/1.3 commit c98395b) to main. Adapted to main: the fix is applied to tensorrt_llm/_torch/attention/kernels/blackwell/mla/mla_decode_fp8.py, where NVIDIA#19275 moved the CuTe DSL MLA decode kernels, and the new test passes the FP8 softmax/output scales as device tensors at inputs[10:12], the runner input contract main adopted in NVIDIA#19960. Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com> Signed-off-by: Simeng Liu <simengl@nvidia.com>
SimengLiu-nv
pushed a commit
to SimengLiu-nv/TensorRT-LLM
that referenced
this pull request
Nov 3, 2026
….3: Bound FP8 MLA page-table loads for partial tiles Forward-port of release/1.3 PR NVIDIA#20415 (release/1.3 commit c98395b) to main. Adapted to main: the fix is applied to tensorrt_llm/_torch/attention/kernels/blackwell/mla/mla_decode_fp8.py, where NVIDIA#19275 moved the CuTe DSL MLA decode kernels, and the new test passes the FP8 softmax/output scales as device tensors at inputs[10:12], the runner input contract main adopted in NVIDIA#19960. Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com> Signed-off-by: Simeng Liu <simengl@nvidia.com>
SimengLiu-nv
pushed a commit
to SimengLiu-nv/TensorRT-LLM
that referenced
this pull request
Nov 3, 2026
….3: Bound FP8 MLA page-table loads for partial tiles Forward-port of release/1.3 PR NVIDIA#20415 (release/1.3 commit c98395b) to main. Adapted to main: the fix is applied to tensorrt_llm/_torch/attention/kernels/blackwell/mla/mla_decode_fp8.py, where NVIDIA#19275 moved the CuTe DSL MLA decode kernels, and the new test passes the FP8 softmax/output scales as device tensors at inputs[10:12], the runner input contract main adopted in NVIDIA#19960. Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com> Signed-off-by: Simeng Liu <simengl@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dev Engineer Review
mla_decode_fp8.py. The page-table bounds checks described in the PR objectives are present in the file, but they are not part of the inspected diff.QA Engineer Review
Per-File QA Perspective
tensorrt_llm/_torch/cute_dsl_kernels/blackwell/attention/mla/mla_decode_fp8.py: The diff changes import formatting only. The file contains bounds checks that default out-of-range page indices to page 0, but those checks are not changes in the inspected diff.Description
Fixes https://nvbugs/6862662:
test_attention_mla(V1 KV cache, BF16 activations, FP8 KV cache, 64 requests × 10 context tokens, page size 32) intermittently hits a CUDA illegal memory access on B200.Root cause. In the CuTe DSL FP8 MLA decode kernel (
mla_decode_fp8.py), the K and V TMA load paths readpage_per_tilepage IDs for every KV tile. A 128-token tile can need up to four page IDs at page size 32, even when a request owns only one page. The kernel read those entries without checking the page-table width. For the last request, those reads run past the end of the page-table allocation. Here that allocation is 64 requests × 2 interleaved K/V slots × 1 int32 page ID = 512 bytes. Whether the access faults depends on what the caching allocator has placed after the table, so the failure is order-dependent. The original traceback surfaced later, in the test's reference computation, because CUDA reports the fault asynchronously.Fix. Bound each page-table read by
mPT.shape[0]. Lanes past the table width use physical page 0. Those lanes are masked out by the sequence length anyway, and still issuing the TMA load keeps each tile's expected byte count unchanged. This mirrors the existing guard in the FP16 kernel's page-table loader (mla_decode_fp16.py,load_page_table), which zero-fills out-of-range entries.Test Coverage
tests/unittest/_torch/attention/test_cute_dsl_mla_page_table.py(8 variants): page sizes 32/64, persistent/non-persistent, split-KV 1/2, with one compiled kernel reused across table widths 4, 1, 2, 3, 5. Uses V1-style interleaved K/V page-table strides. Run undercompute-sanitizer --tool memcheckwithPYTORCH_NO_CUDA_MEMORY_CACHING=1, it detects the out-of-bounds reads before the fix. It is collected by the existingunittest/_torch/attentionentry inl0_b200.yml.tests/unittest/_torch/attention/test_attention_mla.py.Local results on B200, release/1.3 at
7c2f9389a7:split_kv_kerneltest_attention_mla.py(full file)unittest/_torch/attentionsuite at the historical failing revisionThe same out-of-bounds reads reproduce on current main (
c9b18eefa7); a separate PR will carry the fix and waiver removal there.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