Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake : pass -Werror through -Xcompiler #5579

Merged
merged 2 commits into from
Feb 19, 2024
Merged

cmake : pass -Werror through -Xcompiler #5579

merged 2 commits into from
Feb 19, 2024

Conversation

ggerganov
Copy link
Member

@ggerganov ggerganov commented Feb 19, 2024

This should fix the ggml-ci CUDA build, although for some reason it does not enable errors on warnings (-Werror) in the CUDA code when LLAMA_FATAL_WARNINGS=ON is set

https://github.com/ggml-org/ci/blob/8ec0ce186e1a6b60b6f46f3ffd1d342df2346aa4/llama.cpp/f5/3119cec4f073b6d214195ecbe1fad3abdf2b34/ggml-4-x86-cuda-v100/stdall#L131-L136

@ggerganov ggerganov requested a review from cebtenzzre February 19, 2024 08:06
@slaren
Copy link
Member

slaren commented Feb 19, 2024

It looks like -Werror takes an additional argument in nvcc, and it is ignored if passed with -Xcompiler. This should work for enabling all warnings as errors in CUDA:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1cfaa2e3..e906cfe5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -781,6 +781,10 @@ set(CUDA_CXX_FLAGS "")
 if (LLAMA_CUBLAS)
     set(CUDA_FLAGS -use_fast_math)

+    if (LLAMA_FATAL_WARNINGS)
+        list(APPEND CUDA_FLAGS -Werror all-warnings)
+    endif()
+
     if (LLAMA_ALL_WARNINGS AND NOT MSVC)
         set(NVCC_CMD ${CMAKE_CUDA_COMPILER} .c)
         if (NOT CMAKE_CUDA_HOST_COMPILER STREQUAL "")

@ggerganov
Copy link
Member Author

Thanks. I've enabled -Werror all-warnings for the ggml-ci builds now

@ggerganov ggerganov removed the request for review from cebtenzzre February 19, 2024 12:32
@ggerganov ggerganov merged commit d0e3ce5 into master Feb 19, 2024
56 of 62 checks passed
@ggerganov ggerganov deleted the gg/fix-werr-cuda branch February 19, 2024 12:45
jordankanter pushed a commit to jordankanter/llama.cpp that referenced this pull request Mar 13, 2024
* cmake : pass -Werror through -Xcompiler

ggml-ci

* make, cmake : enable CUDA errors on warnings

ggml-ci
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
* cmake : pass -Werror through -Xcompiler

ggml-ci

* make, cmake : enable CUDA errors on warnings

ggml-ci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants