Skip to content

Commit 68ddd80

Browse files
authored
Qualcomm AI Engine Direct - Merge the two pybind libraries into a single library (#15999)
Summary: - Prevent dynamic_cast failures caused by separate typeinfo in each library with clang. cc: @haowhsu-quic
1 parent 1ea3907 commit 68ddd80

File tree

121 files changed

+1530
-1633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1530
-1633
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ set_up_aot() {
4242
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
4343
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
4444
-DPYTHON_EXECUTABLE=python3
45-
cmake --build $PWD --target "PyQnnManagerAdaptor" "PyQnnWrapperAdaptor" -j$(nproc)
45+
cmake --build $PWD --target "PyQnnManagerAdaptor" -j$(nproc)
4646
# install Python APIs to correct import path
4747
# The filename might vary depending on your Python and host version.
4848
cp -f backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so $EXECUTORCH_ROOT/backends/qualcomm/python
49-
cp -f backends/qualcomm/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so $EXECUTORCH_ROOT/backends/qualcomm/python
5049
popd
5150

5251
# Workaround for fbs files in exir/_serialize

.ci/scripts/test_llama.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ if [[ "${MODE}" =~ .*qnn.* ]]; then
130130
cp schema/program.fbs exir/_serialize/program.fbs
131131
cp schema/scalar_type.fbs exir/_serialize/scalar_type.fbs
132132
cp -f build-x86/backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
133-
cp -f build-x86/backends/qualcomm/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
134133

135134
else
136135
QNN=OFF

.ci/scripts/test_qnn_static_llama_eval.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export PYTHONPATH=".."
2121
cp schema/program.fbs exir/_serialize/program.fbs
2222
cp schema/scalar_type.fbs exir/_serialize/scalar_type.fbs
2323
cp -f build-x86/backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
24-
cp -f build-x86/backends/qualcomm/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
2524

2625
if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
2726
PYTHON_EXECUTABLE=python3

.ci/scripts/test_qnn_static_llm.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export PYTHONPATH=".."
2626
cp schema/program.fbs exir/_serialize/program.fbs
2727
cp schema/scalar_type.fbs exir/_serialize/scalar_type.fbs
2828
cp -f build-x86/backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
29-
cp -f build-x86/backends/qualcomm/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
3029

3130
if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
3231
PYTHON_EXECUTABLE=python3

backends/qualcomm/CMakeLists.txt

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,11 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
267267
${CMAKE_CURRENT_BINARY_DIR}/pybind11
268268
)
269269
add_library(PyQnnManagerAdaptor MODULE)
270-
add_library(PyQnnWrapperAdaptor MODULE)
271270
# PyQnnManager containing a pybind type triggers the warning because pybind11
272271
# code internally forces hidden visibility.
273272
set_target_properties(
274273
PyQnnManagerAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden
275274
)
276-
set_target_properties(
277-
PyQnnWrapperAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden
278-
)
279275

280276
target_link_libraries(
281277
PyQnnManagerAdaptor
@@ -287,18 +283,14 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
287283
executorch
288284
extension_tensor
289285
qnn_backend_options
290-
)
291-
target_link_libraries(
292-
PyQnnWrapperAdaptor PRIVATE pybind11::module pybind11::lto wrappers
293-
qnn_executorch_logging qnn_executorch_header
286+
wrappers
287+
qnn_executorch_logging
294288
)
295289

296290
pybind11_extension(PyQnnManagerAdaptor)
297-
pybind11_extension(PyQnnWrapperAdaptor)
298291
if(NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo)
299292
# Strip unnecessary sections of the binary
300293
pybind11_strip(PyQnnManagerAdaptor)
301-
pybind11_strip(PyQnnWrapperAdaptor)
302294
endif()
303295

304296
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
@@ -309,9 +301,6 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
309301
target_compile_options(
310302
PyQnnManagerAdaptor PUBLIC ${_pybind_compile_options}
311303
)
312-
target_compile_options(
313-
PyQnnWrapperAdaptor PUBLIC ${_pybind_compile_options}
314-
)
315304
endif()
316305

317306
add_subdirectory(
@@ -320,7 +309,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
320309
)
321310

322311
install(
323-
TARGETS PyQnnManagerAdaptor PyQnnWrapperAdaptor
312+
TARGETS PyQnnManagerAdaptor
324313
LIBRARY
325314
DESTINATION ${CMAKE_INSTALL_LIBDIR}/executorch/backends/qualcomm/python
326315
RUNTIME

backends/qualcomm/aot/python/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,3 @@ target_sources(
99
PyQnnManagerAdaptor PUBLIC ${CMAKE_CURRENT_LIST_DIR}/PyQnnManagerAdaptor.cpp
1010
${CMAKE_CURRENT_LIST_DIR}/PyQnnManagerAdaptor.h
1111
)
12-
13-
# PyQnnWrapperAdaptor
14-
target_sources(
15-
PyQnnWrapperAdaptor PUBLIC ${CMAKE_CURRENT_LIST_DIR}/PyQnnWrapperAdaptor.cpp
16-
${CMAKE_CURRENT_LIST_DIR}/PyQnnWrapperAdaptor.h
17-
)

0 commit comments

Comments
 (0)