Skip to content
Closed
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
5 changes: 5 additions & 0 deletions backends/qualcomm/aot/python/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
100 changes: 100 additions & 0 deletions backends/qualcomm/aot/python/targets.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
load(
"@fbsource//tools/build_defs:default_platform_defs.bzl",
"ANDROID",
)
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

PYTHON_MODULE_NAME = "PyQnnManagerAdaptor"

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""

runtime.cxx_python_extension(
name = "PyQnnManagerAdaptor",
srcs = [
"PyQnnManagerAdaptor.cpp",
],
headers = [
"PyQnnManagerAdaptor.h",
],
base_module = "executorch.backends.qualcomm.python",
preprocessor_flags = [
"-DEXECUTORCH_PYTHON_MODULE_NAME={}".format(PYTHON_MODULE_NAME),
],
deps = [
"//executorch/runtime/core:core",
"//executorch/backends/qualcomm/aot/python:python_lib",
"//executorch/backends/qualcomm/aot/wrappers:wrappers",
"//executorch/backends/qualcomm/runtime:logging",
"//executorch/backends/qualcomm:schema",
"//executorch/backends/qualcomm/aot/ir:qcir_utils",
"//executorch/backends/qualcomm/runtime:runtime",
"fbsource//third-party/qualcomm/qnn:api",
],
external_deps = [
"pybind11",
"libtorch_python",
],
use_static_deps = True,
visibility = [
"//executorch/backends/qualcomm/...",
],
)


runtime.cxx_python_extension(
name = "PyQnnWrapperAdaptor",
srcs = [
"PyQnnWrapperAdaptor.cpp",
],
headers = [
"PyQnnWrapperAdaptor.h",
],
base_module = "executorch.backends.qualcomm.python",
preprocessor_flags = [
"-DEXECUTORCH_PYTHON_MODULE_NAME={}".format(PYTHON_MODULE_NAME),
],
deps = [
"//executorch/runtime/core:core",
"//executorch/backends/qualcomm/aot/python:python_lib",
"//executorch/backends/qualcomm/aot/wrappers:wrappers",
"//executorch/backends/qualcomm/runtime:logging",
"//executorch/backends/qualcomm:schema",
"//executorch/backends/qualcomm/aot/ir:qcir_utils",
"//executorch/backends/qualcomm/runtime:runtime",
"fbsource//third-party/qualcomm/qnn:api",
],
external_deps = [
"pybind11",
"libtorch_python",
],
use_static_deps = True,
visibility = [
"//executorch/backends/qualcomm/...",
],
)

runtime.cxx_library(
name = "python_lib",
srcs = glob([
"*.cpp",
]),
exported_headers = glob([
"*.h",
]),
visibility = ["@EXECUTORCH_CLIENTS"],
deps = [
"//executorch/backends/qualcomm/aot/wrappers:wrappers",
"//executorch/backends/qualcomm/runtime:logging",
"//executorch/backends/qualcomm:schema",
"//executorch/backends/qualcomm/aot/ir:qcir_utils",
"//executorch/backends/qualcomm/runtime:runtime",
"fbsource//third-party/qualcomm/qnn:api",
],
external_deps = [
"pybind11",
],
)
5 changes: 5 additions & 0 deletions backends/qualcomm/builders/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
25 changes: 25 additions & 0 deletions backends/qualcomm/builders/targets.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""

runtime.python_library(
name = "builders",
srcs = glob([
"*.py",
]),
visibility = [
"@EXECUTORCH_CLIENTS",
],
deps = [
"//executorch/exir/backend:backend_details",
"//executorch/exir/backend:compile_spec_schema",
"//executorch/backends/qualcomm/aot/python:PyQnnWrapperAdaptor",
"//executorch/backends/qualcomm/aot/python:PyQnnManagerAdaptor",
"//executorch/backends/qualcomm/utils:utils",
"//executorch/exir:lib",
],
)
5 changes: 5 additions & 0 deletions backends/qualcomm/partition/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
24 changes: 24 additions & 0 deletions backends/qualcomm/partition/targets.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""

runtime.python_library(
name = "partition",
srcs = glob([
"*.py",
]),
visibility = [
"@EXECUTORCH_CLIENTS",
],
deps = [
"//executorch/exir/backend:backend_details",
"//executorch/exir/backend:compile_spec_schema",
"//executorch/backends/qualcomm/builders:builders",
"//executorch/backends/qualcomm:preprocess",
"//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib",
],
)
5 changes: 5 additions & 0 deletions backends/qualcomm/passes/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
22 changes: 22 additions & 0 deletions backends/qualcomm/passes/targets.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""

runtime.python_library(
name = "passes",
srcs = glob([
"*.py",
]),
visibility = [
"@EXECUTORCH_CLIENTS",
],
deps = [
"//executorch/exir/backend:backend_details",
"//executorch/exir/backend:compile_spec_schema",
"//executorch/backends/transforms:addmm_mm_to_linear",
],
)
5 changes: 5 additions & 0 deletions backends/qualcomm/quantizer/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
20 changes: 20 additions & 0 deletions backends/qualcomm/quantizer/targets.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.

The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""
runtime.python_library(
name = "quantizer",
srcs = glob([
"*.py",
]),
visibility = [
"@EXECUTORCH_CLIENTS",
],
deps = [
"//executorch/backends/transforms:decompose_sdpa",
],
)
69 changes: 38 additions & 31 deletions backends/qualcomm/runtime/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,44 +25,51 @@ def define_common_targets():
deps = [
"fbsource//third-party/qualcomm/qnn:api",
"//executorch/runtime/backend:interface",
"//executorch/runtime/core:core",
],
exported_deps = [
"//executorch/backends/qualcomm:schema",
"//executorch/runtime/core:core",
],
)

runtime.cxx_library(
name = "runtime",
srcs = glob(
[
"*.cpp",
"backends/*.cpp",
"backends/htpbackend/*.cpp",
"backends/htpbackend/aarch64/*.cpp",
name = "runtime",
srcs = glob(
[
"*.cpp",
"backends/*.cpp",
"backends/htpbackend/*.cpp",
"backends/htpbackend/aarch64/*.cpp",
],
exclude = ["Logging.cpp"],
),
exported_headers = glob(
[
"*.h",
"backends/*.h",
"backends/htpbackend/*.h",
],
exclude = ["Logging.h"],
),
define_static_target = True,
link_whole = True, # needed for executorch/examples/models/llama2:main to register QnnBackend
platforms = [ANDROID],
visibility = ["@EXECUTORCH_CLIENTS"],
resources = {
"qnn_lib": "fbsource//third-party/qualcomm/qnn/qnn-2.25:qnn_offline_compile_libs",
},
deps = [
"fbsource//third-party/qualcomm/qnn:api",
":logging",
"//executorch/backends/qualcomm:schema",
"//executorch/backends/qualcomm/aot/ir:qcir_utils",
"//executorch/backends/qualcomm/aot/wrappers:wrappers",
"//executorch/runtime/backend:interface",
"//executorch/runtime/core:core",
"//executorch/extension/tensor:tensor",
],
exclude = ["Logging.cpp"],
),
exported_headers = glob(
[
"*.h",
"backends/*.h",
"backends/htpbackend/*.h",
exported_deps = [
"//executorch/runtime/core/exec_aten/util:scalar_type_util",
"//executorch/runtime/core:event_tracer",
],
exclude = ["Logging.h"],
),
define_static_target = True,
link_whole = True, # needed for executorch/examples/models/llama2:main to register QnnBackend
platforms = [ANDROID],
visibility = ["@EXECUTORCH_CLIENTS"],
deps = [
"fbsource//third-party/qualcomm/qnn:api",
":logging",
"//executorch/backends/qualcomm:schema",
"//executorch/backends/qualcomm/aot/ir:qcir_utils",
"//executorch/backends/qualcomm/aot/wrappers:wrappers",
"//executorch/runtime/backend:interface",
"//executorch/runtime/core:core",
"//executorch/extension/tensor:tensor",
],
)
8 changes: 8 additions & 0 deletions backends/qualcomm/serialization/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Any targets that should be shared between fbcode and xplat must be defined in
# targets.bzl. This file can contain fbcode-only targets.

load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
31 changes: 31 additions & 0 deletions backends/qualcomm/serialization/targets.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbcode_macros//build_defs:export_files.bzl", "export_file")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""

export_file(
name = "qnn_schema",
src = "schema.fbs",
visibility = ["//executorch/backends/qualcomm/serialization/..."],
)

runtime.python_library(
name = "serialization",
srcs = glob([
"*.py",
]),
resources = {
":qnn_schema": "schema.fbs",
},
visibility = [
"@EXECUTORCH_CLIENTS",
],
deps = [
"//executorch/exir/backend:backend_details",
"//executorch/exir/backend:compile_spec_schema",
],
)
13 changes: 13 additions & 0 deletions backends/qualcomm/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ load(
"@fbsource//tools/build_defs:default_platform_defs.bzl",
"ANDROID",
)
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")


Expand Down Expand Up @@ -93,3 +94,15 @@ def define_common_targets():
":schema",
],
)

runtime.python_library(
name = "preprocess",
srcs = ["qnn_preprocess.py"],
deps = [
"//executorch/backends/qualcomm/passes:passes",
],
visibility = [
"//executorch/backends/qualcomm/...",
"@EXECUTORCH_CLIENTS",
],
)
8 changes: 8 additions & 0 deletions backends/qualcomm/utils/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Any targets that should be shared between fbcode and xplat must be defined in
# targets.bzl. This file can contain fbcode-only targets.

load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
Loading
Loading