Commit 9e69b6f
Add MLX op handler for aten.isinf (#18988)
Good day
## Summary
This PR adds a decomposed MLX op handler for `aten.isinf` to the
pytorch/executorch project.
### Motivation
The MLX delegate converts PyTorch aten ops into MLX graph nodes during
export. When an aten op has no handler, it falls back to CPU execution,
breaking the GPU acceleration pipeline. Adding a handler for
`aten.isinf` enables it to run on Metal GPU via MLX.
### Implementation
The handler uses a decomposed approach:
```python
isinf(x) = abs(x) == inf
```
This uses existing `AbsNode` and `EqualNode` which are already
supported, avoiding the need for a dedicated MLX isinf op.
### Changes
- **backends/mlx/ops.py**: Added `_isinf_handler` function registered
for `torch.ops.aten.isinf.default`
- **backends/mlx/test/test_ops.py**: Added `isinf` to `_UNARY_OP_TESTS`
with standard test configuration
### Testing
The handler can be tested with:
```bash
python -m executorch.backends.mlx.test.run_all_tests -k isinf
```
Thank you for your attention. If there are any issues or suggestions,
please leave a comment and I will address them promptly.
Warmly,
RoomWithOutRoof
Co-authored-by: Scott Roy <161522778+metascroy@users.noreply.github.com>1 parent 63b2b5c commit 9e69b6f
2 files changed
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
669 | 704 | | |
670 | 705 | | |
671 | 706 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4737 | 4737 | | |
4738 | 4738 | | |
4739 | 4739 | | |
| 4740 | + | |
| 4741 | + | |
| 4742 | + | |
| 4743 | + | |
| 4744 | + | |
| 4745 | + | |
| 4746 | + | |
| 4747 | + | |
| 4748 | + | |
| 4749 | + | |
| 4750 | + | |
| 4751 | + | |
| 4752 | + | |
| 4753 | + | |
| 4754 | + | |
4740 | 4755 | | |
4741 | 4756 | | |
4742 | 4757 | | |
| |||
4830 | 4845 | | |
4831 | 4846 | | |
4832 | 4847 | | |
| 4848 | + | |
4833 | 4849 | | |
4834 | 4850 | | |
4835 | 4851 | | |
| |||
0 commit comments