|
1 | 1 | load("@fbsource//xplat/executorch/backends/xnnpack/third-party:third_party_libs.bzl", "third_party_dep")
|
2 |
| -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") |
| 2 | +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime") |
3 | 3 |
|
4 | 4 | def _get_preprocessor_flags():
|
5 | 5 | """
|
@@ -33,40 +33,42 @@ def define_common_targets():
|
33 | 33 | ],
|
34 | 34 | )
|
35 | 35 |
|
36 |
| - runtime.cxx_library( |
37 |
| - name = "xnnpack_backend", |
38 |
| - srcs = native.glob([ |
39 |
| - "runtime/*.cpp", |
40 |
| - "runtime/profiling/*.cpp", |
41 |
| - ]), |
42 |
| - headers = native.glob([ |
43 |
| - "runtime/*.h", |
44 |
| - "runtime/profiling/*.h", |
45 |
| - ]), |
46 |
| - visibility = [ |
47 |
| - "//executorch/exir/backend:backend_lib", |
48 |
| - "//executorch/exir/backend/test/...", |
49 |
| - "//executorch/backends/xnnpack/test/...", |
50 |
| - "//executorch/extension/pybindings/...", |
51 |
| - "@EXECUTORCH_CLIENTS", |
52 |
| - ], |
53 |
| - preprocessor_flags = [ |
54 |
| - # Uncomment to enable per operator timings |
55 |
| - # "-DENABLE_XNNPACK_PROFILING", |
56 |
| - # Uncomment to enable using KleidiAI Kernels |
57 |
| - # "-DENABLE_XNNPACK_KLEIDI" |
58 |
| - ] + _get_preprocessor_flags(), |
59 |
| - exported_deps = [ |
60 |
| - "//executorch/runtime/backend:interface", |
61 |
| - ], |
62 |
| - deps = [ |
63 |
| - third_party_dep("XNNPACK"), |
64 |
| - "//executorch/backends/xnnpack/serialization:xnnpack_flatbuffer_header", |
65 |
| - "//executorch/extension/threadpool:threadpool", |
66 |
| - "//executorch/runtime/core/exec_aten/util:tensor_util", |
67 |
| - "//executorch/runtime/executor:pte_data_map" |
68 |
| - ], |
69 |
| - # XnnpackBackend.cpp needs to compile with executor as whole |
70 |
| - # @lint-ignore BUCKLINT: Avoid `link_whole=True` (https://fburl.com/avoid-link-whole) |
71 |
| - link_whole = True, |
72 |
| - ) |
| 36 | + for aten_mode in get_aten_mode_options(): |
| 37 | + aten_suffix = "_aten" if aten_mode else "" |
| 38 | + runtime.cxx_library( |
| 39 | + name = "xnnpack_backend" + aten_suffix, |
| 40 | + srcs = native.glob([ |
| 41 | + "runtime/*.cpp", |
| 42 | + "runtime/profiling/*.cpp", |
| 43 | + ]), |
| 44 | + headers = native.glob([ |
| 45 | + "runtime/*.h", |
| 46 | + "runtime/profiling/*.h", |
| 47 | + ]), |
| 48 | + visibility = [ |
| 49 | + "//executorch/exir/backend:backend_lib", |
| 50 | + "//executorch/exir/backend/test/...", |
| 51 | + "//executorch/backends/xnnpack/test/...", |
| 52 | + "//executorch/extension/pybindings/...", |
| 53 | + "@EXECUTORCH_CLIENTS", |
| 54 | + ], |
| 55 | + preprocessor_flags = [ |
| 56 | + # Uncomment to enable per operator timings |
| 57 | + # "-DENABLE_XNNPACK_PROFILING", |
| 58 | + # Uncomment to enable using KleidiAI Kernels |
| 59 | + # "-DENABLE_XNNPACK_KLEIDI" |
| 60 | + ] + _get_preprocessor_flags(), |
| 61 | + exported_deps = [ |
| 62 | + "//executorch/runtime/backend:interface", |
| 63 | + ], |
| 64 | + deps = [ |
| 65 | + third_party_dep("XNNPACK"), |
| 66 | + "//executorch/backends/xnnpack/serialization:xnnpack_flatbuffer_header", |
| 67 | + "//executorch/extension/threadpool:threadpool", |
| 68 | + "//executorch/runtime/core/exec_aten/util:tensor_util" + aten_suffix, |
| 69 | + "//executorch/runtime/executor:pte_data_map" |
| 70 | + ], |
| 71 | + # XnnpackBackend.cpp needs to compile with executor as whole |
| 72 | + # @lint-ignore BUCKLINT: Avoid `link_whole=True` (https://fburl.com/avoid-link-whole) |
| 73 | + link_whole = True, |
| 74 | + ) |
0 commit comments