Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 141 additions & 3 deletions backends/apple/coreml/BUCK
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
oncall("executorch")
# Any targets that should be shared between fbcode and xplat must be defined in
# targets.bzl. This file can contain xplat-only targets.

Expand All @@ -8,9 +10,8 @@ load(
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/runtime/core:targets.bzl", "build_sdk")

oncall("executorch")

runtime.cxx_library(
non_fbcode_target(_kind = runtime.cxx_library,
name = "coreml",
srcs = [
"runtime/delegate/ETCoreMLAsset.mm",
Expand Down Expand Up @@ -133,7 +134,7 @@ _PROTOS = [
"WordTagger",
]

runtime.cxx_library(
non_fbcode_target(_kind = runtime.cxx_library,
name = "proto",
srcs = [
"fbsource//third-party/pypi/coremltools:exported-cpp-protoc[{}.pb.cc]".format(name)
Expand All @@ -153,3 +154,140 @@ runtime.cxx_library(
"//third-party/protobuf:fb-protobuf-lite",
],
)

# !!!! fbcode/executorch/backends/apple/coreml/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!!

# Any targets that should be shared between fbcode and xplat must be defined in
# targets.bzl. This file can contain fbcode-only targets.

load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")


# TODO: this is a placeholder to support internal fbcode build. We should add the coreml backend target properly.
fbcode_target(_kind = runtime.python_library,
name = "coreml",
visibility = ["PUBLIC"],
)

fbcode_target(_kind = runtime.python_library,
name = "backend",
srcs = glob([
"compiler/*.py",
"logging.py",
]),
visibility = ["PUBLIC"],
deps = [
"fbsource//third-party/pypi/coremltools:coremltools",
":executorchcoreml",
"//executorch/exir/backend:backend_details",
"//executorch/exir/backend:compile_spec_schema",
],
)

fbcode_target(_kind = runtime.python_library,
name = "partitioner",
srcs = glob([
"partition/*.py",
"logging.py",
]),
visibility = ["PUBLIC"],
deps = [
"fbsource//third-party/pypi/coremltools:coremltools",
":backend",
"//caffe2:torch",
"//executorch/exir:lib",
"//executorch/exir/backend:compile_spec_schema",
"//executorch/exir/backend:partitioner",
"//executorch/exir/backend:utils",
],
)

fbcode_target(_kind = runtime.python_library,
name = "quantizer",
srcs = glob([
"quantizer/*.py",
]),
visibility = ["PUBLIC"],
)

fbcode_target(_kind = runtime.python_library,
name = "coreml_recipes",
srcs = [
"recipes/__init__.py",
"recipes/coreml_recipe_provider.py"
],
visibility = ["PUBLIC"],
deps = [
"fbsource//third-party/pypi/coremltools:coremltools",
":coreml_recipe_types",
":backend",
":partitioner",
":quantizer",
"//caffe2:torch",
"//executorch/exir:lib",
"//executorch/exir/backend:compile_spec_schema",
"//executorch/exir/backend:partitioner",
"//executorch/exir/backend:utils",
"//executorch/export:lib",
"//executorch/runtime:runtime", # @manual
],
)

fbcode_target(_kind = runtime.python_library,
name = "coreml_recipe_types",
srcs = [
"recipes/coreml_recipe_types.py",
],
visibility = ["PUBLIC"],
deps = [
"//executorch/export:recipe",
],
)

fbcode_target(_kind = runtime.cxx_python_extension,
name = "executorchcoreml",
srcs = [
"runtime/inmemoryfs/inmemory_filesystem.cpp",
"runtime/inmemoryfs/inmemory_filesystem_py.cpp",
"runtime/inmemoryfs/inmemory_filesystem_utils.cpp",
"runtime/inmemoryfs/memory_buffer.cpp",
"runtime/inmemoryfs/memory_stream.cpp",
"runtime/inmemoryfs/reversed_memory_stream.cpp",
"runtime/util/json_util.cpp",
],
headers = glob([
"runtime/inmemoryfs/**/*.hpp",
]),
base_module = "executorch.backends.apple.coreml",
compiler_flags = [
"-std=c++17",
],
preprocessor_flags = [
"-Iexecutorch/backends/apple/coreml/runtime/util",
],
types = [
"executorchcoreml.pyi",
],
visibility = ["PUBLIC"],
deps = [
"fbsource//third-party/nlohmann-json:nlohmann-json",
"fbsource//third-party/pybind11:pybind11",
],
)

fbcode_target(_kind = runtime.python_test,
name = "test",
srcs = glob([
"test/*.py",
]),
deps = [
"fbsource//third-party/pypi/coremltools:coremltools",
"fbsource//third-party/pypi/pytest:pytest",
":partitioner",
":quantizer",
":coreml_recipes",
"//caffe2:torch",
"//pytorch/vision:torchvision",
"fbsource//third-party/pypi/scikit-learn:scikit-learn",
],
)
135 changes: 0 additions & 135 deletions backends/apple/coreml/TARGETS

This file was deleted.

Loading
Loading