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