Add compile option soc type macro ASCEND_310P to ggml-cann lib

This commit is contained in:
leo-pony 2024-11-20 14:34:09 +08:00
parent 63273690b5
commit 1ee8d721bd
2 changed files with 15 additions and 1 deletions

View file

@ -39,6 +39,20 @@ if (CANN_INSTALL_DIR)
target_include_directories(ggml-cann PRIVATE . .. ${CANN_INCLUDE_DIRS})
target_link_directories(ggml-cann PRIVATE ${CANN_INSTALL_DIR}/lib64)
# set define macro for the special soc type, as function of some ascend kernel is different for different soc type.
set(SOC_VERSION "")
if(NOT SOC_TYPE)
detect_ascend_soc_type(SOC_VERSION)
set(SOC_TYPE "${SOC_VERSION}")
endif()
string(TOLOWER ${SOC_TYPE} SOC_VERSION)
string(FIND "${SOC_VERSION}" "ascend310p" FIRST_310P_INDEX)
if(FIRST_310P_INDEX GREATER -1)
#add_compile_definitions(ASCEND_310P)
target_compile_definitions(ggml-cann PRIVATE ASCEND_310P)
endif()
message(STATUS "CANN: Compile llama.cpp with ${SOC_TYPE}.")
message(STATUS "CANN: CANN_INCLUDE_DIRS = ${CANN_INCLUDE_DIRS}")
message(STATUS "CANN: CANN_LIBRARIES = ${CANN_LIBRARIES}")
else()