File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,18 @@ set(CMAKE_WARN_UNUSED_CLI YES)
77
88set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
99
10- if (${HTP_ARCH_VERSION} STREQUAL "v75" OR ${HTP_ARCH_VERSION} STREQUAL "v79" )
11- #works fine on Snapdragon 8Gen3&8Elite with 1.5x - 3x performance gains with the default ggml backend
12- set (OPT_FLAG " -O3 -march=armv8.7-a -mcpu=cortex-x1 -mtune=cortex-x1 -flto -D_GNU_SOURCE -fvectorize -ffp-model=fast -fno-finite-math-only" )
13- message ("OPT_FLAG:${OPT_FLAG} " )
14- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGGML_USE_HEXAGON ${DEBUG_FLAG} ${OPT_FLAG} " )
15- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGGML_USE_HEXAGON ${DEBUG_FLAG} ${OPT_FLAG} " )
16- set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DGGML_USE_HEXAGON ${DEBUG_FLAG} ${OPT_FLAG} " )
17- set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DGGML_USE_HEXAGON ${DEBUG_FLAG} ${OPT_FLAG} " )
10+ if (CMAKE_SYSTEM_NAME STREQUAL "Android" )
11+ if (DEFINED HTP_ARCH_VERSION)
12+ if (${HTP_ARCH_VERSION} STREQUAL "v75" OR ${HTP_ARCH_VERSION} STREQUAL "v79" )
13+ #works fine on Snapdragon 8Gen3&8Elite with 1.5x - 3x performance gains with the default ggml backend
14+ set (OPT_FLAG " -O3 -march=armv8.7-a -mcpu=cortex-x1 -mtune=cortex-x1 -flto -D_GNU_SOURCE -fvectorize -ffp-model=fast -fno-finite-math-only" )
15+ message ("OPT_FLAG:${OPT_FLAG} " )
16+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGGML_USE_HEXAGON ${DEBUG_FLAG} ${OPT_FLAG} " )
17+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGGML_USE_HEXAGON ${DEBUG_FLAG} ${OPT_FLAG} " )
18+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DGGML_USE_HEXAGON ${DEBUG_FLAG} ${OPT_FLAG} " )
19+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DGGML_USE_HEXAGON ${DEBUG_FLAG} ${OPT_FLAG} " )
20+ endif ()
21+ endif ()
1822endif ()
1923
2024if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE )
Original file line number Diff line number Diff line change @@ -41,14 +41,14 @@ hwaccel_approach = 2
4141# a. HWACCEL_QNN_SINGLEGRAPH not supported at the moment;
4242# b. following combinations are valid:
4343# 1: hwaccel_approach = 2 AND hexagon_backend = 2(HWACCEL_CDSP, this is the default setting)
44- # 2: hwaccel_approach = 0 AND hexagon_backend = 2(HWACCEL_QNN, QNNNPU)
44+ # 2: hwaccel_approach = 0 AND hexagon_backend = 2(HWACCEL_QNN, aka QNNNPU)
4545# 3: hwaccel_approach = 0 AND hexagon_backend = 1(QNNGPU)
4646# 4: hwaccel_approach = 0 AND hexagon_backend = 0(QNNCPU)
4747# 5: hwaccel_approach = 2 AND hexagon_backend = 3(fall back to the default ggml backend)
4848# 6: hwaccel_approach = 0 AND hexagon_backend = 3(fall back to the default ggml backend)
4949#
5050# generally speaking,
51- # a. we only need to focus on b-1 and b-2 in this PR .
51+ # a. we only need to focus on b-1(HWACCEL_CDSP) and b-2(HWACCEL_QNN, aka QNNNPU) .
5252# b. we can compare Hexagon NPU performance between HWACCEL_CDSP/HWACCEL_QNN(QNNNPU)/the default ggml backend accordingly
5353
5454
You can’t perform that action at this time.
0 commit comments