shader: wave32 pixel programs keep the console's lane numbers and masks in host waves of 64 (general fix for #189) #344
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!344
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-344"
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?
@mateozariquiey on GitHub · 2026-12-03 18:15 UTC · original
mateozariquiey:pr/wave32-lanes→main· +504 −25 · 3 files · 2 commits · merged 2026-12-03 21:42 UTCThe general fix #189 suggests, with tests.
VICTORY_GLASS_DITHER_OFF(#193) is left as it is.Cause. RADV runs every pixel program in waves of 64, also the ones the console compiled for 32, and neither pixel nor vertex programs can declare a wave size. Two things were read in the host's wave that the program means in its own:
v_mbcnt_loof all lanes was 32 in the whole upper half of a host wave (the bands of #189).s_ff1of EXEC,v_readlane, a compare,s_bcnt1of the lanes that differ) did not ask the upper 32 lanes, which could take the uniform branch with another lane's value.Change.
v_mbcnt_hiadds nothing in a wave32 program.s_bcnt1,s_ff1,s_cmp_eq_u32,s_cmp_lg_u32andv_mbcnttake both dwords of the host's ballot.TRANSLATOR_VERSION19 to 20.Tested. RX 9070, RADV. New tests draw a wave32 pixel program on the host and read back the lane numbers, the counts and the compares (
a_wave32_pixel_lane_number_stays_below_32,a_wave32_pixel_mask_counts_the_whole_host_wave,a_wave32_pixel_mask_is_compared_whole,a_wave32_pixel_mask_is_compared_with_a_scalar,a_killed_pixel_is_read_by_its_quad); theemit::tests pass on45591b0. On a tree based on842767a: of the title's 25,889 programs 207 translate differently, all wave32 pixel programs, the rest byte for byte as before; all 94,841 pipelines were made, none refused by the host; an interior scene with ray tracing on ran with no errors.Limits. Not seen on the house windows of #189: my save has no scene with them. With
VICTORY_GLASS_DITHER_OFFunset the bands should be gone with the console's dither kept; a check from someone who has that scene would settle it. Cached translations are made again (the version). Vertex programs get the same treatment; the title has none of wave32.@Kal0s-design on GitHub · 2026-12-03 19:11 UTC · original
Tested
e5243e4on Windows 11 native (MSVC target, not Wine) with one NVIDIA desktop card plus WARP.None of the new tests were skipped. I added a temporary print in pixels_drawn to be sure, and every draw went through on both devices. The card reports 32 lane waves (min and max both 32) and WARP reports 4 (min and max both 4). That means neither device here has the 64 lane host wave this fix is for, so I couldn't get a red on main. I ran the five new tests against main's lower.rs and against the PR, one device at a time. The results were the same both ways.
Full
cargo test -p victory-shader --libon the PR gave 418 passed, 2 failed, 4 ignored (424 total). Main gave 414 passed, 1 failed, 4 ignored. The PR's extra failure is the lane number test on WARP described above. The other one is the same pre-existing failure on main.cargo clippy -p victory-shader --all-targetsshows no new warnings from the PR. The existing ones only shift by a few lines in lower.rs. The guard_runs bench error (privatebuild) is there on main too.I went through wide_ballot, upper_lanes and upper_compared and didn't find anything I could back up with a test on this hardware. On a 32 lane host upper_compared always gives 0, so the 64 bit forms reduce to the old 32 bit compare. That fits with hardware giving the same results on main and the PR. Someone with a card that runs pixel waves of 64 would need to confirm the actual fix.
AI-assisted: yes
@mateozariquiey on GitHub · 2026-12-03 19:43 UTC · original
Thanks for running it natively, WARP is a device these tests never meet under Wine.
Both points are right and fixed in the commit just pushed, tests only:
a_wave32_pixel_lane_number_stays_below_32now asks for the even spread over the lane numbers the host has (0 to 3 on WARP), not over all 32.masks_comparecounts waves of one value and of several only on hosts whose waves have 32 lanes or more, so a run with WARP alone no longer trips the last check.I cannot run WARP here, so I have not seen either go green on it. And agreed on the rest: on a host of 32-lane waves the change reduces to the old compare, so the fix itself needs a card that runs pixel waves of 64 (RADV does).
@Kal0s-design on GitHub · 2026-12-03 19:50 UTC · original
Reran
f0fc990on the same native Windows (MSVC) setup, only the five wave32/quad pixel tests.Both devices together: all five pass, 5 runs each, and the draws ran on the card and on WARP every time (nothing skipped).
WARP alone (one run each): all five pass, lane_number now checks only the 4 lanes WARP has. The masks_compare tests pass because WARP no longer counts toward uniform/mixed, so that last check has nothing to look at there.
Card alone (one run each): all five pass.
The diff from
e5243e4only touches tests.AI-assisted: yes