Repository navigation
Conversation
|
Thanks @jinyouzhi, this is a nice speedup for the check I added in #8922, and falling back to the pairwise walk keeps the error messages exactly as they were. I checked it against master (b9100c5) by running both on the same 20,000 random single-rank maps. Each map tiles a 1-D to 3-D shard grid with random cuts, then sometimes changes one piece: shifting it, swapping two pieces' destinations, moving a destination by 1–3 elements, starting it at a random address so it wraps past a row or leaves the shard, or giving a size-1 axis an arbitrary stride. One small suggestion on the new test, not blocking: its second assertion monkeypatches LGTM. |
|
Thanks @Achyuthan-S for the differential run against master. Good point about the test: 06edb58 drops the |
78708fb to
b2ddefe
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Achyuthan-S
left a comment
There was a problem hiding this comment.
Re-checked at b2ddefe, merged with current master (8702b42). The new test asserts the contract now, and both of its mutation checks reproduce here: a sweep that always reports "disjoint" fails 48 of the 200 seeds, and forcing the pairwise walk passes all 200.
On 20,000 random single-rank maps (1-D to 3-D grids with shifted, swapped, nudged or wrapping destinations, arbitrary strides on size-1 axes, and non-box views), validate() gives master's outcome on every map, error text included. 5,449 of them reach the sweep, and 1,722 of those overlap and go through the pairwise walk. All eight affine test files pass on CPU with 4 ranks (906 passed).
This and #9052 touch the same import line and __all__ in affine_geometry.py; if this lands first, I'll rebase #9052 on top.
LGTM.
b2ddefe to
b06a4c8
Compare
|
Thanks! @Achyuthan-S |
ParamAffineMap._validate_destinations compared every box-shaped piece of a rank with every other one, and validate() runs whenever a ZeRO, AutoEP or block-gather map is built. Sweep the boxes with boxes_disjoint first; only a rank that fails the sweep takes the pairwise walk, which names the shared address, so error messages are unchanged. Validating 2048 interleaved column pieces per rank drops from 6.7 s to 68 ms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
_dest_box() now returns a LogicalBox built with coordinate(), so _validate_destinations() hands boxes straight to boxes_disjoint() and names a shared address from box.intersection() and dot(). The hand-written _first_shared_address() and divmod loop are gone. address_range() and overlaps_itself() move to affine_geometry. The transfer executor reuses address_range() for its buffer-reach check and dot() for chunk offsets. Error messages and behavior are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
The randomized destination test monkeypatched affine.boxes_disjoint to compare the sweep with the pairwise walk, which ties it to that helper. Check the contract instead: a refusal names an address the map writes twice. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
Rebased on master (PRs #9010 and #9011 have merged; this branch is rebased on master at
5dc44e8, so the diff contains only this PR's changes).ParamAffineMap._validate_destinations(added in #8922) checks the box-shaped pieces of a column split by comparing every box of a rank with every other one.validate()runs whenever a ZeRO, AutoEP or block-gather map is built and before every conversion, and this pass has no budget, so validation grows quadratically with the number of strided pieces per rank.This PR sweeps the boxes with
boxes_disjointfrom #9011 first. Only a rank that fails the sweep takes the pairwise walk, which names the shared shard address, so error messages are unchanged.The second commit moves the remaining hand-written geometry onto
affine_geometry:_dest_boxreturns aLogicalBoxbuilt withcoordinate(), the shared address comes fromintersection()anddot(), andaddress_range()/overlaps_itself()move there fromaffine.py. The transfer executor reusesaddress_range()for its buffer-reach check anddot()for chunk offsets. No behavior or message changes.validate()of 8 ranks with interleaved columns (64 rows; ms, single CPU process):Tests:
validate()refuses exactly the maps whose pieces write some shard address twice (enumerated independently in the test), and every refusal names an address that is written twice. The test checks this contract only, so it does not depend on which helper does the sweep.tests/unit/checkpoint/test_*affine*files: 839 passed, 1 skipped on 4× NVIDIA L20 at f6e1f6c. At ac3a329 on CPU (DS_ACCELERATOR=cpu, 4 ranks): 842 passed, 5 skipped.AI assistance
Implementation, tests and this description were drafted with GitHub Copilot CLI and reviewed/validated by the author.