Skip to content

Conversation

@byshiue
Copy link
Collaborator

@byshiue byshiue commented Nov 11, 2025

Summary by CodeRabbit

  • New Features

    • Added configurable QK normalization parameter in attention operations, enabling conditional normalization behavior in fused attention kernels.
  • Refactor

    • Updated Qwen attention implementation to support optional QK norm rope fusion with default enabled behavior.

Description

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)

  • 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

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

Signed-off-by: bhsueh <11360707+byshiue@users.noreply.github.com>
Signed-off-by: bhsueh <11360707+byshiue@users.noreply.github.com>
@byshiue byshiue requested review from a team as code owners November 11, 2025 04:59
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

📝 Walkthrough

Walkthrough

This pull request adds a new is_qk_norm boolean parameter throughout the QK normalization and RoPE fusion stack, enabling conditional control over RMSNorm operations. The parameter is propagated from Python PyTorch bindings through C++ kernel launchers to the CUDA kernel implementation. Additionally, QwenAttention is refactored to inherit from QKNormRoPEAttention with updated rope scaling logic and a legacy compatibility flag.

Changes

Cohort / File(s) Change Summary
CUDA Kernel Layer
cpp/tensorrt_llm/kernels/fusedQKNormRopeKernel.h, cpp/tensorrt_llm/kernels/fusedQKNormRopeKernel.cu
Added is_qk_norm boolean parameter to kernel function and launch function signatures. Wrapped RMSNorm reduction and normalization operations in conditional block gated by is_qk_norm.
PyTorch C++ Binding
cpp/tensorrt_llm/thop/fusedQKNormRopeOp.cpp
Updated fused_qk_norm_rope function signature and PyTorch library binding to accept is_qk_norm parameter. Propagated parameter to underlying CUDA kernel launch.
QK Norm Attention Module
tensorrt_llm/_torch/modules/qk_norm_attention.py
Added is_qk_norm parameter (default True) to QKNormRoPEAttention constructor. Made RMSNorm weight initialization conditional on is_qk_norm for both q_norm and k_norm. Passed is_qk_norm to fused kernel calls.
Qwen Model Integration
tensorrt_llm/_torch/models/modeling_qwen.py
Refactored QwenAttention to inherit from QKNormRoPEAttention (previously inherited from Attention). Added OLD_QWEN_ATTENTION legacy compatibility flag. Introduced fuse_qk_norm_rope parameter with default True. Updated rope scaling logic to support both rope_scaling and default rope_gpt_neox configurations.

Sequence Diagram(s)

sequenceDiagram
    participant Python as Python Layer
    participant CPPBinding as C++ Binding
    participant Launcher as Kernel Launcher
    participant CUDA as CUDA Kernel

    Python->>CPPBinding: fused_qk_norm_rope(..., is_qk_norm)
    CPPBinding->>Launcher: launchFusedQKNormRope(..., is_qk_norm)
    Launcher->>CUDA: fusedQKNormRopeKernel(..., is_qk_norm)
    
    alt is_qk_norm == true
        CUDA->>CUDA: Apply RMSNorm reduction
        CUDA->>CUDA: Apply normalization
        rect rgb(144, 238, 144)
            note right of CUDA: QK Norm Active
        end
    else is_qk_norm == false
        rect rgb(255, 182, 193)
            note right of CUDA: QK Norm Disabled
        end
    end
    
    CUDA-->>Python: Return processed tensors
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

  • modeling_qwen.py: Inheritance pattern change from Attention to QKNormRoPEAttention requires careful verification of behavioral compatibility. The introduction of OLD_QWEN_ATTENTION flag and conditional implementation path should be validated for proper backward compatibility.
  • Parameter propagation chain: Verify that is_qk_norm is correctly threaded through all five files and that default values (True) are appropriate across the stack.
  • RMSNorm weight conditioning: Confirm that has_weights=is_qk_norm correctly reflects the intended behavior and doesn't introduce unintended state during model initialization or inference.
  • Rope scaling logic: The refactored rope configuration in modeling_qwen.py introduces new type resolution logic that warrants verification for edge cases and missing type field handling.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ⚠️ Warning The PR description is entirely empty except for template boilerplate. All required sections (Description, Test Coverage) lack substantive content. Fill in the Description section explaining what the PR does and why, and the Test Coverage section listing relevant tests that validate the changes.
Title check ❓ Inconclusive The title 'Support Yarn on QwQ-32B model' accurately describes the main objective, but the changes primarily implement a conditional is_qk_norm flag across multiple components rather than direct Yarn support. Clarify whether the title should reflect the primary technical changes (adding is_qk_norm parameter) or the higher-level feature goal. Consider if the title should emphasize the conditional QK normalization feature that enables Yarn support.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@byshiue
Copy link
Collaborator Author

byshiue commented Nov 11, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24155 [ run ] triggered by Bot. Commit: 69c58a5

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24155 [ run ] completed with state FAILURE. Commit: 69c58a5
/LLM/main/L0_MergeRequest_PR pipeline #18212 completed with status: 'FAILURE'

Signed-off-by: bhsueh <11360707+byshiue@users.noreply.github.com>
@byshiue
Copy link
Collaborator Author

byshiue commented Nov 12, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24242 [ run ] triggered by Bot. Commit: daf232d

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24242 [ run ] completed with state FAILURE. Commit: daf232d
/LLM/main/L0_MergeRequest_PR pipeline #18287 completed with status: 'FAILURE'

Signed-off-by: bhsueh <11360707+byshiue@users.noreply.github.com>
@byshiue byshiue changed the title [None][feat] Support Yarn on QwQ-32B model [None][feat] Draft: Support Yarn on QwQ-32B model Nov 13, 2025
@byshiue
Copy link
Collaborator Author

byshiue commented Nov 13, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24411 [ run ] triggered by Bot. Commit: 32ce1cf

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24411 [ run ] completed with state SUCCESS. Commit: 32ce1cf
/LLM/main/L0_MergeRequest_PR pipeline #18419 completed with status: 'FAILURE'

Signed-off-by: bhsueh <11360707+byshiue@users.noreply.github.com>
Signed-off-by: bhsueh <11360707+byshiue@users.noreply.github.com>
@byshiue
Copy link
Collaborator Author

byshiue commented Nov 24, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25472 [ run ] triggered by Bot. Commit: 9e28ae4

@byshiue byshiue changed the title [None][feat] Draft: Support Yarn on QwQ-32B model [None][feat] Support Yarn on QwQ-32B model Nov 24, 2025
@byshiue
Copy link
Collaborator Author

byshiue commented Nov 24, 2025

The current change is a workaround to support the yarn on qwq in short time.
We will refactor the change later.

@StudyingShao
Copy link
Collaborator

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25484 [ run ] triggered by Bot. Commit: 57d8b1e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25472 [ run ] completed with state ABORTED. Commit: 9e28ae4
LLM/main/L0_MergeRequest_PR #19286 (Blue Ocean) completed with status: ABORTED

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25483 [ run ] triggered by Bot. Commit: 57d8b1e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25484 [ run ] completed with state ABORTED. Commit: 57d8b1e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25485 [ run ] triggered by Bot. Commit: 57d8b1e

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25483 [ run ] completed with state ABORTED. Commit: 57d8b1e

Signed-off-by: Jiang Shao <91270701+StudyingShao@users.noreply.github.com>
@tensorrt-cicd
Copy link
Collaborator

PR_Github #25485 [ run ] completed with state SUCCESS. Commit: 57d8b1e
/LLM/main/L0_MergeRequest_PR pipeline #19297 completed with status: 'FAILURE'

Signed-off-by: bhsueh <11360707+byshiue@users.noreply.github.com>
@byshiue
Copy link
Collaborator Author

byshiue commented Nov 24, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25498 [ run ] triggered by Bot. Commit: efa5a27

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25498 [ run ] completed with state SUCCESS. Commit: efa5a27
/LLM/main/L0_MergeRequest_PR pipeline #19309 completed with status: 'FAILURE'

@byshiue
Copy link
Collaborator Author

byshiue commented Nov 24, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #25560 [ run ] triggered by Bot. Commit: efa5a27

@tensorrt-cicd
Copy link
Collaborator

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

@byshiue byshiue merged commit 1a93583 into NVIDIA:main Nov 24, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants