Skip to content

Export an MLX model for the iOS demo build - #22297

Merged
shoumikhin merged 1 commit into
mainfrom
ios-ci-mlx-export
Sep 1, 2026
Merged

Export an MLX model for the iOS demo build#22297
shoumikhin merged 1 commit into
mainfrom
ios-ci-mlx-export

Conversation

@shoumikhin

@shoumikhinshoumikhin commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Problem

The mv3 demo app is gaining an MLX option. Its Xcode project will bundle
mv3_mlx.pte, so the iOS CI job that stages models for the demo has to produce
that file, or the build fails on a missing resource.

Change

Lower the model to MLX inline, the same way the script already drives the
portable, Core ML and XNNPACK exports (there is no generic examples/ entry
point that takes a model name and lowers it to MLX). The same export is added to
both iOS scripts.

The check reads the delegates directly off the program and fails unless the model
produced an MLX delegate. The MLX partitioner only logs a warning when it
delegates nothing and still returns a valid program, so without this a model with
no MLX delegate would be staged under an MLX name and the demo would still pass on
the portable kernels. The check runs before the file is written.

Landing order

This change must land first. It produces mv3_mlx.pte; the demo change consumes
it. The scripts clone the demo's default branch, so if the demo landed first its
project would require a model this script does not yet produce and the iOS build
would break.

Test Plan

Ran the lowering and the delegate check against a delegated model: the count is 1
and the file is written; a non-delegated program gives 0 and the check fails
before writing anything. Runtime execution of the staged model is not exercised
here; delegate presence is.

CopilotAI lite review requested due to automatic review settings August 29, 2026 04:45
@pytorch-bot

pytorch-botBot commented Aug 29, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22297

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures, 1 Unclassified Failure

As of commit 037b6da with merge base 9b558d9 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-clameta-claBot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 29, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@shoumikhinshoumikhin added the release notes: none Do not include this in the release notes label Aug 29, 2026
CopilotAI review requested due to automatic review settings August 31, 2026 16:38

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The mv3 demo app is gaining an MLX option. Once its Xcode project bundles
mv3_mlx.pte, this job must produce that file or the build fails on a missing
resource. This change must land first: it creates the file, and the demo side
waits on it. If the demo landed first, its project would ask for a model this
script does not yet produce and the iOS build would break.
No generic examples/ entry point takes a model name and lowers it to MLX, so
lower it inline the same way the script drives the portable, Core ML and XNNPACK
exports. Do it in both iOS scripts, the way the MPS removal edited both together.
The check reads the delegates off the program object and fails unless the model
produced an MLX delegate. The partitioner only logs a warning when it delegates
nothing and still returns a valid program, so without this a model with no MLX
delegate would be staged under an MLX name and the demo would still pass on the
portable kernels. The check runs before the file is written, so a program with no
MLX delegate never lands next to the staged models.
The lowering skips dim order because every MLX export in this tree does; the
Core ML and XNNPACK exports skip it for their own backend reasons, which do not
carry over.
Test Plan:
Ran the lowering and the delegate check against a delegated model: the count is 1
and the file is written; a non-delegated program gives 0 and the check fails
before writing. Both scripts pass bash syntax and share one Python body.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@shoumikhin
shoumikhin merged commit 2b3a32d into mainSep 1, 2026
375 of 379 checks passed
@shoumikhin
shoumikhin deleted the ios-ci-mlx-export branch September 1, 2026 16:55
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.release notes: noneDo not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@shoumikhin@JakeStevens@pytorchbot