@@ -824,69 +824,14 @@ if (LLAMA_CANN)
824
824
825
825
# Set headers
826
826
set(CANN_INCLUDE_DIRS " ${CANN_INSTALL_DIR} /include " " ${CANN_INSTALL_DIR} /include/aclnn ")
827
- # Find libs
828
- set(CANN_LIBRARIES "")
829
- # TODO: optimize find libs.
830
- # * libascendcl.so
831
- if (LLAMA_CANN)
832
- set(lib_dir " ${CANN_INSTALL_DIR} /acllib/lib64 ")
833
- find_library(found_lib_ascendcl NAMES ascendcl PATHS ${lib_dir} NO_DEFAULT_PATH)
834
- if (found_lib_ascendcl)
835
- set(lib_ascendcl ${found_lib_ascendcl} )
836
- list(APPEND CANN_LIBRARIES ${lib_ascendcl} )
837
- message(STATUS " CANN: libascendcl.so is found at ${lib_dir} ")
838
- else()
839
- set(LLAMA_CANN OFF)
840
- message(WARNING " CANN: Missing libascendcl.so. Turning off LLAMA_CANN ")
841
- endif()
842
- endif()
843
-
844
- # * libnnopbase.so
845
- if (LLAMA_CANN)
846
- set(lib_dir " ${CANN_INSTALL_DIR} /acllib/lib64 ")
847
- find_library(found_lib_nnopbase NAMES nnopbase PATHS ${lib_dir} NO_DEFAULT_PATH)
848
- if (found_lib_nnopbase)
849
- set(lib_nnopbase ${found_lib_nnopbase} )
850
- list(APPEND CANN_LIBRARIES ${lib_nnopbase} )
851
- message(STATUS " CANN: libnnopbase.so is found at ${lib_dir} ")
852
- else()
853
- set(LLAMA_CANN OFF)
854
- message(WARNING " CANN: Missing libnnopbase.so. Turning off LLAMA_CANN ")
855
- endif()
856
- endif()
857
827
858
- # * libopapi.so
828
+ # Set libs
859
829
if (LLAMA_CANN)
860
- set(lib_dir " ${CANN_INSTALL_DIR} /lib64 ")
861
- find_library(found_lib_opapi NAMES opapi PATHS ${lib_dir} NO_DEFAULT_PATH)
862
- if (found_lib_opapi)
863
- set(lib_opapi ${found_lib_opapi} )
864
- list(APPEND CANN_LIBRARIES ${lib_opapi} )
865
- message(STATUS " CANN: libopapi.so is found at ${lib_dir} ")
866
- else()
867
- set(LLAMA_CANN OFF)
868
- message(WARNING " CANN: Missing libopapi.so. Turning off LLAMA_CANN ")
869
- endif()
870
- endif()
830
+ # Build Ascendc kernels.
831
+ add_subdirectory(ggml-cann/kernels)
832
+ list(APPEND CANN_LIBRARIES ascendcl nnopbase opapi acl_op_compiler ascendc_kernels)
833
+ LINK_DIRECTORIES(${LINK_DIRECTORIES} ${CANN_INSTALL_DIR} /lib64)
871
834
872
- # * libacl_op_compiler.so
873
- if (LLAMA_CANN)
874
- set(lib_dir " ${CANN_INSTALL_DIR} /lib64 ")
875
- find_library(found_lib_acl_op_compiler NAMES acl_op_compiler PATHS ${lib_dir} NO_DEFAULT_PATH)
876
- if (found_lib_acl_op_compiler)
877
- set(lib_acl_op_compiler ${found_lib_acl_op_compiler} )
878
- list(APPEND CANN_LIBRARIES ${lib_acl_op_compiler} )
879
- message(STATUS " CANN: libacl_op_compiler.so is found at ${lib_dir} ")
880
- else()
881
- set(LLAMA_CANN OFF)
882
- message(WARNING " CANN: Missing libacl_op_compiler.so. Turning off LLAMA_CANN ")
883
- endif()
884
- endif()
885
-
886
- # Set headers and libs
887
- if (LLAMA_CANN)
888
- message(STATUS " CANN: CANN_INCLUDE_DIRS = ${CANN_INCLUDE_DIRS} ")
889
- message(STATUS " CANN: CANN_LIBRARIES = ${CANN_LIBRARIES} ")
890
835
set(GGML_HEADERS_CANN ggml-cann.h)
891
836
file(GLOB GGML_SOURCES_CUDA " ggml-cann/*.cpp ")
892
837
list(APPEND GGML_SOURCES_CANN " ggml-cann.cpp ")
0 commit comments