Shaders: a folded program refused for a lane mask read as data is folded again with every lane-mask branch taken wave-wide #501
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!501
Loading…
Reference in a new issue
No description provided.
Delete branch "ntsthay/fold-every-lane"
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
On a 32-lane host, the folded form (
docs/wave64-folded.md) turned some programs down with "a lane mask holding lanes elsewhere read as data". Those programs then fell to the approximate local waves. Three of them in GTA VI 1.0.2.1 do this:CS_ClusterLightsWorldSpace(d3e5b737ea7cc150)CS_ClusterLightsWorldSpaceIntensityBased(55d2bce91ec9abcc)CS_RTConstantCostShadowsTileClassificationNormalCones(2620618869072a85)The light clustering programs walk the set bits of a ballot in a scalar loop (
s_ff1, then the bit is cleared), with the mask carried around the loop. The tile classifier takes a lane rank (v_mbcnt) of EXEC as it was restored after a one-lane section. The bits these masks hold are fixed by the console's rules: a VOPC writes 0 for lanes that do not run, and the scalar operations work on plain dwords. The lowering refuses them only because, with per-lane branches, it cannot prove that every lane with a set bit reaches the block where it would take the ballot.folded()inemit/mod.rsnow tries once more after that refusal. It structures the program again with every branch on a lane mask taken wave-wide, then tracks and lowers it again. In the folded form one host wave holds one whole console wave, so wave-wide branches are the console's own control flow. Every block then has all its lanes (every_lane), and the ballotmask_dwordtakes is the console's mask.folded()already does this for programs with LDS or barriers (wave_wide_branches); this applies it after the refusal, for any folded program.partial_active, which the lowering ANDs into active masks only, and a whole-wave ballot would count them.DARNER_WAVE_WHY=1printsWAVE64-FOLD refused for a mask read as data: <n> lane-mask branches taken wave-wide.How it was tested
d91d8e4.emit/folded_tests.rs. Both are refused with "a lane mask holding lanes elsewhere read as data" before the change and pass after it, bit for bit against the console's lanes.a_ballot_walked_bit_by_bit_reaches_every_lane: the light clustering loop, plain and inside av_cmpx/s_cbranch_execzregion.a_lane_rank_after_a_first_lane_section_counts_the_lanes_restored: the tile classifier's lane rank.cargo test -p darner-shader --lib folded: 27 passed, on an RTX 4080 under Proton (proton-cachyos, driver 620.73).cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with--all-features: clean.cargo test -p darner-shader --libunder Proton: every test passes but four, the same four that fail on main in this Wine (stub_pipeline_is_created,a_ray_query_program_validates_and_makes_a_pipeline_on_warp,split_lds_wave32_read_after_read_barrier_coalescing_and_parity,whole_wave_sections_keep_rounding_mode_changes; #349 is about them).darner translateof the title withDARNER_HOST_WAVE=32 DARNER_WAVE_WHY=1: the three programs now come outfolded (before wave-wide), after 77, 77 and 108 lane-mask branches taken wave-wide. In a census of the whole title, they were three of the 16 programs still in an approximate form.Checklist
main.docs/asset-policy.md.Checked for overlap
CS_ClusterLightsWorldSpaceexact on 32-lane hosts another way, by putting it on the wave-wide list (group barriers in the branches). Here it folds instead, so one host wave holds the whole console wave and needs no barriers. I have not measured the two forms against each other. If both land, the program should take only one of them.v_readfirstlaneandv_movrelare treated. It does not touchfolded()or the refusal this PR retries on.Shaders: a folded program refused for a lane mask read as data is folded again with every lane-mask branch taken wave-wideto [pr-fix][shaders] Shaders: a folded program refused for a lane mask read as data is folded again with every lane-mask branch taken wave-wideTested merged on
c8258f9through a complete 16-minute release shader preload (41.9 MBlog) + two 30,000+ frame Series X gameplay sessions on RTX 5070 Ti (DARNER_RDNA_FLOAT=2,DARNER_SAMPLED_MARKS=0):clippy --all-features -D warnings& tests passing) and ran without shader crashes or visual regressions.converter shader.dxil v1: GFX10 code at 0xae80: a lane mask holding lanes elsewhere read as data is not supported— hashdbdbf36298727135(stage="compute",329–455 ms), in case that dump helps extend coverage further.[pr-fix][shaders] Shaders: a folded program refused for a lane mask read as data is folded again with every lane-mask branch taken wave-wideto Shaders: a folded program refused for a lane mask read as data is folded again with every lane-mask branch taken wave-wideView 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.