Skip to content

Conversation

@metascroy
Copy link
Contributor

@metascroy metascroy commented Aug 22, 2025

Summary

This adds enumerated shape support for ExecuTorch's CoreML backend.

The CoreML backend supports dynamic shapes for the CPU/GPU. This enables enumerated shapes to support limit dynamism on the ANE.

These are done via compile specs:

enumerated_shapes = {"x": [[3, 5, 10], [4, 6, 10]], "y": [[3, 11], [5, 11]]}
...
compile_specs.append(
    CoreMLBackend.generate_enumerated_shapes_compile_spec(
        ep,
        enumerated_shapes,
    )
)
partitioner = CoreMLPartitioner(compile_specs=compile_specs, lower_full_graph=True)
delegated_program = executorch.exir.to_edge_transform_and_lower(
    ep,
    partitioner=[partitioner],
)

At runtime, one of the enumerated shapes must be supplied, or an error will occur.

Test plan

New E2E tests

@pytorch-bot
Copy link

pytorch-bot bot commented Aug 22, 2025

🔗 Helpful Links

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

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

❌ 4 New Failures

As of commit d562816 with merge base 3db27cd (image):

NEW FAILURES - The following jobs have failed:

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

@meta-cla meta-cla bot 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 22, 2025
@facebook-github-bot
Copy link
Contributor

@metascroy has imported this pull request. If you are a Meta employee, you can view this in D80848324.

@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copy link
Contributor

@cccclai cccclai left a comment

Choose a reason for hiding this comment

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

LGTM

@facebook-github-bot
Copy link
Contributor

@metascroy has imported this pull request. If you are a Meta employee, you can view this in D80848324.

@facebook-github-bot
Copy link
Contributor

@metascroy has imported this pull request. If you are a Meta employee, you can view this in D80848324.

@metascroy metascroy merged commit bda3142 into main Aug 27, 2025
247 of 252 checks passed
@metascroy metascroy deleted the enumerated-shape branch August 27, 2025 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants