Skip to content

Commit

Permalink
Fixed a bug where debug code was included in the release, resulting i… (
Browse files Browse the repository at this point in the history
#1)

* Fixed a bug where debug code was included in the release, resulting in an undefined function error.

* Change the path of the QNN library when building in termux environment

* Revert "Change the path of the QNN library when building in termux environment"

This reverts commit c6e26a3.

* Changed so that GGML_QNN_DEFAULT_LIB_SEARCH_PATH can be set from command line arguments
  • Loading branch information
myan-o authored Aug 20, 2024
1 parent 5ea980d commit dedadf2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ggml/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -885,12 +885,13 @@ if (GGML_QNN)
find_library(LOG_LIB log)
find_library(ANDROID_LIB android)
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} ${LOG_LIB} ${ANDROID_LIB})
set(GGML_QNN_DEFAULT_LIB_SEARCH_PATH "\"/data/local/tmp/\"")
set(GGML_QNN_DEFAULT_LIB_SEARCH_PATH "/data/local/tmp/" CACHE STRING "customized library search path for QNN backend")
else()
message(FATAL_ERROR "QNN now only available on Android")
endif()

add_compile_definitions(GGML_QNN_DEFAULT_LIB_SEARCH_PATH=${GGML_QNN_DEFAULT_LIB_SEARCH_PATH})
string(REGEX REPLACE "/$" "" GGML_QNN_DEFAULT_LIB_SEARCH_PATH "${GGML_QNN_DEFAULT_LIB_SEARCH_PATH}")
add_compile_definitions(GGML_QNN_DEFAULT_LIB_SEARCH_PATH="${GGML_QNN_DEFAULT_LIB_SEARCH_PATH}/")
if (NOT DEFINED GGML_QNN_SDK_PATH)
# try read from environment variable
if (DEFINED ENV{QNN_SDK_PATH})
Expand Down
6 changes: 6 additions & 0 deletions ggml/src/ggml-qnn/backend-ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,13 @@ bool qnn_binary_op_impl(ggml_backend_qnn_context *ctx, ggml_tensor *src0, ggml_t
succeed = execute_graph<2, 1>(graph_ptr, { src0, src1 }, { dst });
}

#ifndef NDEBUG
if (!succeed) {
print_ggml_tensor(src0);
print_ggml_tensor(src1);
print_ggml_tensor(dst);
}
#endif

return succeed;
}
Expand All @@ -317,10 +319,12 @@ bool qnn_unary_op_impl(ggml_backend_qnn_context *ctx, ggml_tensor *src, ggml_ten
succeed = execute_graph<1, 1>(graph_ptr, { src }, { dst });
}

#ifndef NDEBUG
if (!succeed) {
print_ggml_tensor(src);
print_ggml_tensor(dst);
}
#endif

return succeed;
}
Expand Down Expand Up @@ -541,10 +545,12 @@ bool ggml_qnn_supports_op(const ggml_tensor *op) {
return false;
}

#ifndef NDEBUG
if (op->op == GGML_OP_ADD && !is_tensor_dimensions_equal(op->src[0], op->src[1])) {
QNN_LOG_DEBUG("src0 and src1 dimensions are not equal");
return false;
}
#endif
}

switch (op->type) {
Expand Down

0 comments on commit dedadf2

Please sign in to comment.