Skip to content

Commit 20b8f83

Browse files
committed
Fix
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
1 parent 2f64709 commit 20b8f83

File tree

3 files changed

+23
-32
lines changed

3 files changed

+23
-32
lines changed

build/Codegen.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,9 @@ function(gen_custom_ops_aot_lib)
152152
target_link_options_shared_lib(${GEN_LIB_NAME})
153153
if(TARGET portable_lib)
154154
target_link_libraries(${GEN_LIB_NAME} PRIVATE portable_lib)
155-
# target_link_libraries(${GEN_LIB_NAME} PRIVATE executorch_no_prim_ops)
156155
# target_link_options(${GEN_LIB_NAME} PRIVATE -undefined dynamic_lookup)
157156
else()
158-
target_link_libraries(${GEN_LIB_NAME} PRIVATE portable_lib)
159-
# target_link_libraries(${GEN_LIB_NAME} PRIVATE executorch_no_prim_ops)
157+
target_link_libraries(${GEN_LIB_NAME} PRIVATE executorch_no_prim_ops)
160158
endif()
161159
endfunction()
162160

install_requirements.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ $PIP_EXECUTABLE install --extra-index-url "${TORCH_NIGHTLY_URL}" \
165165
# The --extra-index-url may be necessary if pyproject.toml has a dependency on a
166166
# pre-release or nightly version of a torch package.
167167
#
168-
CMAKE_ARGS="$CMAKE_ARGS -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON"
168+
169169
EXECUTORCH_BUILD_PYBIND="${EXECUTORCH_BUILD_PYBIND}" \
170170
CMAKE_ARGS="${CMAKE_ARGS}" \
171171
CMAKE_BUILD_ARGS="${CMAKE_BUILD_ARGS}" \

kernels/quantized/CMakeLists.txt

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -84,38 +84,31 @@ if(NOT CMAKE_GENERATOR STREQUAL "Xcode"
8484
${EXECUTORCH_ROOT}/kernels/portable/cpu/util/reduce_util.cpp
8585
${EXECUTORCH_ROOT}/runtime/core/exec_aten/util/tensor_util_aten.cpp
8686
)
87-
88-
# Build aot library for embedding ops. Used for pybindings only.
89-
# set(_embedding_aot_ops
90-
# "quantized_decomposed::embedding_4bit.dtype_out"
91-
# )
92-
93-
# gen_selected_ops(
94-
# LIB_NAME "embedding_ops_aot_lib" ROOT_OPS ${_embedding_aot_ops}
95-
# )
96-
97-
# # Expect gen_selected_ops output file to be
98-
# # embedding_ops_aot_lib/selected_operators.yaml
99-
# generate_bindings_for_kernels(
100-
# LIB_NAME "embedding_ops_aot_lib" CUSTOM_OPS_YAML "${_yaml_file}"
101-
# )
102-
# set(_out_dir ${CMAKE_CURRENT_BINARY_DIR}/embedding_ops_aot_lib)
103-
104-
# add_library(
105-
# embedding_ops_aot_lib
106-
# ${_out_dir}/RegisterCodegenUnboxedKernelsEverything.cpp
107-
# ${_out_dir}/Functions.h ${_out_dir}/NativeFunctions.h
108-
# )
109-
110-
# target_link_libraries(embedding_ops_aot_lib PRIVATE executorch_no_prim_ops)
111-
# list(APPEND _quantized_sources ${_out_dir}/RegisterCodegenUnboxedKernelsEverything.cpp ${_out_dir}/Functions.h)
11287
gen_custom_ops_aot_lib(
11388
LIB_NAME "quantized_ops_aot_lib" KERNEL_SOURCES "${_quantized_sources}"
11489
)
115-
target_include_directories(
116-
quantized_ops_aot_lib PUBLIC "${_common_include_directories}"
117-
)
11890

91+
if (TARGET portable_lib)
92+
add_library(quantized_pybind_kernels_lib ${_quantized_kernels__srcs})
93+
target_link_libraries(quantized_pybind_kernels_lib PRIVATE portable_lib)
94+
target_compile_options(quantized_pybind_kernels_lib PUBLIC ${_common_compile_options})
95+
target_include_directories(
96+
quantized_pybind_kernels_lib PUBLIC "${_common_include_directories}"
97+
)
98+
gen_selected_ops(
99+
LIB_NAME "quantized_ops_pybind_lib" OPS_SCHEMA_YAML "${_yaml_file}"
100+
)
101+
generate_bindings_for_kernels(
102+
LIB_NAME "quantized_ops_pybind_lib" CUSTOM_OPS_YAML "${_yaml_file}"
103+
)
104+
# Build a library for pybind usage
105+
#
106+
# quantized_ops_pybind_lib: Register quantized ops kernels into Executorch runtime for pybind
107+
gen_operators_lib(
108+
LIB_NAME "quantized_ops_pybind_lib" KERNEL_LIBS quantized_pybind_kernels_lib DEPS portable_lib
109+
)
110+
target_link_libraries(quantized_ops_aot_lib PUBLIC quantized_ops_pybind_lib)
111+
endif()
119112
# target_link_libraries(quantized_ops_aot_lib PUBLIC embedding_ops_aot_lib)
120113
endif()
121114
endif()

0 commit comments

Comments
 (0)