fix(mlx): forward boundary-partitioned getitem instead of indexing a Slot - #21441
Conversation
…Slot The MLX partitioner can place a getitem in a partition while leaving its multi-output parent (e.g. aten.native_layer_norm, common in DETR) outside it. In that case _getitem_handler receives the already-selected element as a single boundary-input Slot, not the source tuple, so a[idx] raised "Slot object is not subscriptable" and aborted the export. Forward the Slot directly when it isn't a tuple/list. Unblocks transformer/layer-norm models (RF-DETR) through the MLX delegate.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21441
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 2dfbd10 with merge base d632341 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @msluszniak! 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! |
|
|
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thanks for the PR, @msluszniak. Waiting for CI to run; meanwhile could you sort out EasyCLA? |
|
@nil-is-all CLA signed ;) |
|
@claude review this code |
|
I'll analyze this and get back to you. |
|
Claude review fails because my branch has |
|
@claude review this code |
|
I'll analyze this and get back to you. |
|
|
|
Thanks for the fix @msluszniak! |

Summary
The MLX partitioner can place an
operator.getiteminside a partition while leaving its multi-output parent (e.g.aten.native_layer_norm) outside it. In that case_getitem_handlerreceives the already-selected element as a single boundary-inputSlotrather than the source tuple, soa[idx]raises'Slot' object is not subscriptableand aborts the export.This fix forwards the
Slotdirectly when the resolved arg isn't a tuple/list — the partitioner has already fed the selected element as the partition input.Impact
Unblocks transformer / layer-norm-heavy models (e.g. RF-DETR) through the MLX delegate. Localized, one-file change to the op handler; no schema/serialization change.
Test plan
native_layer_normops) lower and run correctly on device through the MLX delegate with this change.a[idx]still selects the element.cc @metascroy