Skip to content

[None][perf] DSV4 o_proj: fuse fp8/UE8M0 quantize into o_a proj and introduce splitk cutedsl o_b proj#15257

Closed
mingyangHao wants to merge 7 commits into
NVIDIA:feat/deepseek_v4from
mingyangHao:user/mingyangh/dsv4-oproj-fp8-fuse
Closed

[None][perf] DSV4 o_proj: fuse fp8/UE8M0 quantize into o_a proj and introduce splitk cutedsl o_b proj#15257
mingyangHao wants to merge 7 commits into
NVIDIA:feat/deepseek_v4from
mingyangHao:user/mingyangh/dsv4-oproj-fp8-fuse

Conversation

@mingyangHao

@mingyangHao mingyangHao commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Fold the o_lora bf16->fp8 + 1x128 packed-UE8M0 quantization into the o_a blockwise GEMM epilogue (single-pass, tree-reduce amax), so o_a emits fp8+sf directly and o_b (DeepGEMM 1d1d) consumes it without the separate fp8_quantize_1x128_packed kernel and the bf16 o_lora HBM round-trip.

  • blockwise_gemm.py: optional fp8+SF epilogue path, gated by sf_out tensor; the bf16 path is byte-identical when off. Single-pass register cache, tree-reduce amax (byte-exact), packed-UE8M0 MN-major sf store, predicated for tail-M, config-guarded to (128,128)/1-CTA.
  • cute_dsl_custom_ops.py: new trtllm::cute_dsl_fp8_bmm_blackwell_fp8out op.
  • attention.py: gated DSV4_FUSE_OPROJ branch in _deepseek_v4_o_proj (tp_size==1), falls back to the existing path when the flag is off.

Validated byte-exact (G=1/G=16/tail-M/negative guards) and net-positive (+1.6us/o_a in decode, nsys hardware-timestamp measured). Default OFF -> zero functional change unless DSV4_FUSE_OPROJ=1.

@coderabbitai summary

Perf

O_a proj

M Production epilogue BF16 Output BMM + quant (us) Fused FP8-output BMM (us) Latency saved (us) Latency reduction
1 SMEM/8-lane 14.983 13.572 1.410 9.414%
4 SMEM/8-lane 14.739 11.749 2.990 20.289%
8 SMEM/8-lane 14.793 11.739 3.054 20.642%
16 SMEM/8-lane 14.940 11.736 3.204 21.443%
32 SMEM/8-lane 14.919 12.007 2.912 19.519%
64 register 14.905 12.590 2.315 15.534%
128 register 15.887 12.765 3.122 19.650%
256 register 26.259 22.782 3.478 13.244%
512 register 43.607 38.545 5.062 11.609%
1024 register 70.739 63.227 7.512 10.620%
2048 register 136.478 121.612 14.867 10.893%
4096 register 266.435 238.101 28.334 10.634%
8192 register 530.327 471.969 58.358 11.004%
16384 register 1074.552 944.454 130.098 12.107%

O_b proj

M Production SK DeepGEMM + mHC (us) CuTe DSL + mHC (us) Latency saved (us) Latency reduction
1 2 47.240 39.024 8.216 17.392%
2 2 47.201 39.312 7.889 16.713%
4 2 47.184 38.992 8.192 17.361%
8 2 47.256 39.019 8.237 17.431%
16 2 48.046 40.539 7.507 15.624%
32 2 48.859 47.536 1.323 2.708%
64 2 50.592 49.152 1.440 2.847%
128 2 54.178 52.059 2.119 3.911%
256 1 63.633 61.899 1.734 2.724%
512 1 77.011 74.733 2.277 2.957%
1024 1 128.475 126.478 1.997 1.555%
2048 1 231.219 229.685 1.534 0.663%
4096 1 433.948 431.599 2.349 0.541%
8192 1 827.062 822.309 4.752 0.575%
16384 1 1646.516 1642.309 4.207 0.256%

Test Coverage

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.

@mingyangHao mingyangHao force-pushed the user/mingyangh/dsv4-oproj-fp8-fuse branch from a21cd4c to 45a2bc2 Compare June 11, 2026 12:50
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #53573 [ run ] triggered by Bot. Commit: 45a2bc2 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #53573 [ run ] completed with state SUCCESS. Commit: 45a2bc2
/LLM/main/L0_MergeRequest_PR pipeline #42721 completed with status: 'FAILURE'

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

CI Agent Failure Analysis

Link to invocation

@mingyangHao mingyangHao force-pushed the user/mingyangh/dsv4-oproj-fp8-fuse branch 3 times, most recently from 26b34dc to 970315b Compare June 30, 2026 08:01
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56564 [ run ] triggered by Bot. Commit: 970315b Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56564 [ run ] completed with state FAILURE. Commit: 970315b
/LLM/main/L0_MergeRequest_PR pipeline #45399 completed with status: 'FAILURE'

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

CI Agent Failure Analysis

Link to invocation

@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56623 [ run ] triggered by Bot. Commit: 970315b Link to invocation

@mingyangHao mingyangHao force-pushed the user/mingyangh/dsv4-oproj-fp8-fuse branch from 970315b to e00062c Compare June 30, 2026 14:52
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56623 [ run ] completed with state FAILURE. Commit: 970315b
/LLM/main/L0_MergeRequest_PR pipeline #45449 completed with status: 'FAILURE'

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

CI Agent Failure Analysis

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56628 [ run ] triggered by Bot. Commit: e00062c Link to invocation

@mingyangHao mingyangHao force-pushed the user/mingyangh/dsv4-oproj-fp8-fuse branch from e00062c to df9dded Compare June 30, 2026 15:06
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56632 [ run ] triggered by Bot. Commit: df9dded Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56628 [ run ] completed with state ABORTED. Commit: e00062c

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56632 [ run ] completed with state SUCCESS. Commit: df9dded
/LLM/main/L0_MergeRequest_PR pipeline #45457 completed with status: 'FAILURE'

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

CI Agent Failure Analysis

Link to invocation

@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56781 [ run ] triggered by Bot. Commit: e4aaa93 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56781 [ run ] completed with state FAILURE. Commit: e4aaa93
/LLM/main/L0_MergeRequest_PR pipeline #45599 completed with status: 'FAILURE'

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

CI Agent Failure Analysis

Link to invocation

@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56820 [ run ] triggered by Bot. Commit: e4aaa93 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56820 [ run ] completed with state FAILURE. Commit: e4aaa93
/LLM/main/L0_MergeRequest_PR pipeline #45637 completed with status: 'FAILURE'

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

CI Agent Failure Analysis

Link to invocation

@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

Fuse o_a FP8 and UE8M0 quantization into the CuTe DSL epilogue. Add a TRT-LLM-owned SM100 O_b split-K kernel using DeepGEMM MMA/TMA building blocks, and fold split-partial reduction into the mHC half-MMA and half-FMA paths. Keep the optimization opt-in and cover dispatch, producer correctness, and fused reduction.

Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
Replace the dedicated C++/THOP O_b split-K GEMM with a CuTe DSL implementation built on the persistent SM100 block-scaled GEMM. Consume packed K128 UE8M0 scales directly, issue runtime-N tcgen05 MMA, and preserve BF16 split-major partials for the existing mHC fused reduction.

Tune the packed-scale, dynamic-N, scheduler, and epilogue paths against current DeepGEMM. Dispatch SK2 through M=128, use CuTe SK1 for supported M>=256 shapes, and retain DeepGEMM as the unsupported-shape fallback. Add tactic, dispatch, packed-scale, and split-partial correctness coverage while removing the obsolete C++ kernel and registration.

Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
@mingyangHao mingyangHao force-pushed the user/mingyangh/dsv4-oproj-fp8-fuse branch from 1751c6f to 7716c86 Compare July 7, 2026 07:46
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot kill

@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57970 [ run ] triggered by Bot. Commit: 7716c86 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57971 [ kill ] triggered by Bot. Commit: 7716c86 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57970 [ run ] completed with state ABORTED. Commit: 7716c86

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57971 [ kill ] completed with state SUCCESS. Commit: 7716c86
Successfully killed previous jobs for commit 7716c86

Link to invocation

Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@mingyangHao mingyangHao requested a review from limin2021 July 7, 2026 09:56
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57991 [ run ] triggered by Bot. Commit: 8348419 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57991 [ run ] completed with state SUCCESS. Commit: 8348419
/LLM/main/L0_MergeRequest_PR pipeline #46661 completed with status: 'FAILURE'

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

CI Agent Failure Analysis

Link to invocation

Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58108 [ run ] triggered by Bot. Commit: 5f70bd2 Link to invocation

@longlee0622

Copy link
Copy Markdown
Collaborator

@mingyangHao Should this PR target main instead?

@mingyangHao

Copy link
Copy Markdown
Collaborator Author

@longlee0622 Yes, I will change the target of this PR later.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58108 [ run ] completed with state SUCCESS. Commit: 5f70bd2
/LLM/main/L0_MergeRequest_PR pipeline #46771 completed with status: 'FAILURE'

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

CI Agent Failure Analysis

Link to invocation

Signed-off-by: Mingyang Hao <200044211+mingyangHao@users.noreply.github.com>
@mingyangHao mingyangHao force-pushed the user/mingyangh/dsv4-oproj-fp8-fuse branch from af97041 to c797edf Compare July 8, 2026 05:27
@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@mingyangHao

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58231 [ run ] triggered by Bot. Commit: c797edf Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58231 [ run ] completed with state FAILURE. Commit: c797edf

Link to invocation

@longlee0622

Copy link
Copy Markdown
Collaborator

We no longer use the ds v4 side branch. Closing this PR. Please prepare PR against main.

@longlee0622 longlee0622 closed this Jul 9, 2026
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.

3 participants