fold: a thread group with one z gives its third thread id zero #652
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!652
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:fold-thread-group-third-id"
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: the fold admits a thread group whose sides are not powers of two when it has one z —
if !flat_x && !(pow2(tx) && (pow2(ty) || tz == 1))(crates/darner-shader/src/fold.rs:1475), so an 8 × 3 × 1 group folds — but the prologue wrote its third console thread id as a shift byly = ty.trailing_zeros(), andtrailing_zerosislog2only for a power of two. Withty = 3the folded code computedid.z = flat >> 3, i.e. the y id, where the console'sid.z = flat / (tx * ty)is 0 for every thread of the group (flat < 24). Every folded program of such a group that declares three thread-id VGPRs (ComputeIo::thread_id_vgprs() == 3) then read a z the console never produced, andir::buildandoracle64both index v2 with it. The y id was unharmed (a shift bylxalone, andflat < tx * tykeeps it belowty).This change writes 0 for the third id when
tz == 1— the console's value for every thread of such a group — and keeps the shift fortz != 1, which the guard already limits to a power of two.How it was tested
ef6314b(one commit onc8258f9).cargo test --locked -p darner-shader --lib -- fold— 33 passed, 0 failed.oracle64::tests::a_thread_group_of_no_power_of_two_folds_the_consoles_three_ids: it folds an 8 × 3 × 1 group whose program stores all three thread ids, runs the folded program through the model, and checks the ids each thread gets against the console formula — which is 0 for z.cargo clippy --locked -p darner-shader --all-targets -- -D warningspasses.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.foldtests are green; the fulldarner-shadersuite is minutes long because of the pre-existing exhaustive oracle sweep (see #619), and the whole-workspace run is not green on this machine for the pre-existingdarner-gpureasons (#224, #150), neither of which this touches.tz != 1path is unchanged and only covered by its existing tests.Checklist
main.main.docs/asset-policy.md(cargo xtask policy: passes).Checked for overlap
crates/darner-shader/src/fold.rs; it does not mention the prologue's thread ids. No open or closed issue mentions a thread group's third id or a non-power-of-two group.[pr-fix][shaders] fold: a thread group with one z gives its third thread id zeroto fold: a thread group with one z gives its third thread id zeroTest needed — commit
ef6314bf; what to check:The problem on main: the fold admits a thread group whose sides are not powers of two when it has one z —
if !flat_x && !(pow2(tx) && (pow2(ty) || tz == 1))(crates/darner-shader/src/fold.rs:1475), so an 8 × 3 × 1 group folds — but the prologue wrote its third console thread id as a shift byly = ty.trailing_zeros(), andtrailing_zerosislog2only for a power of two. Withty = 3the folded code computedid.z = flat >> 3, i.e. the y id, where the console'sid.z = flat / (tx * ty)is 0 for every thread of the group (flat < 24). Every folded program of such a group that declares three thread-id VGPRs (ComputeIo::thread_id_vgprs() == 3) then read a z the console never produced, andir::buildandoracle64both index v2 with it. The y id was unharmed (a shift bylxalone, andflat < tx * tykeeps it belowty).This change writes 0 for the third id when
tz == 1— the console's value for every thread of such a group — and keeps the shift fortz != 1, which the guard already limits to a power of two.Evidence 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.