Skip to content

Commit 1a2a17b

Browse files
add loongarch lsx and lasx optimize code
1 parent 5260486 commit 1a2a17b

File tree

5 files changed

+2822
-60
lines changed

5 files changed

+2822
-60
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ set(LLAMA_SCHED_MAX_COPIES "4" CACHE STRING "llama: max input copies for pipeli
128128
option(LLAMA_BUILD_TESTS "llama: build tests" ${LLAMA_STANDALONE})
129129
option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE})
130130
option(LLAMA_BUILD_SERVER "llama: build server example" ON)
131+
option(LLAMA_LASX "llama: enable lasx" ON)
132+
option(LLAMA_LSX "llama: enable lsx" ON)
131133

132134
# add perf arguments
133135
option(LLAMA_PERF "llama: enable perf" OFF)
@@ -1066,6 +1068,17 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64")
10661068
list(APPEND ARCH_FLAGS -mcpu=native -mtune=native)
10671069
#TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
10681070
endif()
1071+
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "loongarch64")
1072+
message(STATUS "loongarch64 detected")
1073+
1074+
list(APPEND ARCH_FLAGS -march=loongarch64)
1075+
if (LLAMA_LASX)
1076+
list(APPEND ARCH_FLAGS -mlasx)
1077+
endif()
1078+
if (LLAMA_LSX)
1079+
list(APPEND ARCH_FLAGS -mlsx)
1080+
endif()
1081+
10691082
else()
10701083
message(STATUS "Unknown architecture")
10711084
endif()

0 commit comments

Comments
 (0)