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