Skip to content

[https://nvbugs/7163265][fix] Forward pre-replay staging in MoE LoRA test - #23008

Open
trtllm-agent wants to merge 2 commits into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-v2/nvbug-7163265-r701
Open

trtllm-agent wants to merge 2 commits into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-v2/nvbug-7163265-r701

Conversation

@trtllm-agent

@trtllm-agent trtllm-agent commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Make the MoE LoRA integration test's counted_replay wrapper a typed
passthrough. It forwards all positional and keyword arguments unchanged to
CUDAGraphRunner.replay, including pre_replay_staged, and returns its result.
The replay counter still increments once per call.

Why this is a test-only fix

PR #22370
(7a8a07721021842e363c241e8372fbffa26af308) added this keyword to both the
production replay interface and its decoder callers. The test's counting
wrapper retained the older explicit signature and rejected the keyword before
delegating to the original replay method.

This updates only that instrumentation. Forwarding the arguments rather than
copying the replay signature avoids repeating this mismatch when that interface
changes. Production code, numerical criteria, assertions, and CI registrations
remain unchanged.

Test Coverage

  • test_qwen_moe_native_fp8_lora_matches_bf16_reference[cudagraph] exercises the
    corrected wrapper, asserts LoRA graph replay, and compares the native FP8
    adapter's logit delta with its BF16 reference.
  • Its [eager] parametrization is the existing non-graph control.
  • The existing test_qwen_moe_routed_expert_multi_lora_varying_ranks[eager] and
    [cudagraph] cases provide adjacent MoE LoRA coverage.

These cases are already selected by tests/integration/test_lists/test-db/l0_h100.yml.
No additional test cases or CI registrations are introduced.

Verification

  • Applicable pre-commit hooks pass.
  • An isolated forwarding check verifies positional and keyword argument identity,
    omitted defaults, an additional keyword, return values, exception propagation,
    and one counter increment per call. All 18 existing test assertions are unchanged.
  • H100, one GPU, using the CI image and development requirements. All four
    existing cases run together in one pytest process with --test-list.
  • Previously measured baseline: 86cc005c4fd68dd51f2042a0c861e71955828876:
    three cases pass; the native FP8 [cudagraph] case fails because
    counted_replay rejects pre_replay_staged.
  • Candidate: 3ed1de4cb307af817288322717d8bf73efd97270.
  • After: all four cases pass, with no skips. The original numerical, cache,
    generation, and graph-replay assertions remain in place.

Verification covers these revisions, not a merge with a newer main.

Fixes https://nvbugs/7163265

Dev Engineer Review

The test-only change forwards replay arguments and return values without constraining the evolving replay signature. It preserves replay counting. No production code changed.

QA Engineer Review

  • Modified one test file; no test-list files changed. Test functions, IDs, and waivers are unchanged.
  • The MoE LoRA eager and CUDA-graph cases cover native FP8 versus BF16 output, routed-expert LoRA, and replay counting. The author reports all four cases passed; this result is not independently verified.
  • The native FP8 cases are listed in H100 CI. Related routed-expert cases are also listed in manual QA.
  • Coverage verdict: sufficient.

Per-File QA Perspective

  • tests/integration/defs/llmapi/test_llm_api_pytorch_moe_lora.py: Covers MoE LoRA behavior in eager and CUDA-graph modes. The native FP8 cases are listed in CI; related routed-expert cases are listed in manual QA.

…test

PR NVIDIA#22370 (7a8a077) added
pre_replay_staged to CUDAGraphRunner.replay and its decoder callers.
Accept and forward that keyword in _run_paired_adapter_engine's replay
counter, preserving its instrumentation and the original replay behavior.

The existing test_qwen_moe_native_fp8_lora_matches_bf16_reference
cudagraph case covers this wrapper and asserts that LoRA replay occurs.

Fixes https://nvbugs/7163265

Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The CUDA-graph replay wrapper now accepts arbitrary positional and keyword arguments and forwards them unchanged to the original replay method. The test’s replay-counting behavior remains unchanged.

Changes

Replay argument forwarding

Layer / File(s) Summary
Update replay wrapper
tests/integration/defs/llmapi/test_llm_api_pytorch_moe_lora.py
counted_replay accepts arbitrary positional and keyword arguments and forwards them unchanged to original_replay. The test imports Any for the wrapper annotations.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Merge Risk: Minimal · up to 3ed1d

This is a test-only change that lets the replay-counting wrapper accept the replay arguments the CUDA graph runner now takes. Production code is untouched, and I found no merge-blocking risk.

Security architecture risk: Minimal · up to 3ed1d

The fix lets an existing integration test pass replay arguments through to the original method. It does not change production behavior or expose a new interface.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the NVBugs ID, the [fix] type, and the change: forwarding pre-replay staging in the MoE LoRA test. It matches the changeset, which updates the test's counted_replay wrapper to accept a…
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.
Description check Passed The description follows the repository template closely. It explains the change: the counted_replay wrapper in the MoE LoRA integration test now forwards all positional and keyword arguments, includin…
Full details: Title check

Explanation

The title names the NVBugs ID, the [fix] type, and the change: forwarding pre-replay staging in the MoE LoRA test. It matches the changeset, which updates the test's counted_replay wrapper to accept and forward pre_replay_staged. It follows the repository template format.

Full details: Description check

Explanation

The description follows the repository template closely. It explains the change: the counted_replay wrapper in the MoE LoRA integration test now forwards all positional and keyword arguments, including pre_replay_staged, to CUDAGraphRunner.replay. It gives the reason (PR #22370 added the keyword and the test wrapper rejected it), lists test coverage with the affected test cases, and reports before and after verification on H100 with commit hashes. It links the NVBugs ID (nvbugs/7163265). Minor gaps: the title format is not stated in the description, the PR Checklist is not marked, and the description does not mention API-label or documentation status. These gaps are non-critical because the change is test-only.

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 8c73e49 and 3ed1de4.

Files selected for processing: 1

  • tests/integration/defs/llmapi/test_llm_api_pytorch_moe_lora.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.

@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 updates the replay-counting wrapper in the MoE LoRA integration test to accept and forward the pre_replay_staged keyword that #22370 added to CUDAGraphRunner.replay, so the native FP8 [cudagraph] case no longer fails with TypeError.

Reviewed at commit 8c73e49dd6 (1 file, +7/−1).

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

Nice to have (2): 2 inline, 0 below
  • (N2: Test design and organization) counted_replay still hand-copies CUDAGraphRunner.replay's keywords, so the next keyword added there makes the FP8 [cudagraph] case fail with TypeError again (test_llm_api_pytorch_moe_lora.py:362)
  • (R3: Repository rules) The rewritten counted_replay signature has no type annotations, which CODING_GUIDELINES.md asks for on every function (test_llm_api_pytorch_moe_lora.py:356)
What this review checked
  • counted_replay now takes exactly the keyword-only parameters and defaults of CUDAGraphRunner.replay (tensorrt_llm/_torch/pyexecutor/cuda_graph_runner.py:1383-1391) and forwards all of them. Both decoder call sites pass only those keywords (tensorrt_llm/_torch/pyexecutor/engine/runners/decoder/graphs.py:828-850), and the signature is the same on current main.
  • Every other test stand-in for CUDAGraphRunner.replay already accepts pre_replay_staged or **kwargs: tests/integration/defs/kv_cache/test_final_single_token_context_cuda_graph.py:124-138, tests/unittest/_torch/pyexecutor/test_model_engine.py:110-115, tests/unittest/_torch/pyexecutor/test_cuda_graph_skip_warmup_pass.py:127 and the T5 and BART decoder wrappers. This wrapper was the last one #22370 left behind.
  • The fixed case runs where it is listed: tests/integration/test_lists/test-db/l0_h100.yml:409 has it in the single-GPU H100 post-merge block, its supports_native_fp8_lora gate is true on SM90 (cpp/tensorrt_llm/kernels/groupGemm.cu:51-55), and no waive names it or nvbugs/7163265.
  • Not covered: No GPU run: the before and after H100 results in the description were not reproduced.
  • Not covered: No CI result for the fixed case: it runs only in the post-merge H100 stages.

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.

…counter

Forward replay arguments and the return value unchanged instead of copying CUDAGraphRunner.replay's evolving signature. Keep the existing replay-count instrumentation and annotate the wrapper. The existing native FP8 CUDA-graph integration case exercises this counter.

Fixes https://nvbugs/7163265

Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
@trtllm-agent

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #87833 [ run ] triggered by Bot. Commit: 3ed1de4 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #87833 [ run ] completed with state DISABLED
The CI pipeline is currently frozen to deploy an urgent hotfix. For time-sensitive requests, please contact @trt-llm-infra-devs.

Link to invocation

@ziyixiong-nv

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #87842 [ run ] triggered by Bot. Commit: 3ed1de4 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #87842 [ run ] completed with state DISABLED
The CI pipeline is currently frozen to deploy an urgent hotfix. For time-sensitive requests, please contact @trt-llm-infra-devs.

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.

4 participants