Skip to content

[DO NOT MERGE][dev] moe(perf): Fuse pre-gated delta net ops.#4842

Draft
yuzhongw-nvidia wants to merge 10 commits into
NVIDIA:devfrom
yuzhongw-nvidia:yuzhongw/gdn_conv_fusion
Draft

[DO NOT MERGE][dev] moe(perf): Fuse pre-gated delta net ops.#4842
yuzhongw-nvidia wants to merge 10 commits into
NVIDIA:devfrom
yuzhongw-nvidia:yuzhongw/gdn_conv_fusion

Conversation

@yuzhongw-nvidia

Copy link
Copy Markdown
Contributor

What does this PR do ?

⚠️ For major changes (either in lines of code or in its impact), please make sure to first share a design doc with the team. If you're unsure what's the best way to do so, contact the @mcore-oncall.

Issue tracking

For PRs from open-source community contributors:

  • New features: a linked issue is required. Please open a feature request and reference it here before submitting the PR.
  • Small updates (bug fixes, minor improvements): a linked issue is recommended and will accelerate the PR review process.

Linked issue:

Contribution process

Pre-checks

  • I have added relevant unit tests
  • I have added relevant functional tests
  • I have added proper typing to my code Typing guidelines
  • I have added relevant documentation
  • I have run the autoformatter.sh on my PR

Code review

Feel free to message or comment the @mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!

All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.

Step 1: Mark PR as "Ready for Review"

  1. When your PR is ready, click Ready for Review.
  2. An oncall reviewer is auto-assigned and expert reviewers are notified based on your changes.
    • Some PRs may jump straight to step 2. This is determined by .github/CODEOWNERS.

⚠️ Only mark as ready once merge-conflicts are resolved and the CI is passing.
Final Review might get declined if these requirements are not fulfilled.

Step 2: Final Review

For PRs that change megatron/core, once all expert reviewers have approved, the Final Review label is applied automatically and final reviewers are assigned.

For PRs outside megatron/core, this step is skipped.

Step 3: Approved

Once all required reviewers have approved, the Approved label is applied automatically.

Merge

Any member of mcore-engineers will be able to merge your PR.

For MRs into `dev` branch The proposed review process for `dev` branch is under active discussion.

MRs are mergable after one approval by either eharper@nvidia.com or zijiey@nvidia.com.

@copy-pr-bot

copy-pr-bot Bot commented May 18, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yuzhongw-nvidia yuzhongw-nvidia changed the title [dev] moe(perf): Fuse pre-gated delta net ops. [DO NOT MERGE][dev] moe(perf): Fuse pre-gated delta net ops. May 18, 2026
@yuzhongw-nvidia yuzhongw-nvidia force-pushed the yuzhongw/gdn_conv_fusion branch 5 times, most recently from f8fb53d to 5b54bc1 Compare May 28, 2026 07:00
@yuzhongw-nvidia yuzhongw-nvidia force-pushed the yuzhongw/gdn_conv_fusion branch 2 times, most recently from e11dc9e to f30e6dc Compare June 1, 2026 09:52
yuzhongw-nvidia and others added 10 commits June 2, 2026 11:09
Replace the placeholder with the all-in-one ("mega") pre-GDR path:

- Forward: a single Triton launch over a flat logical task space
  (QK conv+silu+l2norm+repeat, V conv+silu, Z copy, g/beta), supporting
  dense BSHD and packed THD. Replaces the streamed path's four launches.
- Backward: one fused branch kernel (QK l2norm/repeat, V layout, Z layout,
  g/beta chain rule; per-head d_A_log/d_dt_bias via atomics) plus the
  external causal_conv1d backward for conv input/weight gradients. Two
  launches, down from five.

Outputs and saved tensors match the streamed path bit-for-bit, so the
public (query, key, value, gate, beta, g) contract and parity are preserved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The pre_gated_delta_rule_impl selector is already exposed as a CLI arg by
ArgumentGroupFactory(TransformerConfig), which auto-derives --pre-gated-delta-rule-impl
from the dataclass field. Registering it manually raised an argparse
"conflicting option string" error at parse time, so only a clarifying comment
is kept. Recipes / passthrough can set the impl via the auto-generated arg.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant