Skip to content

Commit ee42f24

Browse files
add loongarch lsx and lasx optimize code
1 parent 0583484 commit ee42f24

File tree

5 files changed

+2792
-47
lines changed

5 files changed

+2792
-47
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ set(LLAMA_SCHED_MAX_COPIES "4" CACHE STRING "llama: max input copies for pipeli
134134
option(LLAMA_BUILD_TESTS "llama: build tests" ${LLAMA_STANDALONE})
135135
option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE})
136136
option(LLAMA_BUILD_SERVER "llama: build server example" ON)
137+
option(LLAMA_LASX "llama: enable lasx" ON)
138+
option(LLAMA_LSX "llama: enable lsx" ON)
137139

138140
# add perf arguments
139141
option(LLAMA_PERF "llama: enable perf" OFF)
@@ -1130,6 +1132,17 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64")
11301132
list(APPEND ARCH_FLAGS -mcpu=native -mtune=native)
11311133
#TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
11321134
endif()
1135+
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "loongarch64")
1136+
message(STATUS "loongarch64 detected")
1137+
1138+
list(APPEND ARCH_FLAGS -march=loongarch64)
1139+
if (LLAMA_LASX)
1140+
list(APPEND ARCH_FLAGS -mlasx)
1141+
endif()
1142+
if (LLAMA_LSX)
1143+
list(APPEND ARCH_FLAGS -mlsx)
1144+
endif()
1145+
11331146
else()
11341147
message(STATUS "Unknown architecture")
11351148
endif()

0 commit comments

Comments
 (0)