Skip to content

Commit 6cdc5d3

Browse files
committed
CUDA: compress mode option and default to size
cuda 12.8 added the option to specify stronger compression for binaries.
1 parent 36c258e commit 6cdc5d3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

ggml/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ option(GGML_CUDA_NO_PEER_COPY "ggml: do not use peer to peer copie
153153
option(GGML_CUDA_NO_VMM "ggml: do not try to use CUDA VMM" OFF)
154154
option(GGML_CUDA_FA_ALL_QUANTS "ggml: compile all quants for FlashAttention" OFF)
155155
option(GGML_CUDA_GRAPHS "ggml: use CUDA graphs (llama.cpp only)" ${GGML_CUDA_GRAPHS_DEFAULT})
156+
set (GGML_CUDA_COMPRESSION_MODE "size" CACHE STRING
157+
"ggml: cuda link binary compression mode; requires cuda 12.8+")
158+
set_property(CACHE GGML_CUDA_COMPRESSION_MODE PROPERTY STRINGS "none;speed;balance;size")
156159

157160
option(GGML_HIP "ggml: use HIP" OFF)
158161
option(GGML_HIP_GRAPHS "ggml: use HIP graph, experimental, slow" OFF)

ggml/src/ggml-cuda/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@ if (CUDAToolkit_FOUND)
9898

9999
set(CUDA_FLAGS -use_fast_math)
100100

101+
if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "12.8")
102+
# Options are:
103+
# - none (not recommended)
104+
# - speed (nvcc's default)
105+
# - balance
106+
# - size
107+
list(APPEND CUDA_FLAGS -compress-mode=${GGML_CUDA_COMPRESSION_MODE})
108+
endif()
109+
101110
if (GGML_FATAL_WARNINGS)
102111
list(APPEND CUDA_FLAGS -Werror all-warnings)
103112
endif()

0 commit comments

Comments
 (0)