pytorch / pytorch/executorch

[Core ML] Avoid unnecessary portable-kernel linkage from coremldelegate

Open
#22,684 0 comments 0 reactions 1 assignee View on GitHub

@metascroy is already working on this.

Since Sep 10, 2026.

bug module: build/install module: coreml
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

Problem

The Core ML CMake target links portable_ops_lib and portable_kernels privately when the standalone runner option is enabled. The standalone Xcode runner already links those archives itself, while other Core ML consumers should not pull in a second operator registry.

A proposed switch from link edges to build dependencies surfaced another requirement: add_dependencies fails when portable operators are disabled unless both targets are guarded. This was found during the source-build validation for #22620 and is intentionally excluded from that documentation-only PR.

Proposed change

Use build-order dependencies instead of private linkage where appropriate, guarded with TARGET portable_ops_lib and TARGET portable_kernels.

Test plan
  • Configure the macOS preset with Core ML enabled and portable operators disabled.
  • Build the Core ML runner configuration with portable operators enabled.
  • Run Core ML model and operator CI.

cc @larryliu0820 @GregoryComer @kimishpatel @YifanShenSZ @cymbalrush @metascroy

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.