build : enable link-time optimizations

This commit is contained in:
Georgi Gerganov 2023-10-30 15:12:54 +02:00
parent 6e08281e58
commit 1206b5f3be
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 7 additions and 5 deletions

View file

@ -676,6 +676,8 @@ add_library(ggml OBJECT
${GGML_SOURCES_EXTRA} ${GGML_HEADERS_EXTRA} ${GGML_SOURCES_EXTRA} ${GGML_HEADERS_EXTRA}
) )
set_property(TARGET ggml PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES}) target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES})
target_compile_features(ggml PUBLIC c_std_11) # don't bump target_compile_features(ggml PUBLIC c_std_11) # don't bump
target_link_libraries(ggml PUBLIC Threads::Threads ${LLAMA_EXTRA_LIBS}) target_link_libraries(ggml PUBLIC Threads::Threads ${LLAMA_EXTRA_LIBS})

View file

@ -120,12 +120,12 @@ MK_CXXFLAGS = -std=c++11 -fPIC
# -Ofast tends to produce faster code, but may not be available for some compilers. # -Ofast tends to produce faster code, but may not be available for some compilers.
ifdef LLAMA_FAST ifdef LLAMA_FAST
MK_CFLAGS += -Ofast MK_CFLAGS += -flto -Ofast
MK_HOST_CXXFLAGS += -Ofast MK_HOST_CXXFLAGS += -flto -Ofast
MK_CUDA_CXXFLAGS += -O3 MK_CUDA_CXXFLAGS += -flto -O3
else else
MK_CFLAGS += -O3 MK_CFLAGS += -flto -O3
MK_CXXFLAGS += -O3 MK_CXXFLAGS += -flto -O3
endif endif
# clock_gettime came in POSIX.1b (1993) # clock_gettime came in POSIX.1b (1993)