Skip to content

Merge GDN conv fusion (fused pre-gated-delta-rule kernels) - #13

Closed
wplf wants to merge 23 commits into
wplf:jinliangl/qwen35-vl-central-devfrom
yuzhongw-nvidia:yuzhongw/gdn_conv_fusion
Closed

Merge GDN conv fusion (fused pre-gated-delta-rule kernels)#13
wplf wants to merge 23 commits into
wplf:jinliangl/qwen35-vl-central-devfrom
yuzhongw-nvidia:yuzhongw/gdn_conv_fusion

Conversation

@wplf

@wplf wplf commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Merge yuzhongw/gdn_conv_fusion (from yuzhongw-nvidia/Megatron-LM) into jinliangl/qwen35-vl-central-dev.

Headline feature — fused pre-gated-delta-rule (GDN conv fusion)

  • megatron/core/fusions/fused_pre_gated_delta_rule.py (new, ~2.2k lines)
  • megatron/core/fusions/fused_mega_pre_gated_delta_rule.py (new, ~1.1k lines) — mega-fused forward + backward kernels
  • megatron/core/ssm/gated_delta_net.py — wire the fused pre-GDR path (incl. packed THD)
  • transformer_config.py + arguments.py--pre-gated-delta-rule-impl (auto-generated from config)
  • tests/unit_tests/ssm/test_gated_delta_net.py — packed fused GDN path tests

Scope note

The source branch diverged from this base at bd5c98f77 and is 23 commits ahead / 31 commits behind. Besides the GDN-fusion commits it also carries newer dev syncs (e.g. NVIDIA#4751 Qwen3.5-VL, NVIDIA#5018, NVIDIA#5051, NVIDIA#4894, NVIDIA#4908 …), so the base…head diff is large (~219 files). The two histories have diverged, so this merge may surface conflicts that need resolution before it can be merged.

🤖 Generated with Claude Code

HaochenYuan and others added 23 commits May 21, 2026 04:51
…ining (NVIDIA#4816)

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Signed-off-by: conver334 <conver334@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Philip Petrakian <ppetrakian@nvidia.com>
…ned backward (NVIDIA#4908)

Co-authored-by: Xin Yao <xiny@nvidia.com>
… Attention (NVIDIA#5018)

Co-authored-by: Yuzhong Wang <yuzhongw@nvidia.com>
Co-authored-by: BestJuly <19769279+BestJuly@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: oliver könig <okoenig@nvidia.com>
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>
@wplf

wplf commented Jun 3, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #14, which cherry-picks/squashes only Yuzhong Wang's GDN-fusion commits onto central-dev (dropping the unrelated dev syncs), integrates the fused dispatch into the existing gdn_qkv-recompute forward, and is verified green on GB200 (fused-vs-unfused parity + recompute regression). Closing this full-branch merge in favor of #14.

@wplf wplf closed this Jun 3, 2026
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.

10 participants