Skip to content

Commit 6f6b0db

Browse files
committed
build : disable lto for C++ (make) and enable existing LTO flag (cmake)
1 parent 1206b5f commit 6f6b0db

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ endif()
4545
# general
4646
option(LLAMA_STATIC "llama: static link libraries" OFF)
4747
option(LLAMA_NATIVE "llama: enable -march=native flag" ON)
48-
option(LLAMA_LTO "llama: enable link time optimization" OFF)
48+
option(LLAMA_LTO "llama: enable link time optimization" ON)
4949

5050
# debug
5151
option(LLAMA_ALL_WARNINGS "llama: enable all compiler warnings" ON)
@@ -676,8 +676,6 @@ add_library(ggml OBJECT
676676
${GGML_SOURCES_EXTRA} ${GGML_HEADERS_EXTRA}
677677
)
678678

679-
set_property(TARGET ggml PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
680-
681679
target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES})
682680
target_compile_features(ggml PUBLIC c_std_11) # don't bump
683681
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 += -flto -Ofast
124-
MK_HOST_CXXFLAGS += -flto -Ofast
125-
MK_CUDA_CXXFLAGS += -flto -O3
123+
MK_CFLAGS += -Ofast -flto
124+
MK_HOST_CXXFLAGS += -Ofast
125+
MK_CUDA_CXXFLAGS += -O3
126126
else
127-
MK_CFLAGS += -flto -O3
128-
MK_CXXFLAGS += -flto -O3
127+
MK_CFLAGS += -O3 -flto
128+
MK_CXXFLAGS += -O3
129129
endif
130130

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

0 commit comments

Comments
 (0)