Skip to content

Commit d4a6a86

Browse files
committed
Introduce public MergedDataMap
Pull Request resolved: #14766 Add public merged data map. Module can use this to resolve multiple named data maps. Creating as a sep dependency rather than inside module/ so it can be used independently of module. (think there may be some other internal usages soon) Add support for BUCK and CMake. On CMake side, have to add the dep for everyone who uses module .. ghstack-source-id: 314332815 @exported-using-ghexport Differential Revision: [D83527299](https://our.internmc.facebook.com/intern/diff/D83527299/)
1 parent 815ae92 commit d4a6a86

28 files changed

+605
-1
lines changed

.ci/scripts/build-qnn-sdk.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ set_up_aot() {
3838
-DEXECUTORCH_BUILD_EXTENSION_EXTENSION_LLM=ON \
3939
-DEXECUTORCH_BUILD_EXTENSION_EXTENSION_LLM_RUNNER=ON \
4040
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
41+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
4142
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
4243
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
4344
-DPYTHON_EXECUTABLE=python3

.ci/scripts/test_llama_torchao_lowbit.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ cmake -DPYTHON_EXECUTABLE=python \
3131
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
3232
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
3333
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
34+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
3435
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
3536
-DEXECUTORCH_BUILD_XNNPACK=OFF \
3637
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,11 @@ if(EXECUTORCH_BUILD_EXTENSION_MODULE)
630630
list(APPEND _executorch_extensions extension_module_static)
631631
endif()
632632

633+
if(EXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP)
634+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/named_data_map)
635+
list(APPEND _executorch_extensions extension_named_data_map)
636+
endif()
637+
633638
if(EXECUTORCH_BUILD_EXTENSION_LLM)
634639
if(EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER)
635640
set(SUPPORT_REGEX_LOOKAHEAD ON)

backends/mediatek/scripts/mtk_build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ cmake -DCMAKE_INSTALL_PREFIX="${build_dir}" \
3030
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
3131
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
3232
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
33+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
3334
-DEXECUTORCH_BUILD_NEURON=ON \
3435
-B"${build_dir}"
3536

backends/qualcomm/scripts/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ if [ "$BUILD_AARCH64" = true ]; then
8686
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
8787
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
8888
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
89+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
8990
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
9091
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
9192
-DEXECUTORCH_ENABLE_LOGGING=ON \
@@ -155,6 +156,7 @@ if [ "$BUILD_X86_64" = true ]; then
155156
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
156157
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
157158
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
159+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
158160
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
159161
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
160162
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \

backends/samsung/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function build_x86_64() {
4545
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
4646
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
4747
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
48+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
4849
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
4950
-S ${PROJECT_DIR} \
5051
-B ${X86_64_BUILD_DIR}
@@ -77,6 +78,7 @@ function build_android() {
7778
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
7879
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
7980
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
81+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
8082
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
8183
-DEXECUTORCH_ENABLE_LOGGING=1 \
8284
-DEXECUTORCH_BUILD_DEVTOOLS=ON \

backends/vulkan/test/scripts/test_model.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ build_core_libraries_and_devtools() {
111111
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
112112
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
113113
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
114+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
114115
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
115116
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
116117
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON \

backends/vulkan/test/scripts/test_op.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ build_core_libraries() {
138138
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
139139
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
140140
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
141+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
141142
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
142143
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
143144
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON \
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# Please format this file by running:
8+
# ~~~
9+
# cmake-format -i CMakeLists.txt
10+
# ~~~
11+
12+
cmake_minimum_required(VERSION 3.19)
13+
14+
# Source root directory for executorch.
15+
if(NOT EXECUTORCH_ROOT)
16+
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
17+
endif()
18+
19+
list(TRANSFORM _extension_named_data_map__srcs PREPEND "${EXECUTORCH_ROOT}/")
20+
# Create the library
21+
add_library(extension_named_data_map ${_extension_named_data_map__srcs})
22+
23+
# Link dependencies
24+
target_link_libraries(extension_named_data_map PUBLIC executorch_core)
25+
26+
target_include_directories(
27+
extension_named_data_map PUBLIC ${_common_include_directories}
28+
)
29+
30+
target_compile_options(
31+
extension_named_data_map PUBLIC ${_common_compile_options}
32+
)
33+
34+
# Install libraries
35+
install(
36+
TARGETS extension_named_data_map
37+
EXPORT ExecuTorchTargets
38+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
39+
INCLUDES
40+
DESTINATION ${_common_include_directories}
41+
)
42+
43+
# Add tests if testing is enabled
44+
if(BUILD_TESTING)
45+
add_subdirectory(test)
46+
endif()

extension/named_data_map/TARGETS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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+
4+
load(":targets.bzl", "define_common_targets")
5+
6+
oncall("executorch")
7+
8+
define_common_targets()

0 commit comments

Comments
 (0)