Fix missing shapes argument in DistributedIRFFT2 gather - #1963
Open
Anai-Guo wants to merge 1 commit into
Open
Conversation
`conj_pad_helper_2d` called `gather_from_parallel_region` without the
required `shapes` argument, raising a TypeError on every
`DistributedIRFFT2.forward` call. Pass `shapes=None`, which
`all_gather_v_wrapper` documents as "assume equal shape on all ranks" --
matching the class docstring ("chunks of equal size") and the paired
`scatter_to_parallel_region` call on the following line.
Signed-off-by: Anai-Guo <antai12232931@outlook.com>
Contributor
CODEOWNERS review mapCurrent for commit ⏳ @coreyjadams — 1 file(s)
⏳ @negin513 — 1 file(s)
No CODEOWNER
Comment |
Contributor
Greptile SummaryAdds the required
Important Files Changed
Reviews (1): Last reviewed commit: "fix: pass missing `shapes` argument in D..." | Re-trigger Greptile |
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.
PhysicsNeMo Pull Request
Description
conj_pad_helper_2dinphysicsnemo/distributed/fft.pycallsgather_from_parallel_regionwithout the requiredshapesargument:but the helper is defined in
physicsnemo/distributed/mappings.pyasshapesis positional-and-required and there is no**kwargs, so this raisesconj_pad_helper_2dis reached fromDistributedIRFFT2.forward(fft.py:191),so every
DistributedIRFFT2forward pass fails. The failure happens atargument-binding time, before any collective is issued, so it is not
GPU/rank-count dependent.
This is the only one of the five
gather_from_parallel_regioncall sites thatomits
shapes— the other four all pass it:shapes?models/afno/distributed/afno.py:201shapes=scatter_shapesmodels/afno/distributed/layers.py:226shapes=self.gather_shapesmodels/afno/distributed/layers.py:353shapes=self.in_shapesmodels/afno/distributed/layers.py:631shapes=gather_shapesdistributed/fft.py:41Why
shapes=Noneshapes=Noneis explicitly supported and means "assume equal shape on allranks" (
all_gather_v_wrapperindistributed/utils.py, whose ownsizesparameter defaults to
None). That is the right value here:DistributedRFFT2andDistributedIRFFT2document their contract as"a single global tensor which is distributed along a specified dimension
into chunks of equal size".
scatter_to_parallel_region(tensor_pad_gather, dim=other_dim, group="spatial_parallel")three statements later, which takes no
shapesand splits evenly — so aneven gather is what keeps the round trip symmetric.
The change is therefore behaviour-preserving relative to the documented intent;
it only makes the call actually bind.
Verification
Since these paths are
# pragma: no coverand need a multi-rank job, I verifiedby replaying the real signature against the real call site with
inspect.Signature.bind(AST-extracted from the unmodified sources, so nohand-copying):
ruff check/ruff format --check(v0.12.5, the pinned pre-commit version)pass on the changed file.
Checklist
Dependencies
None.
🤖 Generated with Claude Code