Spaces:
Sleeping
Sleeping
amritahs-ibm commited on
Commit ·
18bdb35
1
Parent(s): 5f667d1
ggml : optimize llamafile cpu matrix multiplication for ppc64le (llama/10156)
Browse filesThis change upstreams llamafile's cpu matrix
multiplication kernels for ppc64le using MMA
builtins for FP32 datatype.
This change results in a consistent 90%
improvement in input processing time, and 20%
to 80% improvement in output processing time,
across various batch sizes.
The patch is tested with Meta-Lllama-3-8B,
Mistral-7B, Llama-2-7B-chat-hf models on a
IBM POWER10 machine.
Signed-off-by: Amrita H S <amritahs@linux.vnet.ibm.com>
- ggml/src/CMakeLists.txt +7 -2
ggml/src/CMakeLists.txt
CHANGED
|
@@ -1265,8 +1265,13 @@ elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64" OR CMAKE_GENERATOR_PLATFORM_LW
|
|
| 1265 |
endif()
|
| 1266 |
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64")
|
| 1267 |
message(STATUS "PowerPC detected")
|
| 1268 |
-
|
| 1269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1270 |
else()
|
| 1271 |
list(APPEND ARCH_FLAGS -mcpu=native -mtune=native)
|
| 1272 |
#TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
|
|
|
|
| 1265 |
endif()
|
| 1266 |
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64")
|
| 1267 |
message(STATUS "PowerPC detected")
|
| 1268 |
+
execute_process(COMMAND bash -c "grep POWER10 /proc/cpuinfo | head -n 1"
|
| 1269 |
+
OUTPUT_VARIABLE POWER10_M)
|
| 1270 |
+
string(FIND ${POWER10_M} "POWER10" substring_index)
|
| 1271 |
+
if(${substring_index} GREATER_EQUAL 0)
|
| 1272 |
+
list(APPEND ARCH_FLAGS -mcpu=power10)
|
| 1273 |
+
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
|
| 1274 |
+
list(APPEND ARCH_FLAGS -mcpu=powerpc64le)
|
| 1275 |
else()
|
| 1276 |
list(APPEND ARCH_FLAGS -mcpu=native -mtune=native)
|
| 1277 |
#TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
|