1# Any targets that should be shared between fbcode and xplat must be defined in 2# targets.bzl. This file can contain fbcode-only targets. 3 4load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") 5 6oncall("executorch") 7 8runtime.python_library( 9 name = "backend", 10 srcs = glob([ 11 "compiler/*.py", 12 ]), 13 visibility = [ 14 "@EXECUTORCH_CLIENTS", 15 ], 16 deps = [ 17 ":executorchcoreml", 18 "//executorch/exir/backend:backend_details", 19 "//executorch/exir/backend:compile_spec_schema", 20 "fbsource//third-party/pypi/coremltools:coremltools", 21 ], 22) 23 24runtime.python_library( 25 name = "partitioner", 26 srcs = glob([ 27 "partition/*.py", 28 ]), 29 visibility = [ 30 "@EXECUTORCH_CLIENTS", 31 ], 32 deps = [ 33 ":backend", 34 "//caffe2:torch", 35 "//executorch/exir:lib", 36 "//executorch/exir/backend:compile_spec_schema", 37 "//executorch/exir/backend:partitioner", 38 "//executorch/exir/backend:utils", 39 "fbsource//third-party/pypi/coremltools:coremltools", 40 ], 41) 42 43runtime.python_library( 44 name = "quantizer", 45 srcs = glob([ 46 "quantizer/*.py", 47 ]), 48 visibility = [ 49 "@EXECUTORCH_CLIENTS", 50 ], 51) 52 53runtime.cxx_python_extension( 54 name = "executorchcoreml", 55 srcs = [ 56 "runtime/inmemoryfs/inmemory_filesystem.cpp", 57 "runtime/inmemoryfs/inmemory_filesystem_py.cpp", 58 "runtime/inmemoryfs/inmemory_filesystem_utils.cpp", 59 "runtime/inmemoryfs/memory_buffer.cpp", 60 "runtime/inmemoryfs/memory_stream.cpp", 61 "runtime/inmemoryfs/reversed_memory_stream.cpp", 62 "runtime/util/json_util.cpp", 63 ], 64 headers = glob([ 65 "runtime/inmemoryfs/**/*.hpp", 66 ]), 67 preprocessor_flags = [ 68 "-Iexecutorch/backends/apple/coreml/runtime/util", 69 ], 70 types = [ 71 "executorchcoreml.pyi", 72 ], 73 compiler_flags = [ 74 "-std=c++17", 75 ], 76 base_module = "", 77 visibility = [ 78 "//executorch/examples/apple/coreml/...", 79 ], 80 external_deps = [ 81 "pybind11", 82 ], 83 deps = [ 84 "fbsource//third-party/nlohmann-json:nlohmann-json", 85 ], 86) 87 88runtime.python_test( 89 name = "test", 90 srcs = glob([ 91 "test/*.py", 92 ]), 93 deps = [ 94 ":partitioner", 95 ":quantizer", 96 "//caffe2:torch", 97 "//pytorch/vision:torchvision", 98 "fbsource//third-party/pypi/pytest:pytest", 99 ], 100) 101