CI: ccache the SD CUDA leg - #9
Merged
Merged
Conversation
This leg rebuilt every object on every run. It took 3903 s of the 4121 s job on 2026-08-09 and 4942 s on the run before it, with no speedup between the two, while every other job in the pipeline finished in under 8 minutes. The repo held no cache entry for it at all, only the ROCm ones build.yml writes. Key on the CUDA version and the architecture list, since both decide the objects, and set the CUDA compiler launcher as well as C and CXX: nvcc is nearly the whole build and Jimver installs it outside the default search. Save on always() so a failed or capped job keeps what it compiled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Run 31289281107 took 72m43s. One job is the whole run:
Inside that job, one step:
Build sd-cli + sd-server (CUDA)at 3903s. Toolkit install was 82s, packaging 57s, upload 31s.The cause is that this pipeline has no ccache anywhere.
unsloth-sd-prebuilt.ymlhas zero mentions ofccache,COMPILER_LAUNCHERoractions/cache, so the CUDA leg recompiles all seven architectures from scratch every time. The only ccache in the repo is inbuild.yml, keyedwindows-rocm-*andubuntu-rocm-cmake-*.Three things confirm it rather than one:
build.yml. Nothing was ever written for this job.Change
Ports the pattern already used by the llama.cpp CUDA legs, which run 407-665s each with 90-94% hit rates on a larger codebase.
max-size: 2G.restore-keysdrops the tag so a new tag starts from the previous generation instead of from nothing.CMAKE_CUDA_COMPILER_LAUNCHER. That one carries this build: nvcc is nearly all of the 65 minutes, and Jimver installs it outside the default search, so caching only C and CXX would leave the expensive half uncached.always(), so a failed or capped job keeps what it compiled (CI: keep ccache on failed builds, bound the CUDA Windows timeout, stop uploading the debug bundle on green runs llama.cpp#81). This leg iscontinue-on-error, so a failure here is routine rather than exceptional.ccache --evict-older-than 14don!cancelled(), so the short teardown window goes to the save rather than to housekeeping.ccache --show-statsafter the build, so the hit rate is visible in the log instead of having to be inferred.Behaviour is otherwise unchanged: same toolkit, same architecture list, same targets, same bundle.
Expected effect
Cold cache is unchanged at around 65 minutes. Warm runs should drop that leg well under 10 minutes and take the pipeline off a 70 minute critical path.
Not in this PR
The leg still builds all seven architectures (
75;80;86;89;90;100;120) serially in one job, where llama.cpp spreads the same span across parallel matrix profiles. That is the other half of the 65 minutes and a larger change, worth deciding separately.-j "$(nproc)"is also left alone. llama.cpp pins its multi-arch nvcc builds to-j 3because they peak at about 3 GB host RSS, and 4 parallel nvcc processes on a 16 GB runner is close to the edge, but this job has not been failing on memory so I have not touched it.Testing
The workflow parses, and I checked every step's resolved inputs rather than just the step list, which caught the new steps having been spliced between
path:andif-no-files-found:on the upload step. Confirmed against GitHub's context availability table that theenvcontext is valid insteps.*.with, sincecuda:now reads from it.The real check is the next run's
ccache --show-statsand the second run after that, which is the first one able to hit.