Skip to content

Commit

Permalink
add get rows for q8_0 with out view
Browse files Browse the repository at this point in the history
  • Loading branch information
hipudding committed May 10, 2024
1 parent 9a48fe2 commit 5430a30
Show file tree
Hide file tree
Showing 12 changed files with 385 additions and 585 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -832,17 +832,16 @@ if (LLAMA_CANN)

# TODO: find libs
link_directories(
${CANN_INSTALL_DIR}/lib64
${CANN_INSTALL_DIR}/aarch64-linux/simulator/Ascend910B1/lib
${CANN_INSTALL_DIR}/../8.0.RC1.alpha003/tools/tikicpulib/lib/Ascend910B1)
${CANN_INSTALL_DIR}/lib64
)

add_subdirectory(ggml-cann/kernels)
list(APPEND CANN_LIBRARIES
ascendcl
nnopbase
opapi
acl_op_compiler
cann_kernels
ascendc_kernels
)

set(GGML_HEADERS_CANN ggml-cann.h)
Expand Down
446 changes: 196 additions & 250 deletions ggml-cann/aclnn_ops.cpp

Large diffs are not rendered by default.

50 changes: 14 additions & 36 deletions ggml-cann/kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,22 @@ if (NOT SOC_TYPE)
endif()

file(GLOB SRC_FILES
dequantize_q4_0.cpp
quantize_q4_0.cpp
get_row_q8_0.cpp
)

string(TOLOWER "${CMAKE_BUILD_TYPE}" lowercase_CMAKE_BUILD_TYPE)
if(${lowercase_CMAKE_BUILD_TYPE} STREQUAL "debug")
if (NOT DEFINED ENV{CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH ${CANN_INSTALL_DIR}/tools/tikicpulib/lib/cmake)
endif()

find_package(tikicpulib REQUIRED)
add_library(cann_kernels ${SRC_FILES} ascendc_kernels.cpp)
target_link_libraries(cann_kernels PRIVATE
ascendcl
tikicpulib::ascend910B1
)

target_compile_features(cann_kernels PRIVATE cxx_std_17)
string(TOLOWER ${SOC_TYPE} SOC_VERSION)
set(ASCEND_CANN_PACKAGE_PATH ${CANN_INSTALL_DIR})
set(RUN_MODE "npu" CACHE STRING "run mode: npu/sim")

if(EXISTS ${ASCEND_CANN_PACKAGE_PATH}/compiler/tikcpp/ascendc_kernel_cmake)
set(ASCENDC_CMAKE_DIR ${ASCEND_CANN_PACKAGE_PATH}/compiler/tikcpp/ascendc_kernel_cmake)
elseif(EXISTS ${ASCEND_CANN_PACKAGE_PATH}/ascendc_devkit/tikcpp/samples/cmake)
set(ASCENDC_CMAKE_DIR ${ASCEND_CANN_PACKAGE_PATH}/ascendc_devkit/tikcpp/samples/cmake)
else()
string(TOLOWER ${SOC_TYPE} SOC_VERSION)
set(ASCEND_CANN_PACKAGE_PATH ${CANN_INSTALL_DIR})
set(RUN_MODE "npu" CACHE STRING "run mode: npu/sim")

if(EXISTS ${ASCEND_CANN_PACKAGE_PATH}/compiler/tikcpp/ascendc_kernel_cmake)
set(ASCENDC_CMAKE_DIR ${ASCEND_CANN_PACKAGE_PATH}/compiler/tikcpp/ascendc_kernel_cmake)
elseif(EXISTS ${ASCEND_CANN_PACKAGE_PATH}/ascendc_devkit/tikcpp/samples/cmake)
set(ASCENDC_CMAKE_DIR ${ASCEND_CANN_PACKAGE_PATH}/ascendc_devkit/tikcpp/samples/cmake)
else()
message(FATAL_ERROR "ascendc_kernel_cmake does not exist, please check whether the compiler package is installed.")
endif()
include(${ASCENDC_CMAKE_DIR}/ascendc.cmake)

ascendc_library(ascendc_kernels STATIC
${SRC_FILES}
)
#ascendc_compile_definitions(ascendc_kernels PRIVATE -DASCENDC_DUMP)
message(FATAL_ERROR "ascendc_kernel_cmake does not exist, please check whether the compiler package is installed.")
endif()
include(${ASCENDC_CMAKE_DIR}/ascendc.cmake)

add_library(cann_kernels STATIC ascendc_kernels.cpp)
target_link_libraries(cann_kernels PUBLIC ascendc_kernels)
endif()
ascendc_library(ascendc_kernels STATIC
${SRC_FILES}
)
56 changes: 0 additions & 56 deletions ggml-cann/kernels/ascendc_kernels.cpp

This file was deleted.

9 changes: 3 additions & 6 deletions ggml-cann/kernels/ascendc_kernels.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#ifndef ASCENDC_KERNELS_H
#define ASCENDC_KERNELS_H

#include "aclrtlaunch_ascendc_get_row_q8_0.h"
#include "get_row_q8_0.h"

#include <stdint.h>

void cann_dequantize_q4_0(uint32_t block_dim, void* stream, uint8_t* x, uint8_t* y, uint8_t* size);
void cann_quantize_q4_0(uint32_t block_dim, void* stream, uint8_t* x, uint8_t* y, uint8_t* size);

#endif //ASCENDC_KERNELS_H
#endif // ASCENDC_KERNELS_H
108 changes: 0 additions & 108 deletions ggml-cann/kernels/dequantize_q4_0.cpp

This file was deleted.

7 changes: 0 additions & 7 deletions ggml-cann/kernels/dequantize_q4_0.h

This file was deleted.

Loading

0 comments on commit 5430a30

Please sign in to comment.