Shaders: console threads of 2-D groups on 32-lane hosts come from a group counter (fixes #1243) #1261
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/fxceless--victory-fork!1261
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1261"
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?
@Garu667 on GitHub · 2026-11-26 04:49 UTC · original
Garu667:fix/thread-ticket-1243→main· +137 −16 · 2 files · 1 commits · openFixes #1243.
Problem
For a program with console lanes,
thread_id/console_thread(outside the wave64-in-halves path) took the console thread as the flat id of the wave's first lane rounded down to the wave size, plus the lane. That is only a bijection if every host wave holds a wave-aligned run of flat ids. NVIDIA (and RDNA in 32-lane waves) fill 2-D groups from 16 x 2 tiles, so in a 32 x 2 group both host waves round down to the same base and half the threads take the ids of the other half. #1243 found three such programs in the title's pack (32 x 2 sky ambient-map compute passes).Change
crates/victory-shader/src/emit/lower.rs: programs with console lanes in a group larger than one host wave (and not on the halves path) get one more LDS dword (ticket) and take their threads from it throughwave_base, as wave64 programs in host waves of 32 already did:wavePrefixOpsum of 1).VICTORY_THREAD_TICKET=0keeps the old rounding. The switch is read by the translator, so it is part of the translation's fingerprint.Verification (RTX 3080 10 GB, Windows 11, diagnostics build)
the_console_threads_of_a_two_dimensional_group_are_each_given_once(wave64_tests.rs): a console wave32 program withv_mbcntin a 32 x 2 group stores 1 at dword 32y + x. On the 3080 the old rounding writes 32 of 64 dwords; with the counter 64 of 64, each once. Without a hardware device the test still checks that the counter is used and that the DXIL validates.cargo test --release -p victory-shader: 218 passed, 0 failed.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.translate shaders.rpf --warm all, 32-lane host): 25,635 translated, 254 do not translate, the same counts as without the change.Diff: 2 files, about +140 / -16.
🤖 Generated with Claude Code
@Ym1r1710 on GitHub · 2026-11-26 05:12 UTC · original
Ran this on an RTX 5080 (Series X profile, first room), four runs on the same binary, two with the counter and two with VICTORY_THREAD_TICKET=0: no device loss, nothing new refused or left untranslated, median frame 102.7 / 100.6 ms with it vs 101.6 / 111.4 without, so no cost I can see. The room looks the same either way here, the affected sky passes probably don't show much indoors.
@Garu667 on GitHub · 2026-11-26 06:10 UTC · original
Thanks a lot for running it on the 5080, super helpful! Makes sense the room looks the same, the passes it fixes are the sky ambient ones so indoors you barely see them. On my 3080 the sky came out a bit paler outside with the fix, but that's 1 launch vs 5 so could just be noise. If you ever get a sec to grab an outdoor shot with the sky in view, with and without
VICTORY_THREAD_TICKET=0, that'd settle it 🙏@CuteBooty on GitHub · 2026-11-26 08:28 UTC · original
RTX 3070 8 GB, Series S: ported and compared from one street with the fill light off; shade is as black with it as without it
A test report, in case a negative one is useful.
VICTORY_AMBIENTunset in both runs.So on this card the three sky ambient-map passes taking wrong thread ids are not what makes shade black, or not alone. The port compiled and ran cleanly (full tests of the tree: 639 passed), so this is no argument against the PR's correctness, only a data point on what it does not fix.
@Garu667 on GitHub · 2026-11-26 08:39 UTC · original
Thanks for porting and running it, negative results help too. Agreed: the PR only claims the thread ids are right (32/64 → 64/64 on the 3080 test); it was never expected to fix the black shade, which comes from the ray-traced lighting not running. Good to know it ran cleanly on a 3070 and on Series S.
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.