Add MLX handler for aten.flip#19609
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19609
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 12 Awaiting Approval, 1 New FailureAs of commit 5496e64 with merge base d8e4ffd ( AWAITING APPROVAL - The following workflows need approval before CI can run:
NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @mzl2233! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Adds MLX delegate support for aten.flip by lowering flips into reverse SliceNode operations and adds op tests covering several flip dimension patterns.
Changes:
- Registers an MLX handler for
torch.ops.aten.flip.default. - Implements flip as chained reverse slices across requested dimensions.
- Adds MLX op-test coverage for 1-D, multi-dimensional, all-dimension, and negative-dimension flips.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
backends/mlx/ops.py |
Adds the aten.flip MLX op handler using reverse slicing. |
backends/mlx/test/test_ops.py |
Adds FlipModel and FlipTest configurations for MLX op validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| dim_str = ",".join(str(d) for d in dims) | ||
| self.name = f"flip_dim({dim_str})" |
| if len(set(d % ndim for d in dims)) != len(dims): | ||
| raise ValueError(f"aten.flip: dims must be unique, got {dims}") | ||
|
|
||
| out = P.make_or_get_slot(n) |
Summary:
Validation:
Fixes #18918