Repository navigation
feat: make SAC matmul recompute frequency configurable - #8
Closed
samansg-aws wants to merge 1 commit into
Closed
samansg-aws wants to merge 1 commit into
samansg-aws wants to merge 1 commit into
Conversation
samansg-aws
force-pushed
the
samansg/sac-matmul-recompute-freq
branch
from
October 7, 2026 18:44
341a33b to
5dc5986
Compare
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.
Issue #, if available: n/a
Description of changes:
SelectiveAChardcodes "recompute every second matmul" (meta[mm_count_key] % 2 == 0),which is the only memory/compute tradeoff per-op SAC exposes.
force_recompute_mm_shapes_by_fqnscan only push more matmuls intorecomputation, never fewer, so there is no way to say "save all the matmuls".
Adds one field to
SelectiveAC.Config:matmul_recompute_freq: int = 2-- recompute one matmul out of everyn.2(default) reduces to the old predicate, so existing configs are bit-identical.1recomputes every matmul;0saves every matmul; negative raisesValueError.force_recompute_mm_shapes_by_fqnsare still alwaysrecomputed, so the two knobs compose as before.
Tests in
tests/unit_tests/gpu/test_activation_checkpoint.pycountaten.mmcalls per weight during backward (same technique as
test_force_recompute_mm_fqns)for
freqin {0, 1, 2, 3}, plus theValueErrorcase.pre-commit run --filespasses on both changed files.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.