Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate CoreML util and inmemoryfs targets to be reusable #9481

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jathu
Copy link
Contributor

@jathu jathu commented Mar 21, 2025

Summary

In this diff, we separate the targets for coreml/runtime/util and coreml/runtime/inmemoryfs.

Why?

As part of #9019, we want to support CoreML export out-of-the-box. Unfortunately, part of the workflow now includes installing an executorch+coreml binding as a pip wheel:

pip install "$COREML_DIR_PATH/runtime/inmemoryfs"

This then gets used throughout the library. i.e.

So we want to now bake this pybinding into the main wheel. Ultimately this executorchcoreml module, gets built using inmemoryfs:

ext_modules = [
Pybind11Extension(
"executorchcoreml",
[
"../util/json_util.cpp",
"inmemory_filesystem.cpp",
"inmemory_filesystem_py.cpp",
"inmemory_filesystem_utils.cpp",
"memory_buffer.cpp",
"memory_stream.cpp",
"reversed_memory_stream.cpp",
],
define_macros=[("VERSION_INFO", __version__)],
cxx_std=cxx_std,
extra_compile_args=["-mmacosx-version-min=10.15", "-g"],
include_dirs=[
"../../third-party/nlohmann_json/single_include",
".",
"../util",
],
),
]

So, to enable creating a pybinding target, we must first decouple the util and inmemoryfs libraries so they can be used in coremldelegate and the future pybinding.

Test plan

This should really be a no-op w.r.t. builds. So, CI +

$ ./install_executorch.sh --pybind coreml

cc @larryliu0820 @lucylq

Copy link

pytorch-bot bot commented Mar 21, 2025

🔗 Helpful Links

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

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

❌ 7 New Failures, 1 Cancelled Job

As of commit 3172a23 with merge base 76ae537 (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

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

@facebook-github-bot facebook-github-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 Mar 21, 2025
@jathu jathu added module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch ciflow/trunk topic: not user facing labels Mar 21, 2025
@jathu jathu marked this pull request as ready for review March 21, 2025 00:49
Copy link
Contributor

@mergennachin mergennachin left a comment

Choose a reason for hiding this comment

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

See inline comments

@jathu jathu force-pushed the jathu/split-coreml branch 2 times, most recently from 1f3966d to 05b129a Compare March 21, 2025 14:52
@jathu jathu force-pushed the jathu/split-coreml branch 4 times, most recently from d9f8ff5 to 639128b Compare March 21, 2025 19:11
@jathu jathu requested a review from mergennachin March 21, 2025 19:11
@jathu jathu force-pushed the jathu/split-coreml branch from 639128b to 7f6cdc3 Compare March 21, 2025 19:13
@jathu jathu marked this pull request as draft March 21, 2025 19:32
@jathu jathu force-pushed the jathu/split-coreml branch from 7f6cdc3 to a03a108 Compare March 21, 2025 19:41
@jathu jathu force-pushed the jathu/split-coreml branch 7 times, most recently from b984672 to 73e3388 Compare March 22, 2025 00:37
@jathu jathu force-pushed the jathu/split-coreml branch from 73e3388 to c052251 Compare March 22, 2025 22:42
@jathu jathu force-pushed the jathu/split-coreml branch from c052251 to 3172a23 Compare March 23, 2025 04:42
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. module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants