Skip to content

Support latest PyTorch RNG state API. - #8

Merged
shoeybi merged 1 commit into
NVIDIA:masterfrom
jaredcasper:random
Sep 12, 2019
Merged

Support latest PyTorch RNG state API.#8
shoeybi merged 1 commit into
NVIDIA:masterfrom
jaredcasper:random

Conversation

@jaredcasper

Copy link
Copy Markdown
Contributor

Fixes #7.

@shoeybi

shoeybi commented Sep 12, 2019

Copy link
Copy Markdown
Contributor

LGTM.

@shoeybi
shoeybi merged commit 2ef2367 into NVIDIA:master Sep 12, 2019
@jaredcasper
jaredcasper deleted the random branch September 12, 2019 03:18
shjwudp referenced this pull request in shjwudp/Megatron-LM Apr 18, 2022
shjwudp referenced this pull request in shjwudp/Megatron-LM Jan 6, 2025
Merge #7 into branch and fix some bugs
dhia680 pushed a commit to dhia680/Megatron-LM that referenced this pull request Feb 10, 2025
liuzhenhai93 pushed a commit to liuzhenhai93/Megatron-LM that referenced this pull request Mar 11, 2025
…_chunk_poc

Revert "Liuzhenhai xhs whole chunk 1f1b poc"
lyuwen added a commit to lyuwen/Megatron-LM that referenced this pull request Sep 11, 2025
merge with upstream NVIDIA/Megatron-LM
shjwudp referenced this pull request in shjwudp/Megatron-LM Nov 12, 2025
copy-pr-bot Bot pushed a commit that referenced this pull request Dec 17, 2025
…dec17

Fix API Backward Compatibility ISSUE
guapisolo pushed a commit to guapisolo/Megatron-LM that referenced this pull request Feb 19, 2026
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request May 4, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request May 4, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request May 6, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request May 7, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request May 11, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request May 14, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request May 18, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
yangbofun pushed a commit to xlm-research/Megatron-LM that referenced this pull request May 22, 2026
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request Jun 12, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request Jun 12, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Yan Xu <yxu1@nvidia.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request Jul 14, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Yan Xu <yxu1@nvidia.com>
lauradang pushed a commit to lauradang/Megatron-LM that referenced this pull request Jul 27, 2026
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request Aug 13, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Yan Xu <yxu1@nvidia.com>
Connor-XY added a commit to Connor-XY/Megatron-LM that referenced this pull request Aug 17, 2026
Resolves all eleven comments on the PR thread:

* Rename CheckpointManager → CheckpointWithoutOutputManager and update
  the docstring; the class strictly manages CheckpointWithoutOutput
  instances, so the new name avoids the broader "checkpoint" overloading.
  Updates all importers and tests. (#1)
* Document why subtracting the per-row max in SinkhornKnopp.forward is
  benign — Sinkhorn's first row-normalization cancels any per-row
  scalar, so the shifted and unshifted exp produce the same fixed point
  and gradient. (NVIDIA#2)
* Use NotImplementedError for the mhc + fine_grained_activation_offloading
  block — it's a known unimplemented interaction, not a config error. (NVIDIA#3)
* Drop the new __call__ override and backward_dw_cudagraph from base
  TransformerLayer; the mHC kwarg extraction now lives on
  HyperConnectionTransformerLayer.__call__, with _mhc_recompute_manager
  initialized in __init__ so forward() reads it directly without a
  getattr fallback. cuda_graphs.py reads is_decode_only() directly,
  so dropping the dynamic_inference_decode_only injection is safe. (NVIDIA#4, NVIDIA#5, NVIDIA#10)
* Rename the FineGrainedActivationOffloadingInterface alias
  off_interface → offload_interface in transformer_layer.py for clarity. (NVIDIA#6)
* Extract a _run_mlp helper on TransformerLayer that owns the MLP-call
  branching (recompute / chunked-prefill / fp8-fp4 / plain-mlp); both
  base and HC _forward_mlp call it, eliminating the previous
  ~80-line duplication. The MoE-cudagraph early-return remains in base
  _forward_mlp after the helper call (HC is guarded against MoE). (NVIDIA#8)
* Raise NotImplementedError at HyperConnectionTransformerLayer.__init__
  when is_moe_layer is True and point users at HyperConnectionHybridLayer;
  drop the dead MoE branch in _get_submodules_under_cudagraphs. (NVIDIA#9)
* No code change for the MoE composition / extensibility comment (NVIDIA#7) —
  see the PR thread reply for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Yan Xu <yxu1@nvidia.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.

PyTorch 1.2 support?

2 participants