Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23391
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 7 Pending, 1 Unclassified FailureAs of commit 756e906 with merge base 0b3d26d ( NEW FAILURE - The following job has 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. |
Summary: Add the private bridge between ExecuTorch's Objective-C++ code and the Swift `CoreAI` framework, and package it for CMake consumers. No ExecuTorch delegate is added yet; a later commit wires this bridge into `CoreAIBackend`. - `runtime/ETCoreAIBridge.h`: Objective-C protocols for model acquisition, prepared models, sessions and tensor transfer, plus availability, device architecture and loader factory entry points. - `runtime/ETCoreAIModel.swift` (module `CoreAIBridge`): restore models from bookmarks, specialize source bundles with the persistent default SDK cache, bind named functions with ordered inputs/outputs and evict cache entries. Asynchronous SDK calls run in detached tasks and report through completion blocks; function binding completes synchronously. Only an SDK nil result is a cache miss; thrown errors keep their underlying cause. - Inputs are borrowed from caller storage through Core AI raw views; only shape metadata is copied. Outputs use one `memcpy` for dense row-major arrays and fall back to strided copies otherwise. - `runtime/ETCoreAITensor.mm`, `runtime/coreai_bridge.mm`: tensor wrappers and the C entry points. They build as the private `coreai_bridge_obj` object library so the delegate can absorb them and host tests can substitute a fake bridge. - Build: `backends/apple/coreai/CMakeLists.txt` requires CMake 3.31 and the Ninja or Xcode generator, keeps ExecuTorch's numeric preprocessor definitions away from swiftc, applies an OS 27 minimum to Core AI targets only, and builds `coreai_swift`. `cmake/PublishSwiftHeader.cmake` publishes the generated Objective-C header for Xcode. - Tests: `runtime/test/SwiftBridgeTests.swift` builds with the bridge sources into the `coreai_swift_bridge_test` XCTest bundle (Ninja, macOS), which CTest runs under `xcrun xctest`. - README: "SDK Bridge" and the build requirements in "Building". Changes outside `backends/apple/coreai` are CMake and CI only and only take effect when `EXECUTORCH_BUILD_COREAI=ON`: - `tools/cmake/ExecuTorchCoreAIDependencies.cmake` (new): resolves Foundation, CoreAI and Swift runtime link paths from the consumer's SDK, so installed packages do not embed the producer's Xcode paths. It fails configuration for SDKs older than 27. - `CMakeLists.txt`: install `ExecuTorchCoreAIDependencies.cmake` into the package config. - `tools/cmake/preset/default.cmake`: note the SDK 27 requirement in the option description. - `.github/workflows/coreai.yml`: also trigger on changes to `ExecuTorchCoreAIDependencies.cmake`. Test Plan: ``` # Local: configure and build only cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_OSX_DEPLOYMENT_TARGET=27.0 -DEXECUTORCH_BUILD_COREAI=ON \ -DEXECUTORCH_BUILD_TESTS=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON cmake --build build --target backends/apple/coreai/all # CI (macOS 27 runner, .github/workflows/coreai.yml) ctest --test-dir build/backends/apple/coreai --output-on-failure --no-tests=error ``` CTest runs `coreai_host_test` and `coreai_swift_bridge_test`. The XCTest bundle links CoreAI, so it only runs on the macOS 27 runner; locally it is built but not run.
metascroy
force-pushed
the
coreai-v2/03b-source-bundles
branch
from
October 5, 2026 03:14
9d457ae to
84780b8
Compare
metascroy
force-pushed
the
coreai-v2/04-sdk-bridge
branch
from
October 5, 2026 03:14
dae7df4 to
756e906
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the private bridge between ExecuTorch's Objective-C++ code and the Swift
CoreAIframework, and packages it for CMake consumers. No ExecuTorch delegate yet; a later PR wires this intoCoreAIBackend.runtime/ETCoreAIBridge.h: Objective-C protocols for model acquisition, prepared models, sessions and tensor transfer, plus availability, device architecture and loader factory entry points.runtime/ETCoreAIModel.swift(moduleCoreAIBridge):memcpyfor dense row-major arrays and strided copies otherwise.runtime/ETCoreAITensor.mm,runtime/coreai_bridge.mm: tensor wrappers and C entry points, built as the privatecoreai_bridge_objobject library so the delegate can absorb them and host tests can substitute a fake bridge.backends/apple/coreai/CMakeLists.txt): requires CMake 3.31 and Ninja/Xcode, keeps ExecuTorch's numeric preprocessor definitions away from swiftc, applies an OS 27 minimum only to Core AI targets, and buildscoreai_swift.cmake/PublishSwiftHeader.cmakepublishes the generated header for Xcode.runtime/test/SwiftBridgeTests.swiftis built with the bridge sources into thecoreai_swift_bridge_testXCTest bundle (Ninja, macOS) and run by CTest underxcrun xctest. The invalid-URL case uses a non-filecoreai-test:URL.backends/apple/coreaiare CMake and CI only, and only take effect whenEXECUTORCH_BUILD_COREAI=ON:tools/cmake/ExecuTorchCoreAIDependencies.cmake(new): resolves Foundation, CoreAI and Swift runtime link paths from the consumer's SDK; fails configuration for SDKs older than 27.CMakeLists.txt: install that file into the package config.tools/cmake/preset/default.cmake: note the SDK 27 requirement..github/workflows/coreai.yml: also trigger on changes toExecuTorchCoreAIDependencies.cmake.Stack: 5 of 9, based on #23390. Review only this PR's commit. Next: #23392.
Test plan: built locally for macOS 27.0;
ctest -Nlistscoreai_host_testandcoreai_swift_bridge_test, which the Core AI workflow runs on the macOS 27 runner. The XCTest bundle links CoreAI, so it only runs there (first CI run of it).lintrunneris clean.