From 6f6b0db6d114d1172e92f94238a58f9270b6470c Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Mon, 30 Oct 2023 15:40:01 +0200 Subject: [PATCH] build : disable lto for C++ (make) and enable existing LTO flag (cmake) --- CMakeLists.txt | 4 +--- Makefile | 10 +++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 410fc174a..e388f1c22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ endif() # general option(LLAMA_STATIC "llama: static link libraries" OFF) option(LLAMA_NATIVE "llama: enable -march=native flag" ON) -option(LLAMA_LTO "llama: enable link time optimization" OFF) +option(LLAMA_LTO "llama: enable link time optimization" ON) # debug option(LLAMA_ALL_WARNINGS "llama: enable all compiler warnings" ON) @@ -676,8 +676,6 @@ add_library(ggml OBJECT ${GGML_SOURCES_EXTRA} ${GGML_HEADERS_EXTRA} ) -set_property(TARGET ggml PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) - target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES}) target_compile_features(ggml PUBLIC c_std_11) # don't bump target_link_libraries(ggml PUBLIC Threads::Threads ${LLAMA_EXTRA_LIBS}) diff --git a/Makefile b/Makefile index 048ad5d4e..2a2ac8505 100644 --- a/Makefile +++ b/Makefile @@ -120,12 +120,12 @@ MK_CXXFLAGS = -std=c++11 -fPIC # -Ofast tends to produce faster code, but may not be available for some compilers. ifdef LLAMA_FAST -MK_CFLAGS += -flto -Ofast -MK_HOST_CXXFLAGS += -flto -Ofast -MK_CUDA_CXXFLAGS += -flto -O3 +MK_CFLAGS += -Ofast -flto +MK_HOST_CXXFLAGS += -Ofast +MK_CUDA_CXXFLAGS += -O3 else -MK_CFLAGS += -flto -O3 -MK_CXXFLAGS += -flto -O3 +MK_CFLAGS += -O3 -flto +MK_CXXFLAGS += -O3 endif # clock_gettime came in POSIX.1b (1993)