From d82e2744b64dddda890995dcd667de5cfa43bc3f Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 12 Oct 2026 01:36:11 +0200 Subject: [PATCH] Silence the Windows HIP build's 83,362 warnings, and keep the Linux ones Measured in run 38172107721: the Windows ROCm job's log is 714,345 lines with 83,362 warning messages, while the Linux ROCm job -- the same upstream sources, the same TheRock clang, the same 23 GPU targets -- has 9 warnings in 2,455 lines. The Windows job is 60 times larger than the next biggest job of that run and carries 98.5 percent of all warnings its Windows jobs emit; SYCL is second with 724 in 12k lines, everything else is between 0 and 407. The cause is the language, not the arch count. Upstream compiles the HIP sources as plain C++ on Windows (CXX_IS_HIPCC on WIN32) and as the HIP language on Linux, and clang's C++ frontend reports what the HIP one does not: sign-compare 29,673 times, nested-anon-types 17,964, missing-noreturn 16,378, then unused variables, missing braces, unused parameters, cast-qual and unreachable breaks. Every one of them is in ggml/src/ggml-cuda/*.cu, upstream's own code -- not a line of ours, and nothing we would ever act on. So -w on the ggml-hip target, Windows only, which subsumes the dllimport suppression added earlier. Suppressing a whole warning set is normally the wrong instrument, and what makes it right here is the Linux job: it compiles the same sources and keeps every warning in a log short enough to read, so the information is preserved where it is legible and dropped where it is multiplied by 23. It also ends the alternative, which was chasing one more warning class per toolchain bump. Errors are untouched -- a real compile failure still fails the job. The answer to whether other jobs need the same is measured rather than assumed: no. The table in TODO.md lists all eight, and outside the ROCm job the logs are between 1,068 and 11,981 lines, which is readable. Worth an upstream issue with that table, since their own windows-rocm job pays the identical cost and the fix is theirs -- either the warnings or the C++-on-Windows choice. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G --- TODO.md | 33 +++++++++++++++++++++++++++++++-- llama/CMakeLists.txt | 20 ++++++++++++++++++-- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index 79999166..b0fa3679 100644 --- a/TODO.md +++ b/TODO.md @@ -736,8 +736,37 @@ accepted upstream change deletes a patch from the bump checklist once the pin is carries an `-Xclang` argument, which on Windows every plain-clang TU does -- CMake's runtime-library selection puts it there -- so no plain-clang Windows build caches at all (CLAUDE.md "Windows natives"); that one is an sccache issue, if none is open. -- **A fourth, measured 2026-10-11: `ggml.h`'s `dllimport` form reaches the HIP *device* pass and - floods the log.** `GGML_API` expands to `__declspec(dllimport) extern` for a consumer of a shared +- **A fourth, measured 2026-10-11 and again 2026-10-12: the Windows HIP build produces 83,362 + compiler warnings, and the Linux one produces 9.** The dllimport note below was the first + symptom; the full measurement came from run 38172107721, where the Windows ROCm job's log was + **714,345 lines with 83,362 warning messages** against **2,455 lines and 9 warnings** in the Linux + ROCm job -- the same upstream sources, the same TheRock clang, the same 23 GPU targets. It is + **60x larger than the next biggest job of that run** and carries **98.5%** of all the warnings its + Windows jobs emit: + + | job | log lines | warnings | + |---|---:|---:| + | **Windows ROCm/HIP** | **714,345** | **83,362** | + | Windows SYCL | 11,981 | 724 | + | Windows CPU (clang) | 2,627 | 407 | + | Linux CUDA | 3,266 | 9 | + | Linux ROCm/HIP | 2,455 | 9 | + | C++ Tests Windows | 1,655 | 66 | + | Windows arm64 | 1,499 | 24 | + | Windows CUDA | 1,068 | 0 | + + The cause is **the language, not the arch count**: upstream compiles the HIP sources as plain C++ + on Windows (`CXX_IS_HIPCC` on `WIN32`) and as the HIP language on Linux, and clang's C++ frontend + reports what the HIP one does not -- `-Wsign-compare` 29,673 times, `-Wnested-anon-types` 17,964, + `-Wmissing-noreturn` 16,378, then unused variables, missing braces, unused parameters, cast-qual + and unreachable breaks. **Every one is in `ggml/src/ggml-cuda/*.cu`**, upstream's own code: not a + line of ours. Mitigated downstream with `-w` on the `ggml-hip` target, Windows only, which + subsumes the dllimport suppression; the Linux job keeps every warning, so the information stays + where it is legible. **Worth an upstream issue with this table** -- the fix is theirs (either the + warnings or the C++-on-Windows choice), and their own `windows-rocm` job pays the same cost. + +- **The original dllimport note, which is one of the eight classes above: `ggml.h`'s `dllimport` + form reaches the HIP *device* pass.** `GGML_API` expands to `__declspec(dllimport) extern` for a consumer of a shared ggml on `_WIN32`, and HIP compiles every translation unit once per GPU architecture for the amdgcn **device** target, which has no DLL storage class -- so clang reports `__declspec attribute 'dllimport' is not supported` for each `GGML_API` declaration, times the 23 diff --git a/llama/CMakeLists.txt b/llama/CMakeLists.txt index eea52cfc..03f6218c 100644 --- a/llama/CMakeLists.txt +++ b/llama/CMakeLists.txt @@ -452,9 +452,25 @@ if(TARGET ggml-hip) # Upstream has the same flood in its own windows-rocm job -- worth an issue with these counts # (TODO.md, "Upstream submissions"), since the real fix belongs in ggml.h: a device pass should # not see the dllimport form at all. + # + # Measured again in run 38172107721, and the comparison is what decided the form of this: the + # Windows ROCm job's log was **714,345 lines with 83,362 warning messages**, while the Linux ROCm + # job -- the same upstream sources, the same TheRock clang, the same 23 GPU targets -- had **9 + # warnings in 2,455 lines**. The difference is not the arch count but the language: upstream + # compiles the HIP sources as plain C++ on Windows (`CXX_IS_HIPCC` on `WIN32`) and as the HIP + # language on Linux, and clang's C++ frontend reports what the HIP one does not -- + # `-Wsign-compare` 29,673 times, `-Wnested-anon-types` 17,964, `-Wmissing-noreturn` 16,378, then + # unused variables, missing braces, unused parameters, cast-qual, unreachable breaks. **Every one + # of them is in `ggml/src/ggml-cuda/*.cu`**, upstream's own code: not a single line of ours. + # + # So `-w` on this target on Windows, which subsumes the dllimport suppression above. Suppressing a + # whole warning set is normally the wrong instrument, and the reason it is right here is the Linux + # job: it compiles the same sources and keeps every warning, in a log short enough to read. The + # information is preserved where it is legible and dropped where it is multiplied by 23 -- rather + # than chasing one class per toolchain bump, which the eight above would otherwise require. + # Errors are untouched: a real compile failure still fails the job. if(WIN32) - target_compile_options(ggml-hip PRIVATE - $<$:-Wno-ignored-attributes>) + target_compile_options(ggml-hip PRIVATE $<$:-w>) endif() endif()