build: cache native compilation and incremental image builds - #97
Draft
DuncanBetts wants to merge 4 commits into
Draft
build: cache native compilation and incremental image builds#97DuncanBetts wants to merge 4 commits into
DuncanBetts wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e64041e07a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
kaushikvira
added a commit
to kaushikvira/ninfer
that referenced
this pull request
Sep 7, 2026
Port of upstream PR Neroued#97 (DuncanBetts/ninfer build/cache-cxx-cuda): - add ccache, set CCACHE_DIR=/ccache (cache mount) + 20G max - compiler launchers = ccache for C/C++/CUDA - unchanged translation units stop recompiling on every docker build Also staged: include/skip Responses fixes (333df.., dbe12502+). Our fork main is now upstream 487f897 + engine registration + tools/docs + Responses include/skip + build cache.
kaushikvira
added a commit
to kaushikvira/ninfer
that referenced
this pull request
Sep 7, 2026
… tooling') main is upstream 487f897 + 9 commits: own nvfp4full registration + graft tool, the Neroued#148/Neroued#97/Neroued#160/Neroued#61 PR ports (temp, drop as they merge), the registry doc, and curl for healthchecks. Registry table in PATCHES.md now covers all 9 (added curl + registry rows, date -> 2026-09-15).
DuncanBetts
marked this pull request as draft
September 12, 2026 02:32
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.
Upstream image rebuilds discard the entire CMake/Ninja build tree when source files change. This PR retains that tree and adds ccache: editing one C++ file and one CUDA file then runs seven affected build steps instead of all 278. Native builds can enable the same compiler cache through standard CMake launchers.
No project-specific CMake option is needed: CMake already supports compiler launchers for all three languages. The runtime image and inference behavior are unchanged.
Rebuild comparison: upstream versus this PR
Both recordings follow the same workload: build the image, add the same harmless
static_asserttosrc/artifact/typed_binding.cppandsrc/ops/launcher/residual_add.cu, rebuild, then restore the sources. The baseline is upstream without this PR; the after result is the final implementation with persistent Ninja and compiler caches.The recorded rebuild is approximately 6.4× faster. These are single-run measurements recorded separately, not a contemporaneous controlled benchmark. The baseline is the original upstream recording; it has not been rerun alongside the final revision. The times cover image rebuilding, not native-build or inference performance.
The after run started with empty, isolated build and compiler caches. Its initial build made 263 compiler calls; the edited rebuild made only two more. Ninja skipped all 261 unchanged compiler inputs, so the cumulative ccache statistics are 265 calls, zero hits, and 265 misses. CUDA device linking still took about 13.4 seconds on the rebuild.
Validation
Using Ubuntu 24.04, CMake 3.28.3, CUDA 13.1.115, and ccache 4.9.1:
ninja: no work to do, with no new compiler-cache calls.--helpwith NVIDIA driver libraries exposed; the runtime image contains neither ccache nor rsync.git diff --checkpassed.Validation used Podman's Dockerfile support because Docker and a native host CMake/CUDA toolchain are not installed here. Docker BuildKit and a bare-host build were not executed; the native instructions use standard CMake settings and introduce no container dependency.
References
The original PR said "with careful steering and review by myself". This updated version I have not reviewed properly yet, so I am reverting its status to "draft" until I do.
Changes made using AI. Thanks for creating Ninfer Neroued, I hope you find these build time savings useful in future work, you can take it as a token of my appreciation :).