mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-25 22:08:46 +01:00
build : pass all warning flags to nvcc via -Xcompiler (#5570)
* build : pass all warning flags to nvcc via -Xcompiler * make : fix apparent mis-merge from #3952 * make : fix incorrect GF_CC_VER for CUDA host compiler
This commit is contained in:
parent
14278f55d2
commit
a0c2dad9d4
@ -778,10 +778,7 @@ endif()
|
|||||||
set(CUDA_CXX_FLAGS "")
|
set(CUDA_CXX_FLAGS "")
|
||||||
|
|
||||||
if (LLAMA_CUBLAS)
|
if (LLAMA_CUBLAS)
|
||||||
set(CUDA_FLAGS ${CXX_FLAGS} -use_fast_math)
|
set(CUDA_FLAGS -use_fast_math)
|
||||||
if (NOT MSVC)
|
|
||||||
list(APPEND CUDA_FLAGS -Wno-pedantic)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (LLAMA_ALL_WARNINGS AND NOT MSVC)
|
if (LLAMA_ALL_WARNINGS AND NOT MSVC)
|
||||||
set(NVCC_CMD ${CMAKE_CUDA_COMPILER} .c)
|
set(NVCC_CMD ${CMAKE_CUDA_COMPILER} .c)
|
||||||
@ -814,7 +811,11 @@ if (LLAMA_CUBLAS)
|
|||||||
message("-- CUDA host compiler is ${CUDA_CCID} ${CUDA_CCVER}")
|
message("-- CUDA host compiler is ${CUDA_CCID} ${CUDA_CCVER}")
|
||||||
|
|
||||||
get_flags(${CUDA_CCID} ${CUDA_CCVER})
|
get_flags(${CUDA_CCID} ${CUDA_CCVER})
|
||||||
list(APPEND CUDA_CXX_FLAGS ${GF_CXX_FLAGS}) # This is passed to -Xcompiler later
|
list(APPEND CUDA_CXX_FLAGS ${CXX_FLAGS} ${GF_CXX_FLAGS}) # This is passed to -Xcompiler later
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
list(APPEND CUDA_CXX_FLAGS -Wno-pedantic)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
28
Makefile
28
Makefile
@ -220,30 +220,6 @@ ifeq ($(LLAMA_FATAL_WARNINGS),1)
|
|||||||
MK_CXXFLAGS += -Werror
|
MK_CXXFLAGS += -Werror
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CC_IS_CLANG), 1)
|
|
||||||
# clang options
|
|
||||||
MK_CFLAGS += -Wunreachable-code-break -Wunreachable-code-return
|
|
||||||
MK_HOST_CXXFLAGS += -Wunreachable-code-break -Wunreachable-code-return -Wmissing-prototypes -Wextra-semi
|
|
||||||
|
|
||||||
ifneq '' '$(and $(CC_IS_LLVM_CLANG),$(filter 1,$(shell expr $(CC_VER) \>= 030800)))'
|
|
||||||
MK_CFLAGS += -Wdouble-promotion
|
|
||||||
endif
|
|
||||||
ifneq '' '$(and $(CC_IS_APPLE_CLANG),$(filter 1,$(shell expr $(CC_VER) \>= 070300)))'
|
|
||||||
MK_CFLAGS += -Wdouble-promotion
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
# gcc options
|
|
||||||
MK_CFLAGS += -Wdouble-promotion
|
|
||||||
MK_HOST_CXXFLAGS += -Wno-array-bounds
|
|
||||||
|
|
||||||
ifeq ($(shell expr $(CC_VER) \>= 070100), 1)
|
|
||||||
MK_HOST_CXXFLAGS += -Wno-format-truncation
|
|
||||||
endif
|
|
||||||
ifeq ($(shell expr $(CC_VER) \>= 080100), 1)
|
|
||||||
MK_HOST_CXXFLAGS += -Wextra-semi
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# this version of Apple ld64 is buggy
|
# this version of Apple ld64 is buggy
|
||||||
ifneq '' '$(findstring dyld-1015.7,$(shell $(CC) $(LDFLAGS) -Wl,-v 2>&1))'
|
ifneq '' '$(findstring dyld-1015.7,$(shell $(CC) $(LDFLAGS) -Wl,-v 2>&1))'
|
||||||
MK_CPPFLAGS += -DHAVE_BUGGY_APPLE_LINKER
|
MK_CPPFLAGS += -DHAVE_BUGGY_APPLE_LINKER
|
||||||
@ -468,7 +444,7 @@ ggml-cuda.o: ggml-cuda.cu ggml-cuda.h
|
|||||||
ifdef JETSON_EOL_MODULE_DETECT
|
ifdef JETSON_EOL_MODULE_DETECT
|
||||||
$(NVCC) -I. -Icommon -D_XOPEN_SOURCE=600 -D_GNU_SOURCE -DNDEBUG -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I/usr/local/cuda/targets/aarch64-linux/include -std=c++11 -O3 $(NVCCFLAGS) -Xcompiler "$(CUDA_CXXFLAGS)" -c $< -o $@
|
$(NVCC) -I. -Icommon -D_XOPEN_SOURCE=600 -D_GNU_SOURCE -DNDEBUG -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I/usr/local/cuda/targets/aarch64-linux/include -std=c++11 -O3 $(NVCCFLAGS) -Xcompiler "$(CUDA_CXXFLAGS)" -c $< -o $@
|
||||||
else
|
else
|
||||||
$(NVCC) $(BASE_CXXFLAGS) $(NVCCFLAGS) -Wno-pedantic -Xcompiler "$(CUDA_CXXFLAGS)" -c $< -o $@
|
$(NVCC) $(NVCCFLAGS) -Xcompiler "$(CUDA_CXXFLAGS)" -c $< -o $@
|
||||||
endif # JETSON_EOL_MODULE_DETECT
|
endif # JETSON_EOL_MODULE_DETECT
|
||||||
endif # LLAMA_CUBLAS
|
endif # LLAMA_CUBLAS
|
||||||
|
|
||||||
@ -579,7 +555,7 @@ override LDFLAGS := $(MK_LDFLAGS) $(LDFLAGS)
|
|||||||
ifdef LLAMA_CUBLAS
|
ifdef LLAMA_CUBLAS
|
||||||
GF_CC := $(NVCC) $(NVCCFLAGS) 2>/dev/null .c -Xcompiler
|
GF_CC := $(NVCC) $(NVCCFLAGS) 2>/dev/null .c -Xcompiler
|
||||||
include scripts/get-flags.mk
|
include scripts/get-flags.mk
|
||||||
CUDA_CXXFLAGS := $(GF_CXXFLAGS)
|
CUDA_CXXFLAGS := $(BASE_CXXFLAGS) $(GF_CXXFLAGS) -Wno-pedantic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
ifeq '' '$(findstring clang,$(shell $(GF_CC) --version))'
|
ifeq '' '$(findstring clang,$(shell $(GF_CC) --version))'
|
||||||
GF_CC_IS_GCC = 1
|
GF_CC_IS_GCC = 1
|
||||||
GF_CC_VER := $(shell { $(GF_CC) -dumpfullversion 2>/dev/null || $(GF_CC) -dumpversion; } | awk -F. '{ printf("%02d%02d%02d", $$1, $$2, $$3) }')
|
GF_CC_VER := $(shell { $(GF_CC) -dumpfullversion 2>/dev/null; echo; $(GF_CC) -dumpversion; } | awk -F. '/./ { printf("%02d%02d%02d", $$1, $$2, $$3); exit }')
|
||||||
else
|
else
|
||||||
GF_CC_IS_CLANG = 1
|
GF_CC_IS_CLANG = 1
|
||||||
ifeq '' '$(findstring Apple,$(shell $(GF_CC) --version))'
|
ifeq '' '$(findstring Apple,$(shell $(GF_CC) --version))'
|
||||||
|
Loading…
Reference in New Issue
Block a user