Skip to content

Commit 9f49022

Browse files
committed
Update
[ghstack-poisoned]
2 parents 84778c7 + aafeb54 commit 9f49022

File tree

10 files changed

+611
-66
lines changed

10 files changed

+611
-66
lines changed

.github/workflows/trunk.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,8 @@ jobs:
536536
git clone https://github.com/huggingface/optimum-executorch
537537
cd optimum-executorch
538538
# There is no release yet, for CI stability, always test from the same commit on main
539-
git checkout 6a7e83f3eee2976fa809335bfb78a45b1ea1cb25
540-
pip install .
541-
pip install accelerate sentencepiece
539+
git checkout 1907349524b5f2d61f9c04d2e985da826d4308ba
540+
pip install .[tests]
542541
pip list
543542
echo "::endgroup::"
544543

Package.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,24 @@ let package = Package(
8282
(value["libraries"] as? [String] ?? []).map { .linkedLibrary($0) }
8383
),
8484
]
85-
}
85+
} + [
86+
.testTarget(
87+
name: "tests",
88+
dependencies: [
89+
.target(name: "executorch_debug"),
90+
.target(name: "kernels_portable"),
91+
],
92+
path: "extension/apple/ExecuTorch/__tests__",
93+
resources: [
94+
.copy("resources/add.pte")
95+
],
96+
linkerSettings: [
97+
.linkedLibrary("c++"),
98+
.unsafeFlags([
99+
"-Xlinker", "-force_load",
100+
"-Xlinker", "cmake-out/kernels_portable.xcframework/macos-arm64/libkernels_portable_macos.a",
101+
])
102+
]
103+
)
104+
]
86105
)

backends/apple/coreml/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ endif()
2525

2626
option(COREML_BUILD_EXECUTOR_RUNNER "Build CoreML executor runner." OFF)
2727

28+
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
29+
2830
# inmemoryfs sources
2931
set(INMEMORYFS_SOURCES
3032
runtime/inmemoryfs/inmemory_filesystem.cpp
@@ -229,3 +231,18 @@ install(
229231
INCLUDES
230232
DESTINATION ${_common_include_directories}
231233
)
234+
235+
# We only care about building the pybinding when building for macOS wheels.
236+
if(EXECUTORCH_BUILD_COREML AND EXECUTORCH_BUILD_PYBIND)
237+
if(NOT TARGET pybind11::pybind11)
238+
add_subdirectory(${EXECUTORCH_ROOT}/third-party/pybind11 ${CMAKE_CURRENT_BINARY_DIR}/pybind11)
239+
endif()
240+
241+
pybind11_add_module(executorchcoreml SHARED runtime/inmemoryfs/inmemory_filesystem_py.cpp)
242+
243+
target_compile_options(executorchcoreml PRIVATE -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
244+
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
245+
target_compile_options(executorchcoreml PRIVATE -g)
246+
endif()
247+
target_link_libraries(executorchcoreml PRIVATE coreml_util coreml_inmemoryfs)
248+
endif()

backends/apple/coreml/runtime/delegate/ETCoreMLModelManager.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void set_outputs(std::vector<executorchcoreml::MultiArray>& outputs,
208208
const inmemoryfs::InMemoryFileSystem *inmemory_fs,
209209
NSError * __autoreleasing *error) {
210210
NSError *local_error = nil;
211-
if (![fm createDirectoryAtURL:dst_url withIntermediateDirectories:NO attributes:@{} error:error]) {
211+
if (![fm createDirectoryAtURL:dst_url withIntermediateDirectories:YES attributes:@{} error:error]) {
212212
ETCoreMLLogUnderlyingErrorAndSetNSError(error,
213213
ETCoreMLErrorModelSaveFailed,
214214
local_error,

0 commit comments

Comments
 (0)