fold: pin the VGPR-base table's round trip #577
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!577
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:fold-vgpr-bases-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).
What it pins:
foldappends a VGPR-base table to the folded code — for every copy whose VGPRs are moved,words.push(4 * w as u32); words.push(u32::from(d) | u32::from(s) << 16);, thenwords.push(bases.len() as u32); words.push(BASES_MAGIC);(crates/darner-shader/src/fold.rs, around :1698) — andvgpr_bases(:241) reads it back from the code's last words forir::buildandoracle64. It has two silent failure modes:if n < 2 || word(n - 1) != Some(BASES_MAGIC) { return Vec::new(); }andif 2 * count + 2 > n { return Vec::new(); }. An empty table makesir::buildtreat every upper-half copy as unbased, so a broken writer, a broken reader or a truncated program degrades silently; nothing tested the round trip without a GPU.This change adds two tests: one folds a small program with known moved copies and asserts
vgpr_basesreturns exactly those bases at exactly those byte offsets; the other pins both empty returns (code without the magic, and code too short to hold the count).How it was tested
5d48068(one commit onc8258f9).cargo test --locked -p darner-shader --lib -- fold— 34 passed, 0 failed (the wholefoldmodule).cargo clippy --locked -p darner-shader --all-targets -- -D warningspasses.4 * w→w):n < 2guard dropped:code_that_does_not_end_with_a_table_has_no_vgpr_basespanics withattempt to subtract with overflow.Each mutation was reverted with
git checkout --(nevergit stash).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;darner-shader's full lib suite takes ~40 minutes on this machine because ofemit::waterfall_tests, which also fails on a cleanmain(#227), so the crate was gated by itsfoldmodule (34 passed) plus clippy.darner-shaderis the only crate this change touches.Checklist
main.docs/asset-policy.md. (cargo xtask policy: 576 files ok.)Checked for overlap
crates/darner-shader/src/fold.rstoo; this change only adds to themod testsblock. No open or closed issue mentionsvgpr_bases,BASES_MAGICor the VGPR-base table.[pr-tests][shaders] fold: pin the VGPR-base table's round tripto fold: pin the VGPR-base table's round tripView 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.