Enable selective recompute for norm_out in GDN layers #4715
Draft
xuantengh wants to merge 1 commit into
Draft
Conversation
Author
|
/claude review |
Comment on lines
+428
to
+442
| if self.recompute_norm_out: | ||
| self.norm_out_checkpoint = tensor_parallel.CheckpointWithoutOutput() | ||
| norm_out = self.norm_out_checkpoint.checkpoint( | ||
| self._run_gated_norm_and_a2a, core_attn_out, gate | ||
| ) | ||
| else: | ||
| norm_out = self._run_gated_norm_and_a2a(core_attn_out, gate) | ||
|
|
||
| # Output projection | ||
| nvtx_range_push(suffix="out_proj") | ||
| out, out_bias = self.out_proj(norm_out) | ||
| nvtx_range_pop(suffix="out_proj") | ||
|
|
||
| if self.recompute_norm_out: | ||
| self.norm_out_checkpoint.discard_output_and_register_recompute(out) |
Contributor
There was a problem hiding this comment.
Nit: Other recompute modules (mla_up_proj, layernorm, moe_act) have unit test coverage for the forward/backward pass with recompute enabled. Consider adding a test case in tests/unit_tests/ssm/test_gated_delta_net.py that sets recompute_granularity="selective" and recompute_modules=["gdn_norm_out"] and verifies the forward+backward pass produces correct gradients. This would help catch regressions if the CheckpointWithoutOutput contract changes.
Author
|
/ok to test cdaca66 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables the selective recompute for the gated norm step in GDN layers.
You may enable this by adding the following options via MBridge recipe:
The recompute module name may subject to change.