Repository navigation
Shaders: console threads of 2-D groups on 32-lane hosts come from a group counter (fixes #1243) - #1261
Shaders: console threads of 2-D groups on 32-lane hosts come from a group counter (fixes #1243)#1261Garu667 wants to merge 1 commit into
Conversation
|
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. |
|
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 |
What bounds the frame now and what is tried against it; the fault found in VICTORY_INDIRECT_WINDOW and its probable cause; a translator fault live on this card (a probe wrote 32 of 64 words in a group of 32 by 2; fxceless#1261 by Garu667, ported, not tested on the card yet); the original's memory switches for 12 GB measured here as a set on 8 GB (3.5 fps against 6.5, with its caveats) and two leads from other forks. The paragraph this replaces moves, word for word, to "Measurement history". Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…group counter From fxceless/victory-fork PR fxceless#1261 (Garu667), fixing their issue fxceless#1243. A program with console lanes outside the wave64-in-halves path took its console thread as the flat id of the wave's first lane rounded down to the wave size, plus the lane. That is a bijection only while 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 two host waves can round to the same base and half the threads take the other half's ids. Such programs (console lanes, a group larger than one host wave) now get one more LDS dword (`ticket`) and take their threads through `wave_base`, as the halves path already did: every thread zeroes the dword, the group meets, each wave's first active lane adds for its wave; a full wave takes the next aligned block of w from the low 16 bits, a partial wave (the group's last) adds its lane count to the high 16 bits and is placed past the full blocks. Lanes are placed by their rank among the active lanes (wavePrefixOp sum of 1). The halves path takes the same form (it used to add a fixed 32 a wave, which leaves a gap or overshoots for a group that is not a multiple of 32 when the partial wave arrives early). Differences from the upstream PR, for our tree: the paired form (fxceless fxceless#854) keeps its 64-a-wave step and host lane; wave_base keeps our entry_sync and the extra meeting for a counter inside the program's own LDS; no ticket where the program already takes 32 KiB of LDS (old rounding there, rather than a pipeline the host refuses). `VICTORY_THREAD_TICKET=0` keeps the old rounding (part of the translation fingerprint, as every VICTORY_ switch the translator reads). Whole pack (shaders.rpf, VICTORY_HOST_WAVE=32), emitted DXIL byte-compared before/after: 218 of 25,689 programs change, all compute; 12 take the ticket (TAA2 resolves 8x8, GatherRaymarchedLocalLights 8x8, tessellation scans 256x1, SortJobs 256x1, StickyLips 160x1, WaterSim GenerateParticles 64x1, ScreenProbes ResolveGBuffer 128x1), 206 are halves programs with the new counter form. All 218 validate (dxil.dll) and make pipelines (RTX 5080). The 32x2 sky ambient-map passes of fxceless#1243 do not change here: in our tree they have no console lanes and read SV_GroupThreadID directly. New test the_console_threads_of_a_two_dimensional_group_are_each_given_once (wave64_tests): on the RTX 5080 the old rounding writes 32 of 64 dwords, the counter 64 of 64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ke their threads from a group counter Port of fxceless/victory-fork#1261 (Garu667, for its issue Marvisak#1243), with the choice of programs of avatarmanz/VIctory-7900XTX#18 (gomeaw, 0xkn0wh3r3). A program with console lanes relabels its threads so that each host wave holds a wave-aligned run of console threads. Outside wave64-in-halves the console thread was the flat id of the wave's first lane rounded down to the wave size, plus the lane. A host need not fill its waves that way: NVIDIA fills 2-D groups from tiles, so two waves of a 32 x 2 group round down to the same base and half the group's threads get the ids of the other half (on this RTX 5060 Ti the new test's old form writes 32 of 64 dwords; for an 8 x 8 group it writes all 64). Such programs now take their threads from an LDS counter, as wave64 programs in host waves of 32 already did (`wave_base`): every thread zeroes it, the group meets, and each wave's first active lane adds for its wave. A full wave takes the next block of w from the low 16 bits; a wave with fewer lanes adds its count to the high 16 bits and is placed past the full blocks, so a partial wave cannot shift a full one off its alignment (this also changes the halves path, where each wave added a fixed 32). Lanes are placed by their rank among the active lanes. Of the two fixes: Marvisak#1261 extends the counter that is there, branch-free in the entry block, takes any number of partial waves and has a switch; DexNom#18 makes its own prologue with branches and a new entry block, lets one thread zero the counter, and gives the one partial wave the last block by lane index. Marvisak#1261's mechanism is taken. From DexNom#18: only groups with more than one row or layer get the counter by default (a 1-D group's waves hold aligned runs, and keep their translation), and a program that has all 32 KiB of group memory keeps the old rounding, since the counter needs a dword. VICTORY_THREAD_TICKET: unset or 1 as above; 2 every group of several host waves (as Marvisak#1261); 0 the old rounding. Read by the translator, so in the translation's fingerprint; added to victory-gpu's cache key list. Test (wave64_tests.rs, from Marvisak#1261): a console wave32 program with v_mbcnt in a 32 x 2 group stores 1 at dword 32y + x; all 64 once. What it changes in the title's 2,682 compute programs on a 32-lane host (`translate --list --validate --pipelines`, no pipeline lost): 266 wave64 programs already on the counter get its new form (the same ids in a full wave); 3 programs newly take the counter, all 8 x 8 (TAA2 and TAA2U CS_TAA2_Resolve, scattering_transmittance_system CS_GatherRaymarchedLocalLights); with `=2`, 13 more with one row. The 32 x 2 ambient_map sky passes (Sky32, SkyLocal32, SkyClassified32) are not programs with console lanes in this tree: they read the host's own thread ids and are not changed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…eads from a group counter (fxceless#1243) A program with console lanes relabels its threads so that each host wave holds a wave-aligned run of console threads. Outside wave64-in-halves, the console thread was the flat id of the wave's first lane rounded down to the wave size, plus the lane. A host need not fill its waves that way: NVIDIA (and RDNA in 32-lane waves) fill 2-D groups from 16 x 2 tiles, so two waves of a 32 x 2 group round down to the same base and half the group's threads get the ids of the other half (issue fxceless#1243). Such programs, in groups larger than one host wave, now take their threads from an LDS counter, as wave64 programs in host waves of 32 already did (`wave_base`): every thread zeroes it, the group meets, and each wave's first active lane adds for its wave. A full wave takes the next aligned block of w from the low 16 bits; a wave with fewer lanes (the group's last, partial one) adds its lane count to the high 16 bits and is placed past the full blocks, so it cannot shift a full wave off its alignment whatever the order the waves arrive in (this also covers the halves path's groups whose size is not a multiple of 32, where each wave used to add a fixed 32). Lanes are placed by their rank among the active lanes. VICTORY_THREAD_TICKET=0: the old rounding (the switch is read by the translator, so it is part of the translation's fingerprint). Test (wave64_tests.rs): a console wave32 program with v_mbcnt in a 32 x 2 group stores 1 at dword 32y + x. On an RTX 3080 (driver 32-lane waves) the old rounding writes 32 of the 64 dwords, the counter all 64, each once. Ported from fxceless/victory-fork fxceless#1261 (61f7df7) onto this tree's paired form (a host wave of 32 for each console wave of 64). The paired form keeps its own count exactly as before: its counter is `halves`, set for every group of several console waves, each host wave full, its first lane adding 64 and its lanes its host lanes (plus 32 for the upper one). The ticket is taken only outside it (an `else` of its branch), so no group has both counters. Also here: - the ticket's dword is the program's first where the program takes all of a host group's 32 KiB, as the paired form's counter already is (`wave_base` meets the group again before the program then), instead of a dword past it; - the test sets the switch per thread (`lower::TEST_TICKET`), not in the process's environment; - the lowerings that take the ticket, and those that would have with the switch off, are counted per thread (`emit::thread_tickets`); the shader cache says each such program it translates and keeps the totals, which the frame line prints (`tickets`, `tickets_off`); - tests: which lowerings take and count the ticket (no device needed), and a wave64 program in a 64 x 2 group in the paired form: not counted, the same with the switch on and off, and each of its 128 console threads given once with its lane on the card. This tree's probe of fxceless#1261 (a85802bc, on an RTX 4060 Ti: 32 of 64 dwords written once) is left out: the ported test prints the old rounding's count too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iew guard are in fxceless#1261 (Garu667): on this RTX 4060 Ti the probe wrote 32 of 64 words with the old rounding and 64 of 64 with the group counter; the paired form 128 of 128. victory-shader 257 passed, victory-gpu 243. In the two sessions Codex ran on build e70ec5a, with VICTORY_THREAD_TICKET on and off, 11 of about 3,250 programs translated take the counter; the room looked the same in both at about 740 s, no face seen from the front; no error line, no device loss. Frame rate alike: 6.59 and 6.53 fps in the manoeuvre, both with a cold shader cache. fxceless#1266 (lichenlang89): no raw view was cut or refused in those sessions. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
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.
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. |
|
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. |
…on 32-lane hosts come from a group counter Conflict in wave64_tests.rs only: both sides add tests at the end of the file; ours kept and the PR's 77 lines appended. Not built yet (another session was using the machine).
…eads from a group counter (fxceless#1243) A program with console lanes relabels its threads so that each host wave holds a wave-aligned run of console threads. Outside wave64-in-halves, the console thread was the flat id of the wave's first lane rounded down to the wave size, plus the lane. A host need not fill its waves that way: NVIDIA (and RDNA in 32-lane waves) fill 2-D groups from 16 x 2 tiles, so two waves of a 32 x 2 group round down to the same base and half the group's threads get the ids of the other half (issue fxceless#1243). Such programs, in groups larger than one host wave, now take their threads from an LDS counter, as wave64 programs in host waves of 32 already did (`wave_base`): every thread zeroes it, the group meets, and each wave's first active lane adds for its wave. A full wave takes the next aligned block of w from the low 16 bits; a wave with fewer lanes (the group's last, partial one) adds its lane count to the high 16 bits and is placed past the full blocks, so it cannot shift a full wave off its alignment whatever the order the waves arrive in (this also covers the halves path's groups whose size is not a multiple of 32, where each wave used to add a fixed 32). Lanes are placed by their rank among the active lanes. VICTORY_THREAD_TICKET=0: the old rounding (the switch is read by the translator, so it is part of the translation's fingerprint). Test (wave64_tests.rs): a console wave32 program with v_mbcnt in a 32 x 2 group stores 1 at dword 32y + x. On an RTX 3080 (driver 32-lane waves) the old rounding writes 32 of the 64 dwords, the counter all 64, each once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61f7df7 to
489fd6b
Compare
|
Rebased onto |
|
RTX 2080 Ti (Turing, 32-lane waves), Windows 10, Series S: with this PR, close-ups get dark blocky squares on faces and hair glows bright orange; removing only this commit makes both go away.
AI use: found and tested with Claude Code (offline shader diff, then one run with only this commit added). |
…on 32-lane hosts come from a gr) conflitto risolto a mano # Conflicts: # crates/victory-shader/src/emit/lower.rs
…ess#1261 gestisce già i gruppi piccoli e dà wave_rank); lane_there dopo il controllo delle due metà
|
Follow-up from the RTX 2080 Ti: the squares are not wrong ids. They come from how the wave64-in-halves
Tested: RTX 2080 Ti, Windows 10, Series S, café and cell scenes, one run each way, warm shader cache. AI use: Claude Code (card tests, offline shader diff, test switch, runs). |
Fixes #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:thread_id/console_threaddoes not hold (RTX 4060 Laptop, Radeon 780M) #1243);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