Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions nemo_rl/models/megatron/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,8 @@ def _apply_performance_config(model_cfg: Any, config: PolicyConfig) -> None:
# Flash attention does not support the resulting padded multi-row layout,
# 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.

if (
getattr(model_cfg, "nemotron_omni_contract", None)
== _NEMOTRON_OMNI_EXPANDED_SEQUENCE_CONTRACT
Expand Down
Loading