Skip to content

feat(gdn): Pass GDN kernel backend to Mcore - #3995

Closed
vasunvidia wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
vasunvidia:vrengasamy/te_gdn_attention
Closed

vasunvidia wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
vasunvidia:vrengasamy/te_gdn_attention

Conversation

@vasunvidia

Copy link
Copy Markdown

What does this PR do ?

Add a one line overview of what this PR aims to accomplish.

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

  • ...

@vasunvidia
vasunvidia requested a review from a team as a code owner September 4, 2026 09:28
@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 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.

Signed-off-by: Vasudevan Rengasamy <vrengasamy@nvidia.com>
@vasunvidia
vasunvidia force-pushed the vrengasamy/te_gdn_attention branch from 9f18ce0 to c6daa54 Compare September 4, 2026 16:20
@vasunvidia vasunvidia changed the title Add gdn_kernel_backend knob feat(gdn): Pass GDN kernel backend to Mcore Sep 4, 2026
@jepio jepio added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Sep 4, 2026

@jepio jepio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed by a team of specialized agents (rl-expert, bug-finder, test-agent, design-reviewer, devil's-advocate).

One finding below, refined with the author's context: this PR intentionally lands the gdn_kernel_backend passthrough ahead of a scheduled Megatron-core pin bump, to avoid coupling this change to that bump's stricter testing/schedule.

Generated by Claude Code

# so the canonical expanded-sequence contract must use backend dispatch.
attention_backend = config["megatron_cfg"].get("attention_backend")
if "gdn_kernel_backend" in config["megatron_cfg"]:
model_cfg.gdn_kernel_backend = config["megatron_cfg"]["gdn_kernel_backend"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nemo_rl/models/megatron/setup.py:1124-1125

1 action item.

model_cfg.gdn_kernel_backend = ... sets an attribute that doesn't exist on TransformerConfig at the currently pinned Megatron-LM SHA (731b7914) — confirmed via grep across both submodules (zero other hits) and reading the GDN dispatch logic (gdn.py#L57-L60, gdn2.py#L98-L101), which is driven solely by deterministic_mode, not a kernel-backend field. Since TransformerConfig is a plain, non-slotted dataclass, this succeeds silently rather than erroring.

This is presumably intentional prep for a separate, upcoming Megatron-core pin bump that introduces the real field — landing the plumbing early avoids coupling this PR to that bump's stricter testing/schedule, which is reasonable. But nothing in the PR currently signals that sequencing to a reviewer.

Action: Update the PR description to state this is staging for the upcoming Megatron-core pin bump (link the tracking issue/PR if one exists) and that gdn_kernel_backend is inert until then. Once the pin bump lands, follow up with: gdn_kernel_backend: NotRequired[str] on MegatronConfig (nemo_rl/models/policy/__init__.py:329-380), exemplar YAML docs, and a present/omitted unit test pair mirroring the existing cuda_graph_modules tests in tests/unit/models/megatron/test_megatron_setup.py.

@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

/ok to test

@jepio, there was an error processing your request: E1

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/

@jepio

jepio commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

/ok to test c6daa54

@yuki-97 yuki-97 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except @jepio 's existing comment. also need a rebase since behind main a lot.

@vasunvidia

Copy link
Copy Markdown
Author

This is not required for MLPerf because #3535 is merged and can be used to enable new features.

@vasunvidia vasunvidia closed this Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants