Repository navigation
Conversation
…cible#1949) Cook compiles one kernel per scene variant, and the first trace of a variant spends seconds in the driver compile. Keep the driver's pipeline cache in one file per user, adapter and Cook version so a second process can skip the compile, and report its state as pipelineCache (warm, cold, off, unsupported) beside compileSeconds and tracedSeconds. The file carries a length and a checksum checked before the driver sees it, is capped at 64 MiB, is written through a temporary file and a rename, and a damaged or oversized file is deleted and rebuilt. COOK_PIPELINE_CACHE=off switches it off and COOK_PIPELINE_CACHE_DIR moves it.
Contributor
Author
|
Lead: holding this one. On the RTX 3060, the first compile was slower with the cache on (9.9 s) than with it off (5.3 s), and the warm runs were the same either way (0.033 s vs 0.044 s), because the driver already keeps its own cache across processes. Before this merges, it needs either a measurement where it wins (another driver, Linux or lavapipe) or the cold slowdown explained and fixed. The compile-time reporting in crucible#2006 can land on its own, without the cache. |
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.
Part of codepawl/crucible#1949.
What
src/host/disk_pipeline_cache.rs: the driver's pipeline cache (wgpuPipelineCache, requested as an optional device feature) is loaded from and stored to one file per user, adapter and Cook version.%LOCALAPPDATA%\codepawl\cook\pipeline-cacheon Windows,$XDG_CACHE_HOME/cook/pipeline-cache(else~/.cache/cook/pipeline-cache) elsewhere.COOK_PIPELINE_CACHE_DIRmoves it,COOK_PIPELINE_CACHE=offswitches it off.traceNativeand session renders returnpipelineCache:warm,cold,offorunsupported.compileSecondsandtracedSecondswere already separate fields (thetimingsobject in the issue's repro does not exist); the README now says so.How I checked it
node --test tests/gpu/pipeline-cache.test.mjson the RTX 3060 (release addon built on this branch): 3 pass (two processes cold then warm with the same pixels, a flipped byte is refused and replaced,offwrites nothing).cargo test); I did not run cargo test locally.Evidence
Measured, RTX 3060, 160x90, 16 spp, a variant no process had compiled before, separate processes,
compileSeconds:The NVIDIA driver on Windows keeps its own disk cache per executable, so the second process is already fast with Cook's cache off. On this card the Cook cache therefore shows no measurable gain; it matters on drivers that keep no cache of their own. The first compile of a new variant (5 to 26 s here: 5 to 7 s without emitters, 26 s with one) is not removed by any cache.