Repository navigation
[pat] Add coupled shared-axis pruning - #4985
Conversation
[ghstack-poisoned]
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4985
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 18 PendingAs of commit 795ef85 with merge base 7b0382e ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
[ghstack-poisoned]
|
@claude review |
|
Claude finished @lisjin's task in 2m 41s —— View job Review: coupled shared-axis pruning
I didn't find any correctness bugs. The core algorithm is sound. Squared norms are summed per shared index, then one top-k runs and the same I couldn't run the tests: the sandbox requires approval for pytest invocations. Suggestions below, most important first. 1.
|
| raise ValueError( | ||
| "CoupledMinSparsityConstraint requires every parameter to expose the same leading dimension." | ||
| ) | ||
| sq_norm = torch.linalg.vector_norm(view.float(), dim=1).square() |
There was a problem hiding this comment.
nit: Could we preserve float64 (also promote float16/bfloat16)? This currently downcasts all double precision
Select one shared channel mask across caller-defined tensor clusters, including nested composition after ordinary projection. Validate effective cluster settings and layouts before optimizer mutation, force the final mask before healing, and account final literal zeros once. Integrate the preceding constructor validations: coupled constraints remain supported in direct mode, missing coupled fields raise clear errors, and composed soft maps require latent mode. Adapted from qpat ebc76a1 (#57), preserving TorchAO-specific SVD and recursion fixes. Establish dense execution and a materializing DTensor reference, including uneven layouts, mesh-local redistribution, and cached subset-mesh nonparticipant metrics. This PR contains the coupled API, optimizer integration, and core correctness coverage; sharded acceleration is separated into the next PR. Test Plan: ```bash source ~/.ao/bin/activate OMP_NUM_THREADS=1 python -m pytest test/prototype/pat -q # 189 passed, 187 subtests passed in 40.33s ruff check --select F,I torchao/prototype/pat/optim/pruneopt.py torchao/prototype/pat/optim/prox_executor.py test/prototype/pat/test_pat_coupled_min_sparsity.py test/prototype/pat/test_pat_coupled_sharded_parity.py git diff --check ``` The complete stack passed after rebasing the coupled core and sharded acceleration onto the revised PR #4984. Tags: stack_created_with_devmate ghstack-source-id: 3239760 Pull-Request: #4985
[ghstack-poisoned]
[ghstack-poisoned]
Select one shared channel mask across caller-defined tensor clusters, including nested composition after ordinary projection. Validate effective cluster settings and layouts before optimizer mutation, force the final mask before healing, and account final literal zeros once. Integrate the preceding constructor validations: coupled constraints remain supported in direct mode, missing coupled fields raise clear errors, and composed soft maps require latent mode. Adapted from qpat ebc76a1 (#57), preserving TorchAO-specific SVD and recursion fixes. Establish dense execution and a materializing DTensor reference, including uneven layouts, mesh-local redistribution, and cached subset-mesh nonparticipant metrics. This PR contains the coupled API, optimizer integration, and core correctness coverage; sharded acceleration is separated into the next PR. Test Plan: ```bash source ~/.ao/bin/activate OMP_NUM_THREADS=1 python -m pytest test/prototype/pat -q # 189 passed, 187 subtests passed in 40.33s ruff check --select F,I torchao/prototype/pat/optim/pruneopt.py torchao/prototype/pat/optim/prox_executor.py test/prototype/pat/test_pat_coupled_min_sparsity.py test/prototype/pat/test_pat_coupled_sharded_parity.py git diff --check ``` The complete stack passed after rebasing the coupled core and sharded acceleration onto the revised PR #4984. Tags: stack_created_with_devmate ghstack-source-id: 3239760 Pull-Request: #4985
[ghstack-poisoned]
[ghstack-poisoned]
Select one shared channel mask across caller-defined tensor clusters, including nested composition after ordinary projection. Validate effective cluster settings and layouts before optimizer mutation, force the final mask before healing, and account final literal zeros once. Integrate the preceding constructor validations: coupled constraints remain supported in direct mode, missing coupled fields raise clear errors, and composed soft maps require latent mode. Adapted from qpat ebc76a1 (#57), preserving TorchAO-specific SVD and recursion fixes. Establish dense execution and a materializing DTensor reference, including uneven layouts, mesh-local redistribution, and cached subset-mesh nonparticipant metrics. This PR contains the coupled API, optimizer integration, and core correctness coverage; sharded acceleration is separated into the next PR. Test Plan: ```bash source ~/.ao/bin/activate OMP_NUM_THREADS=1 python -m pytest test/prototype/pat -q # 189 passed, 187 subtests passed in 40.33s ruff check --select F,I torchao/prototype/pat/optim/pruneopt.py torchao/prototype/pat/optim/prox_executor.py test/prototype/pat/test_pat_coupled_min_sparsity.py test/prototype/pat/test_pat_coupled_sharded_parity.py git diff --check ``` The complete stack passed after rebasing the coupled core and sharded acceleration onto the revised PR #4984. Tags: stack_created_with_devmate ghstack-source-id: 94b33ba Pull-Request: #4985
Select one shared channel mask across caller-defined tensor clusters, including nested composition after ordinary projection. Validate effective cluster settings and layouts before optimizer mutation, force the final mask before healing, and account final literal zeros once. Integrate the preceding constructor validations: coupled constraints remain supported in direct mode, missing coupled fields raise clear errors, and composed soft maps require latent mode. Adapted from qpat ebc76a1 (#57), preserving TorchAO-specific SVD and recursion fixes. Establish dense execution and a materializing DTensor reference, including uneven layouts, mesh-local redistribution, and cached subset-mesh nonparticipant metrics. This PR contains the coupled API, optimizer integration, and core correctness coverage; sharded acceleration is separated into the next PR. Test Plan: ```bash source ~/.ao/bin/activate OMP_NUM_THREADS=1 python -m pytest test/prototype/pat -q # 189 passed, 187 subtests passed in 40.33s ruff check --select F,I torchao/prototype/pat/optim/pruneopt.py torchao/prototype/pat/optim/prox_executor.py test/prototype/pat/test_pat_coupled_min_sparsity.py test/prototype/pat/test_pat_coupled_sharded_parity.py git diff --check ``` The complete stack passed after rebasing the coupled core and sharded acceleration onto the revised PR #4984. Tags: stack_created_with_devmate ghstack-source-id: 94b33ba Pull-Request: #4985
Stack from ghstack (oldest at bottom):
Select one shared channel mask across caller-defined tensor clusters, including nested composition after ordinary projection. Validate effective cluster settings and layouts before optimizer mutation, force the final mask before healing, and account final literal zeros once. Integrate the preceding constructor validations: coupled constraints remain supported in direct mode, missing coupled fields raise clear errors, and composed soft maps require latent mode. Adapted from qpat ebc76a1 (#57), preserving TorchAO-specific SVD and recursion fixes.
Establish dense execution and a materializing DTensor reference, including uneven layouts, mesh-local redistribution, and cached subset-mesh nonparticipant metrics. This PR contains the coupled API, optimizer integration, and core correctness coverage; sharded acceleration is separated into the next PR.
Test Plan:
The complete stack passed after rebasing the coupled core and sharded acceleration onto the revised PR #4984.
Tags: stack_created_with_devmate