cache shared shaders per batch in known::names, make, and recipes #647
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!647
Loading…
Reference in a new issue
No description provided.
Delete branch "RileyW/Darner:pr/known-shader-cache"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Note: This exact Darner revision has not yet been run end-to-end in the game on Darner main. The same caching optimization has been used in pipeline precompilation on our Windows 10 (i7-8700, RTX 3080 20 GiB) fork, and this Darner port passes all 16
pipeline::known::tests(including 2 new regression tests) and all workspace gates.Contributor role (optional)
What it changes
crates/darner-gpu/src/pipeline/known.rs,names(),make(), andrecipes()invokeparse()with a raw disk reader closure that seeksknown-shaders.bin, allocates a freshVec, reads the full shader container bytes, hashes them withblake3, and locks the globalSHADERSmap on every single shader reference in every pipeline entry.darner warm,darner preload, and early-pipeline startup loading, Darner processes thousands to ~84,000 pipelines that heavily reuse the same vertex, pixel, and compute shaders across state permutations. Re-reading, re-hashing, and relocking the globalSHADERSmutex for every shared shader wastes disk I/O, heap allocations, and cross-thread CPU time during startup and shader precompilation.ShaderLoaderholding aHashMapkeyed by(stage_id, hash)toArc<Shader>and wires it intonames(),make(), andrecipes(). Shared shaders in a batch are read from disk and looked up once, returningArc::cloneon subsequent hits with zero repeated seeks, allocations,blake3hashes, or global mutex contention. Also validatesstage_idbefore reading from disk. Adds unit testsshader_loader_caches_shared_shaders_per_stage_and_hashandrecipes_reuses_cached_shader_arc_across_pipelines.How it was tested
97089d4(PR branch onc8258f9) and96096db(merged intoriley/all)cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)cargo xtask policyandcargo xtask policy --staged: passed (576 files ok)cargo test -p darner-gpu --lib --locked pipeline::known::tests::: passed (16 passed, 0 failed)Arc<Shader>instances)Arc::ptr_eqinstances acrossrecipes(); no gameplay frame-rate claim (startup andwarm/preloadthroughput improvement).97089d4and96096dbwarmon fork; pure CPU/I/O cache)darner warmnaming and precompilation)darner warmpass on Darner main.Checklist
main.docs/asset-policy.md.Checked for overlap
[pr-performance][warm] cache shared shaders per batch in known::names, make, and recipesto cache shared shaders per batch in known::names, make, and recipesTest needed — commit
97089d40; what to check:crates/darner-gpu/src/pipeline/known.rs,names(),make(), andrecipes()invokeparse()with a raw disk reader closure that seeksknown-shaders.bin, allocates a freshVec, reads the full shader container bytes, hashes them withblake3, and locks the globalSHADERSmap on every single shader reference in every pipeline entry.darner warm,darner preload, and early-pipeline startup loading, Darner processes thousands to ~84,000 pipelines that heavily reuse the same vertex, pixel, and compute shaders across state permutations. Re-reading, re-hashing, and relocking the globalSHADERSmutex for every shared shader wastes disk I/O, heap allocations, and cross-thread CPU time during startup and shader precompilation.ShaderLoaderholding aHashMapkeyed by(stage_id, hash)toArc<Shader>and wires it intonames(),make(), andrecipes(). Shared shaders in a batch are read from disk and looked up once, returningArc::cloneon subsequent hits with zero repeated seeks, allocations,blake3hashes, or global mutex contentEvidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.
Reply
testingto take this run; it's free again after 24 h with no results.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.