Repository navigation
Upgrade spmd_types to main - #5131
Conversation
[ghstack-poisoned]
* Pin spmd_types to a main commit instead of the 0.2.5 release. It includes the fixes torch_remat activation checkpointing needs under tensor parallelism: metadata queries such as `stride()` and `storage_offset()` are no longer type checked, so saving a Partial region works, and `assert_type_like` / `assert_local_type_like` overrides keyed by a process group replace the source's entry for that axis instead of conflicting. * `_AuxLossInjection.spmd_typecheck` types its output with `rules.output` and declares `aux_loss`, which is only saved for backward, with `rules.ignore`, satisfying the new check that a hook accounts for every tensor argument. * spmd_types now ships type stubs: narrow a just-registered parameter or buffer before `assert_type`, and drop a `no_typecheck` suppression Pyrefly no longer needs. ghstack-source-id: 02fb3ee Pull-Request: pytorch/torchtitan#5131
| einops | ||
| pillow | ||
| spmd_types==0.2.5 | ||
| spmd_types @ git+https://github.com/meta-pytorch/spmd_types.git@8b8a56e79b117cfac3ed289fa209f8358558d482 |
There was a problem hiding this comment.
I was worried you'd have to add rules.ignore in a bunch of places, but if CI is fine should be fine...
|
@claude do we not have to do that (use |
|
Claude finished @pianpwk's task in 1m 56s —— View job AnswerNo. I checked every
None of these hooks takes the non-tensor "Using all inputs" in Caveats:
|
Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.15.0) (oldest at bottom): * #5102 * #5101 * __->__ #4893 * #5131 ---- Needs https://www.internalfb.com/diff/D123762808 This moves SelectiveAC to use torch remat. In future, we want to get rid of SelectiveAC as well and just have one RegionAC (or a better name) with possibly some good defaults for models. Currently, we keep the `SelectiveAC` name because its used at many places and there is some future work to remove it entirely. * SelectiveAC is now a fixed torch_remat policy: it saves every model-declared region except the routed-expert `w13`/`w2` grouped matmuls, and recomputes everything else. It shares the `_RematAC` base with RegionAC, which stays the way to choose a different policy; SelectiveAC can no longer be subclassed. * The operator-level save policy and `force_recompute_mm_shapes_by_fqns` are removed. The graph trainer keeps its own copy of the operator save set. * `configure_remat_regions` gains `save_all_except`, which SelectiveAC uses: it suits starting from no AC and recomputing only a few regions. * FullAC is unchanged and still uses PyTorch checkpointing. * The SAC + FlexInnerAttention restriction under SPMD typechecking is removed. <img width="1933" height="833" alt="image" src="https://github.com/user-attachments/assets/5937fbba-5e72-45db-acad-e6602e8b2340" /> <img width="1939" height="844" alt="image" src="https://github.com/user-attachments/assets/f8932afb-5f9c-4fc9-8c95-d0046af341f8" />
* Pin spmd_types to a main commit instead of the 0.2.5 release. It includes the fixes torch_remat activation checkpointing needs under tensor parallelism: metadata queries such as `stride()` and `storage_offset()` are no longer type checked, so saving a Partial region works, and `assert_type_like` / `assert_local_type_like` overrides keyed by a process group replace the source's entry for that axis instead of conflicting. * `_AuxLossInjection.spmd_typecheck` types its output with `rules.output` and declares `aux_loss`, which is only saved for backward, with `rules.ignore`, satisfying the new check that a hook accounts for every tensor argument. * spmd_types now ships type stubs: narrow a just-registered parameter or buffer before `assert_type`, and drop a `no_typecheck` suppression Pyrefly no longer needs. ghstack-source-id: 02fb3ee Pull-Request: pytorch/torchtitan#5131
Stack from ghstack (oldest at bottom):
the fixes torch_remat activation checkpointing needs under tensor
parallelism: metadata queries such as
stride()andstorage_offset()areno longer type checked, so saving a Partial region works, and
assert_type_like/assert_local_type_likeoverrides keyed by a processgroup replace the source's entry for that axis instead of conflicting.
_AuxLossInjection.spmd_typechecktypes its output withrules.outputand declares
aux_loss, which is only saved for backward, withrules.ignore, satisfying the new check that a hook accounts for everytensor argument.
buffer before
assert_type, and drop ano_typechecksuppression Pyreflyno longer needs.