Skip to content

Cache the ROCm and plain-clang Windows builds through sccache - #557

Merged
bernardladenthin merged 1 commit into
mainfrom
sccache-rocm-hip-launcher-and-xclang-override
Oct 22, 2026
Merged

bernardladenthin merged 1 commit into
mainfrom
sccache-rocm-hip-launcher-and-xclang-override

Conversation

@bernardladenthin

Copy link
Copy Markdown
Owner

Summary

  • Windows ROCm + plain-clang CPU job: CMake's runtime-library flags for clang with the GNU front end carry -Xclang -flto-visibility-public-std, which sccache refuses, so every TU was a cache miss (the ROCm job is the pipeline's critical path, 2:40-4:15 h). New llama/cmake/msvc-runtime-gnu-clang.cmake, loaded via CMAKE_USER_MAKE_RULES_OVERRIDE, selects the same runtime with the driver flag -fms-runtime-lib=static; build-windows-x86_64 installs sccache again.
  • Linux ROCm: the HIP TUs are the CMake language HIP and never reached the C/C++ launchers; build.sh adds CMAKE_HIP_COMPILER_LAUNCHER for GGML_HIP builds.
  • build.sh / build.bat default SCCACHE_IDLE_TIMEOUT=0, so the job summary's statistics count every request (they showed 67 resp. 2 of ~160).

Test plan

Measured locally before the change (one GPU target, sccache 0.18.0 over a local WebDAV server as a stand-in for Depot):

uncached today cold warm
Windows ROCm (MSVC 14.44, TheRock 10.0.0 clang 23) 325 s, 157/157 refused (-Xclang) 377 s 25 s
Linux ROCm (Docker, CI wheels) 310 s, HIP never reached sccache 304 s 10 s, 157/157 hits
  • Objects (9 TUs: C, C++, 7 HIP, pinned -cuid): every section identical between old and new flags except .drectve (CMake repeated /DEFAULTLIB:libcmt.lib); through sccache vs. without identical up to the COFF timestamp. Unpinned, HIP objects differ only in the __hip_cuid_<hash> name (clang hashes the command line) -- documented in build.sh and CLAUDE.md.
  • This tree (b11827) configured on Windows: no -Xclang on any Release TU.
  • check-natives.py, check-run-scripts.py, check-release-gate.py, check-shared-files.py clean; workflow parses as YAML.
  • CI is green on this branch
  • A second dispatched run shows hits for both ROCm jobs and build-windows-x86_64 in the ### sccache statistics summary (the first run fills the cache) -- that run gives the real number for 23/27 targets.
  • Docs / CHANGELOG updated (CLAUDE.md "sccache on every Windows Ninja job", "CI build cache"; TODO.md; CHANGELOG)

Related issues / PRs

Checklist

  • I have read CONTRIBUTING.md and CODE_OF_CONDUCT.md
  • My commits follow Conventional Commits (repo style: imperative subject, as the recent history)
  • No security-sensitive changes

🤖 Generated with Claude Code

https://claude.ai/code/session_01VszvDmRRPP1UcwozsUMY1L

The two ROCm jobs are the pipeline's critical path (Windows 2:40-4:15 h,
Linux ~2:50 h for the build step) and neither cached a single HIP TU:

- Windows: CMake's Platform/Windows-Clang.cmake implements
  CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded for clang with the GNU front
  end as `-Xclang -flto-visibility-public-std -D_MT -Xclang
  --dependent-lib=libcmt`, and sccache (0.18.0 and main) refuses the
  first flag ("Can't handle UnknownFlag arguments with -Xclang"). Every
  TU of the ROCm module (TheRock's clang compiles HIP as C++ there) and
  of the plain-clang CPU job was a miss; the CPU job had its sccache
  install step removed for that reason.
- Linux: ggml compiles the HIP TUs as the CMake language HIP, which the
  C/CXX launchers build.sh sets never reach (2 requests in the stats).

llama/cmake/msvc-runtime-gnu-clang.cmake, loaded through
CMAKE_USER_MAKE_RULES_OVERRIDE before project(), maps MultiThreaded and
MultiThreadedDebug to -fms-runtime-lib=static[_dbg] for that toolchain
only -- the driver flag llama/CMakeLists.txt already passed next to
CMake's sequence, which hands cc1 the same flags without -Xclang.
CMAKE_MSVC_RUNTIME_LIBRARY keeps its value: an empty one reached
try_compile and broke the C compiler check (mainCRTStartup undefined).
build.sh adds CMAKE_HIP_COMPILER_LAUNCHER for GGML_HIP builds, and
build-windows-x86_64 installs sccache again.

build.sh and build.bat default SCCACHE_IDLE_TIMEOUT to 0: with 600 s the
server stopped during long builds and the summary table counted only
what came after (67 of ~160 requests on Windows ROCm, 2 on Linux).

Measured before the change, one GPU target (gfx1100), sccache 0.18.0
over a local WebDAV server standing in for Depot:
- Windows, MSVC 14.44 (as windows-2022), TheRock 10.0.0 clang 23:
  today 157 requests all refused, 325 s; with the override 0 refused,
  377 s cold, 25 s warm.
- Linux, Docker, the CI wheels: 310 s uncached, 304 s cold, 157/157
  hits and 10 s warm.
- Objects, nine TUs (C, C++, seven HIP) with a pinned -cuid: every
  section identical between the old and the new flags except .drectve,
  where CMake's sequence repeated /DEFAULTLIB:libcmt.lib; through
  sccache and without it identical up to the COFF timestamp. Without a
  pinned CUID HIP objects differ in the __hip_cuid_<hash> name, which
  clang derives from the command line sccache slightly changes -- the
  build.sh comment that called a hit bit-identical says so now.
- This tree (b11827) configured on Windows: no -Xclang on any Release
  TU, ggml-base 9/9 requests cacheable.

A local build with sccache's disk backend hits mozilla/sccache#2788
(HIP --offload-compress vs. the preprocessor cache mode, "Failed to
parse included file path"); that mode does not exist for WebDAV, and
SCCACHE_DIRECT=false avoids it locally. Documented in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VszvDmRRPP1UcwozsUMY1L
@bernardladenthin
bernardladenthin merged commit 772998e into main Oct 22, 2026
8 of 14 checks passed
@bernardladenthin
bernardladenthin deleted the sccache-rocm-hip-launcher-and-xclang-override branch October 22, 2026 21:25
@sonarqubecloud

Copy link
Copy Markdown

This branch had an error being deployed

1 failed deployment
maven-central — 5a47fb4b Deployed Oct 22, 2026 by bernardladenthin via Verify GPG signing key (no secrets printed) #1320
startgate — 5a47fb4b Deployed Oct 22, 2026 by bernardladenthin via Start gate (abort window) #1320
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.

1 participant