Skip to content

Re-sync with internal repository #6

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

Merged
merged 1 commit into from
Jul 13, 2023
Merged
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
107 changes: 107 additions & 0 deletions backends/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# 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")
load(":backends.bzl", "get_all_cpu_aot_and_backend_targets")
load(":targets.bzl", "define_common_targets")

define_common_targets()

# Use runtime.python_library instead of the one defined in python_library.bzl,
# so we can have access to EXECUTORCH_CLIENTS list.
runtime.python_library(
name = "backend_api",
srcs = [
"backend_api.py",
],
visibility = [
"//executorch/...",
"//executorch/test/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
":backend_details",
":compile_spec_schema",
"//caffe2:torch",
"//executorch/backends:utils",
],
)

runtime.python_library(
name = "compile_spec_schema",
srcs = [
"compile_spec_schema.py",
],
visibility = [
"//executorch/...",
"//executorch/test/...",
"@EXECUTORCH_CLIENTS",
],
)

runtime.python_library(
name = "partitioner",
srcs = [
"partitioner.py",
],
visibility = [
"//executorch/...",
"//executorch/test/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
":compile_spec_schema",
"//caffe2:torch",
],
)

runtime.python_library(
name = "backend_details",
srcs = [
"backend_details.py",
],
visibility = [
"//executorch/...",
"//executorch/test/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
":compile_spec_schema",
":partitioner",
"//caffe2:torch",
"//executorch/exir:delegate",
"//executorch/exir:graph_module",
],
)

# backend_lib includes all ahead of time apis and supported backends,
# it's supposed to be only used on server side and not for production on device.
runtime.python_library(
name = "backend_lib",
visibility = [
"//executorch/...",
"//executorch/test/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
":backend_api",
":backend_details",
"//executorch/backends/canonical_partitioners:canonical_partitioner_lib",
] + get_all_cpu_aot_and_backend_targets(),
)

runtime.python_library(
name = "utils",
srcs = [
"utils.py",
],
visibility = [
"//executorch/...",
"//executorch/backends/...",
"//executorch/test/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
"//caffe2:torch",
],
)
19 changes: 19 additions & 0 deletions backends/canonical_partitioners/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

runtime.python_library(
name = "canonical_partitioner_lib",
srcs = [
"duplicate_dequant_node_pass.py",
"pattern_op_partitioner.py",
],
visibility = [
"//executorch/...",
"//executorch/backends/...",
"//executorch/test/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
"//caffe2:torch",
"//executorch/backends:partitioner",
],
)
26 changes: 26 additions & 0 deletions backends/qnnpack/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load(":targets.bzl", "define_common_targets")

define_common_targets()

runtime.python_library(
name = "qnnpack_preprocess",
srcs = [
"qnnpack_preprocess.py",
"serialization/qnnpack_graph_schema.py",
"serialization/qnnpack_graph_serialize.py",
],
resources = [
"serialization/schema.fbs",
],
visibility = [
"//executorch/...",
],
deps = [
"//executorch/backends:backend_details",
"//executorch/backends/transforms:lib",
"//executorch/exir:graph_module",
"//executorch/exir/serialize:bindings",
"//executorch/exir/serialize:lib",
],
)
38 changes: 38 additions & 0 deletions backends/qnnpack/partition/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

runtime.python_library(
name = "support_patterns",
srcs = [
"support_patterns.py",
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
"//caffe2:torch",
"//executorch/backends:utils",
"//executorch/backends/transforms:lib",
],
)

runtime.python_library(
name = "qnnpack_partitioner",
srcs = [
"qnnpack_partitioner.py",
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
":support_patterns",
"//executorch/backends:partitioner",
"//executorch/backends/canonical_partitioners:canonical_partitioner_lib",
"//executorch/backends/qnnpack:qnnpack_preprocess",
"//executorch/backends/transforms:lib",
"//executorch/backends/xnnpack/partition:xnnpack_partitioner",
"//executorch/exir:delegate",
"//executorch/exir:lib",
],
)
47 changes: 47 additions & 0 deletions backends/qnnpack/test/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest")
load(":targets.bzl", "define_common_targets")

define_common_targets()

python_unittest(
name = "test_qnnpack",
srcs = [
"test_qnnpack.py",
],
preload_deps = [
"//executorch/kernels/quantized:custom_ops_generated_lib",
],
supports_static_listing = True,
tags = ["long_running"],
deps = [
"//caffe2:torch",
"//executorch/backends:backend_api",
"//executorch/backends/qnnpack:qnnpack_backend",
"//executorch/backends/qnnpack:qnnpack_preprocess",
"//executorch/backends/qnnpack/partition:qnnpack_partitioner",
"//executorch/exir:lib",
"//executorch/exir/serialize:lib",
"//executorch/pybindings:portable", # @manual
"//executorch/pytree:pylib",
],
)

python_unittest(
name = "test_qnnpack_partitioner",
srcs = [
"test_qnnpack_partitioner.py",
],
preload_deps = [
"//executorch/kernels/quantized:custom_ops_generated_lib",
],
supports_static_listing = True,
tags = ["long_running"],
deps = [
"//caffe2:torch",
"//executorch/backends/qnnpack:qnnpack_backend",
"//executorch/backends/qnnpack/partition:support_patterns",
"//executorch/backends/transforms:lib",
"//executorch/exir:lib",
"//executorch/pybindings:portable", # @manual
],
)
Loading