pipeline: pin the cache key's field boundaries #574
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!574
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:pipeline-cache-key-test"
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?
Contributor role (optional)
What it changes
The problem on main: nothing. This is a tests-only change (no production line is edited), so it needs no A/B result and no gameplay run.
What it pins: the shader cache decides whether a stored translation is reused through
CacheKey, whose body hashes three fields with one hand-written separator (crates/darner-pipeline/src/cache.rs, the&[0]infrom_parts;CacheKey::newdelegates to it):The separator is load-bearing and was untested and unexplained: without it, id
"a"with version0x62and inputb"\x00x"hashes the same eight bytes (61 62 00 00 00 00 00 78) as id"ab"with version0and inputb"x", so one converter would be served the other's cached translation. Nothing said so, and a reader tidying the key path could delete it as redundant.This change adds one
#[cfg(test)]test with a localConverterwhose id and version are settable.How it was tested
e7c2646(one commit onc8258f9).cargo test --locked -p darner-pipeline --lib— 17 passed, 0 failed.cache::tests::cache_key_keeps_the_fields_apartpins three properties: (a)("test.named", 3, b"input")equals itself; (b)("a", 0x62, b"\x00x") != ("ab", 0, b"x")— the pair that collides when the0x00separator is dropped; (c)("ab", 7, b"") != ("a", 7, b"b")— the pair that collides if the version is hashed before the id. Every assertion compares keys only: no hex digest and no golden value, so ablake3bump cannot break it.git stash): deletingh.update(&[0])makes (b) fail, and hashing the version before the id makes (c) fail.cargo clippy --locked -p darner-pipeline --all-targets -- -D warningspasses.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.cargo test --workspace --locked: not run to completion here; the pre-existingdarner-gputest deadlock (#224) and thedarner-shaderwaterfall fixture failure (#227) make the whole-workspace run non-green on this machine, and neither crate is touched.darner-pipeline's suite is green (17 passed).crates/darner-pipeline/src/lib.rs, which open PR #408 changes); the test's comment carries the explanation.Checklist
main.docs/asset-policy.md. (cargo xtask policy: 576 files ok.)Checked for overlap
crates/darner-pipeline/src/lib.rs(notcache.rs), which is why the doc comment the finding suggested was left out of this change. No open pull request changescrates/darner-pipeline/src/cache.rs, and no open or closed issue mentionsCacheKeyor the separator.[pr-tests] pipeline: pin the cache key's field boundariesto pipeline: pin the cache key's field boundariesView 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.