Skip to content

Commit 1206b5f

Browse files
committed
build : enable link-time optimizations
1 parent 6e08281 commit 1206b5f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,8 @@ add_library(ggml OBJECT
676676
${GGML_SOURCES_EXTRA} ${GGML_HEADERS_EXTRA}
677677
)
678678

679+
set_property(TARGET ggml PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
680+
679681
target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES})
680682
target_compile_features(ggml PUBLIC c_std_11) # don't bump
681683
target_link_libraries(ggml PUBLIC Threads::Threads ${LLAMA_EXTRA_LIBS})

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ MK_CXXFLAGS = -std=c++11 -fPIC
120120

121121
# -Ofast tends to produce faster code, but may not be available for some compilers.
122122
ifdef LLAMA_FAST
123-
MK_CFLAGS += -Ofast
124-
MK_HOST_CXXFLAGS += -Ofast
125-
MK_CUDA_CXXFLAGS += -O3
123+
MK_CFLAGS += -flto -Ofast
124+
MK_HOST_CXXFLAGS += -flto -Ofast
125+
MK_CUDA_CXXFLAGS += -flto -O3
126126
else
127-
MK_CFLAGS += -O3
128-
MK_CXXFLAGS += -O3
127+
MK_CFLAGS += -flto -O3
128+
MK_CXXFLAGS += -flto -O3
129129
endif
130130

131131
# clock_gettime came in POSIX.1b (1993)

0 commit comments

Comments
 (0)