Shaders: console threads of 2-D groups on NVIDIA from a group counter (port of Vice-Tay c125c0c, #1243) #30

Merged
regiumlepidi merged 2 commits from upstream-pr/30 into main 2026-11-27 13:40:39 +00:00
regiumlepidi commented 2026-11-27 10:24:12 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by regiumlepidi on 2026-11-27T10:24:12Z.


What

On NVIDIA, a translated program with console lanes (v_mbcnt, DPP, permlane…) in a compute group larger than one host wave could hand the same console thread ids to two host waves. NVIDIA (and RDNA in 32-lane waves) fill 2-D groups from 16 × 2 tiles, so the host wave's first flat id rounded down to the wave size is not a wave-aligned base: in a 32 × 2 group both waves round down to the same base, and half of the group's threads get the other half's ids (fxceless/victory-fork issue #1243).

This is a port of Vice-Tay's fix (c125c0c, author Garu667) to this tree:

  • such programs now take their console threads from an LDS counter (wave_base), as wave64-in-halves programs already did; a full wave takes the next aligned block from the low 16 bits, a partial wave its lane count from the high 16 bits past the full blocks, so it cannot shift a full wave off its alignment;
  • lanes are placed by their rank among the active lanes;
  • VICTORY_THREAD_TICKET=0 restores the old rounding; the switch is part of the shader cache key.

The code around wave_base differs from Vice-Tay's tree (the pairs meeting counters here), so this was merged by hand, not cherry-picked.

Measured

The ported hardware test (the_console_threads_of_a_two_dimensional_group_are_each_given_once, a console wave32 program in a 32 × 2 group storing 1 at dword 32y + x), on an RTX 5070 Ti (driver 617.42):

the old rounding on this device: 32 of 64 dwords written
ran on the hardware device: 64 of 64 console threads, each once

So on Blackwell the old path really loses half of such a group's work. cargo test -p victory-shader: 289 passed, 0 failed. cargo clippy reports nothing in the touched files. (Two victory-gpu tests, indirect::tests::host_list_budget_starts_empty_at_each_submission and warp_batch_charges_every_execution, fail on main as well, with or without this change.)

In game (Series X, 1440p, DLSS Quality) it runs without new errors or refused pipelines. I have not yet been able to tie it to one visible artifact by A/B, so I'm not claiming a specific visual fix — the test above is the evidence.

Notes

  • No game files, captures or logs are included.
  • This was written with an AI assistant (Claude Code) and reviewed, built and tested on my machine before sending.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5525019417 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/30). Originally posted by [regiumlepidi](https://github.com/regiumlepidi) on 2026-11-27T10:24:12Z. --- ## What On NVIDIA, a translated program with console lanes (`v_mbcnt`, DPP, permlane…) in a compute group larger than one host wave could hand **the same console thread ids to two host waves**. NVIDIA (and RDNA in 32-lane waves) fill 2-D groups from 16 × 2 tiles, so the host wave's first flat id rounded down to the wave size is not a wave-aligned base: in a 32 × 2 group both waves round down to the same base, and half of the group's threads get the other half's ids (fxceless/victory-fork issue #1243). This is a port of Vice-Tay's fix (`c125c0c`, author Garu667) to this tree: - such programs now take their console threads from an LDS counter (`wave_base`), as wave64-in-halves programs already did; a full wave takes the next aligned block from the low 16 bits, a partial wave its lane count from the high 16 bits past the full blocks, so it cannot shift a full wave off its alignment; - lanes are placed by their rank among the active lanes; - `VICTORY_THREAD_TICKET=0` restores the old rounding; the switch is part of the shader cache key. The code around `wave_base` differs from Vice-Tay's tree (the `pairs` meeting counters here), so this was merged by hand, not cherry-picked. ## Measured The ported hardware test (`the_console_threads_of_a_two_dimensional_group_are_each_given_once`, a console wave32 program in a 32 × 2 group storing 1 at dword 32y + x), on an **RTX 5070 Ti** (driver 617.42): ``` the old rounding on this device: 32 of 64 dwords written ran on the hardware device: 64 of 64 console threads, each once ``` So on Blackwell the old path really loses half of such a group's work. `cargo test -p victory-shader`: 289 passed, 0 failed. `cargo clippy` reports nothing in the touched files. (Two `victory-gpu` tests, `indirect::tests::host_list_budget_starts_empty_at_each_submission` and `warp_batch_charges_every_execution`, fail on `main` as well, with or without this change.) In game (Series X, 1440p, DLSS Quality) it runs without new errors or refused pipelines. I have not yet been able to tie it to one visible artifact by A/B, so I'm not claiming a specific visual fix — the test above is the evidence. ## Notes - No game files, captures or logs are included. - This was written with an AI assistant (Claude Code) and reviewed, built and tested on my machine before sending. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
rafaconvaitis commented 2026-11-27 16:15:06 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by rafaconvaitis on 2026-11-27T16:15:06Z.


Validated the two-dimensional compute group fixture on a native Windows 11 build 26300 with a GeForce RTX 4070 12 GB and driver 616.64. I ported the thread-ticket change onto Foxhound v0.2.0-pre.2 (9f8838b1) and ran the_console_threads_of_a_two_dimensional_group_are_each_given_once against both lowering paths on the hardware device.

  • Previous rounding wrote 32 of 64 dwords.
  • Thread tickets wrote all 64 expected dwords.

The fixture passed and reproduces the mapping correction on Ada. This comparison uses generated inputs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7223037353 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/30#issuecomment-7223037353). Originally posted by [rafaconvaitis](https://github.com/rafaconvaitis) on 2026-11-27T16:15:06Z. --- Validated the two-dimensional compute group fixture on a native Windows 11 build 26300 with a GeForce RTX 4070 12 GB and driver 616.64. I ported the thread-ticket change onto Foxhound v0.2.0-pre.2 (`9f8838b1`) and ran `the_console_threads_of_a_two_dimensional_group_are_each_given_once` against both lowering paths on the hardware device. - Previous rounding wrote 32 of 64 dwords. - Thread tickets wrote all 64 expected dwords. The fixture passed and reproduces the mapping correction on Ada. This comparison uses generated inputs.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!30
No description provided.