GPU and shaders: handle DispatchX USE_THREAD_DIMENSIONS partial thread groups (#16) #646

Open
github-bot wants to merge 1 commit from github-bot/gh-646 into main AGit
Owner

@⁠mynzjerko on GitHub · 2026-11-25 03:57 UTC · original
mynzjerko:fix/dispatch-x-thread-dimensions → main · +463 −35 · 8 files · 1 commits · open

Problem

In crates/victory-gpu/src/list.rs, DispatchX(x, y, z, flags) ignored flags and forwarded (x, y, z) directly to ID3D12GraphicsCommandList::Dispatch(x, y, z) as thread-group counts.

The ray-tracing structure builder calls DispatchX with bit 5 (0x20 = COMPUTE_DISPATCH_INITIATOR::USE_THREAD_DIMENSIONS, e.g. 0x0020 / 0x8020) set. In that mode:

  1. (x, y, z) are raw thread counts, not thread-group counts.
  2. Trailing lanes of partial tail groups (DTid >= count) are masked off in initial hardware EXEC.

Treating raw thread counts as full 64-thread groups caused:

  • up to 64x over-dispatch in node-writing stages (overwriting neighboring structures and CPU objects with empty box-node bounds, as analyzed in #16), and
  • wrong entry EXEC popcounts (s_bcnt1_i32_b64(exec) returning 64 instead of the partial count) and unmasked whole-wave reductions on partial tail waves.

Fix

victory-gpu

  • crates/victory-gpu/src/pipeline.rs: store compute [numthreads(x, y, z)] on Translated.
  • crates/victory-gpu/src/list.rs: forward flags from dispatch_x to state::dispatch_x.
  • crates/victory-gpu/src/draw.rs: when flags & 0x20 != 0 (USE_THREAD_DIMENSIONS), skip zero-sized dispatches, convert raw thread counts to host group counts via div_ceil, and supply any non-multiple axis limits through host user-data dword USER_DISPATCH_THREADS (0x104, 0 = no cap for normal Dispatch or exact multiples).

victory-shader

  • crates/victory-shader/src/emit/shader.rs & mod.rs: define and export USER_DISPATCH_THREADS = 0x104.
  • crates/victory-shader/src/emit/lower.rs: add dispatch_threads_prologue for spilled compute programs (all ray-tracing structure builder stages) along any axis with group dimension > 1:
    • Early-exit mode (barrier-free, exchange.is_none(), entry block has no back-edge — native Wave64 hosts and Wave32 programs): branch inactive lanes out to Ret after entry inputs (groupId, relabelled thread_id), and place entry-EXEC ballots/SCC tests in body_entry so hardware EXEC, s_bcnt1_i32_b64(exec), wave reductions, and stores see the exact active lane set with zero per-instruction guard overhead.
    • Predicated mode (exchange.is_some() for wave64-on-wave32 hosts, or programs containing s_barrier): keep all threads alive so GroupMemoryBarrierWithGroupSync / exchange_halves never deadlock (even when limit <= 32 leaves the upper 32-lane half with 0 active lanes), while predicating memory/LDS accesses (effect_guard), active ballots (mask_dword), scc_some, wave_wide, and whole-wave reduction masks (section_val).

Verification

  • Added unit test draw::tests::dispatch_x_thread_dimensions_convert_to_groups_and_partial_limits in crates/victory-gpu/src/draw.rs.
  • Added hardware GPU test emit::wave64_tests::spilled_compute_masks_partial_dispatch_threads_on_wave64_and_wave32 in crates/victory-shader/src/emit/wave64_tests.rs testing s_bcnt1_i32_b64(exec), whole-wave OR, and unconditional per-lane buffer_store_dwordx2 at limit = 45, 1, 0:
    • Verified on AMD Radeon RX 9070 for both host_wave=64 (early-exit) and host_wave=32 (predicated exchange_halves, no barrier hang at limit = 1), both validated by dxil.dll.
  • cargo test -p victory-shader --lib (215 passed, 0 failed), cargo test -p victory-gpu (119 passed, 0 failed), cargo xtask policy (asset policy: 169 files ok).
  • Live verification with VICTORY_BVH_BUILDER=1 on AMD Radeon RX 9070: eliminates the BVH over-dispatch memory corruption crash (previously crashing within ~7–14 s on empty box-node bounds); sustained 2+ minutes / 8,900+ submissions of builder execution with zero CPU memory corruption.

Refs #16.

AI-assisted (Antigravity); verified locally on an AMD Radeon RX 9070. No game data.

**@⁠mynzjerko** on GitHub · 2026-11-25 03:57 UTC · [original](https://github.com/fxceless/victory-fork/pull/646) `mynzjerko:fix/dispatch-x-thread-dimensions` → `main` · +463 −35 · 8 files · 1 commits · open ## Problem In `crates/victory-gpu/src/list.rs`, `DispatchX(x, y, z, flags)` ignored `flags` and forwarded `(x, y, z)` directly to `ID3D12GraphicsCommandList::Dispatch(x, y, z)` as thread-group counts. The ray-tracing structure builder calls `DispatchX` with bit 5 (`0x20` = `COMPUTE_DISPATCH_INITIATOR::USE_THREAD_DIMENSIONS`, e.g. `0x0020` / `0x8020`) set. In that mode: 1. `(x, y, z)` are **raw thread counts**, not thread-group counts. 2. Trailing lanes of partial tail groups (`DTid >= count`) are masked off in initial hardware `EXEC`. Treating raw thread counts as full 64-thread groups caused: - up to **64x over-dispatch** in node-writing stages (overwriting neighboring structures and CPU objects with empty box-node bounds, as analyzed in #16), and - wrong entry `EXEC` popcounts (`s_bcnt1_i32_b64(exec)` returning 64 instead of the partial count) and unmasked whole-wave reductions on partial tail waves. ## Fix ### `victory-gpu` - `crates/victory-gpu/src/pipeline.rs`: store compute `[numthreads(x, y, z)]` on `Translated`. - `crates/victory-gpu/src/list.rs`: forward `flags` from `dispatch_x` to `state::dispatch_x`. - `crates/victory-gpu/src/draw.rs`: when `flags & 0x20 != 0` (`USE_THREAD_DIMENSIONS`), skip zero-sized dispatches, convert raw thread counts to host group counts via `div_ceil`, and supply any non-multiple axis limits through host user-data dword `USER_DISPATCH_THREADS` (`0x104`, `0` = no cap for normal `Dispatch` or exact multiples). ### `victory-shader` - `crates/victory-shader/src/emit/shader.rs` & `mod.rs`: define and export `USER_DISPATCH_THREADS = 0x104`. - `crates/victory-shader/src/emit/lower.rs`: add `dispatch_threads_prologue` for spilled compute programs (all ray-tracing structure builder stages) along any axis with group dimension > 1: - **Early-exit mode** (barrier-free, `exchange.is_none()`, entry block has no back-edge — native Wave64 hosts and Wave32 programs): branch inactive lanes out to `Ret` after entry inputs (`groupId`, relabelled `thread_id`), and place entry-`EXEC` ballots/SCC tests in `body_entry` so hardware `EXEC`, `s_bcnt1_i32_b64(exec)`, wave reductions, and stores see the exact active lane set with zero per-instruction guard overhead. - **Predicated mode** (`exchange.is_some()` for wave64-on-wave32 hosts, or programs containing `s_barrier`): keep all threads alive so `GroupMemoryBarrierWithGroupSync` / `exchange_halves` never deadlock (even when `limit <= 32` leaves the upper 32-lane half with 0 active lanes), while predicating memory/LDS accesses (`effect_guard`), active ballots (`mask_dword`), `scc_some`, `wave_wide`, and whole-wave reduction masks (`section_val`). ## Verification - Added unit test `draw::tests::dispatch_x_thread_dimensions_convert_to_groups_and_partial_limits` in `crates/victory-gpu/src/draw.rs`. - Added hardware GPU test `emit::wave64_tests::spilled_compute_masks_partial_dispatch_threads_on_wave64_and_wave32` in `crates/victory-shader/src/emit/wave64_tests.rs` testing `s_bcnt1_i32_b64(exec)`, whole-wave OR, and unconditional per-lane `buffer_store_dwordx2` at `limit = 45, 1, 0`: - Verified on AMD Radeon RX 9070 for both `host_wave=64` (early-exit) and `host_wave=32` (predicated `exchange_halves`, no barrier hang at `limit = 1`), both validated by `dxil.dll`. - `cargo test -p victory-shader --lib` (215 passed, 0 failed), `cargo test -p victory-gpu` (119 passed, 0 failed), `cargo xtask policy` (`asset policy: 169 files ok`). - Live verification with `VICTORY_BVH_BUILDER=1` on AMD Radeon RX 9070: eliminates the BVH over-dispatch memory corruption crash (previously crashing within ~7–14 s on empty box-node bounds); sustained 2+ minutes / 8,900+ submissions of builder execution with zero CPU memory corruption. Refs #16. _AI-assisted (Antigravity); verified locally on an AMD Radeon RX 9070. No game data._
Console DispatchX(x, y, z, flags) sets COMPUTE_DISPATCH_INITIATOR bit 5 (0x20, USE_THREAD_DIMENSIONS) when passing raw thread counts instead of thread-group counts, with hardware EXEC masking trailing lanes in partial tail groups. Previously list.rs ignored flags and passed raw thread counts as full groups, causing up to 64x over-dispatch and wrong entry EXEC popcount/reductions in the ray-tracing structure builder.

- victory-gpu: forward DispatchX flags, record compute [numthreads] on Translated, convert thread dimensions with div_ceil, and pass partial axis limits via USER_DISPATCH_THREADS (0x104).
- victory-shader: add entry partial-thread masking for spilled compute shaders (early-exit before body_entry when barrier- and exchange-free, or predicated active masking for group barriers and wave64-over-wave32 LDS exchange so both 32-lane halves stay alive for group_sync).
- Tests: unit test for thread-to-group conversion in draw.rs and hardware GPU test verifying entry s_bcnt1_i32_b64(exec), whole-wave OR, and lane bounds for both host_max_wave=64 and host_max_wave=32.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:48:07 +00:00
Author
Owner

@⁠Revens2 on GitHub · 2026-11-25 09:22 UTC · original

RTX 5070 (32-lane): in-game check of this PR with #36 and #579 on a26859f: 2 of 2 runs held 600 s with VICTORY_BVH_BUILDER=1, no exception.

Runs: diag build, VICTORY_RELAY=2, builder started ~107 s in, so ~8 min with it running; world reached, 0 first-chance exceptions, 0 device removals, 0.3-0.4 fps. On the same tree with the earlier VICTORY_THREAD_DIMS variant (Yorivel's 2521646, which launches ceil(x/threads) groups and lets late lanes leave at entry), both runs ended 4-6 s after builder runs (one at +0x8f92a, read of all ones). Details on #16. Two runs per arm, so a lead.

Tests on that tree (cargo test --workspace --locked): 536 passed, 10 ignored, 1 failed: xtask policy::tests::repository_passes_policy, because #36 + this PR together make lower.rs 528,884 bytes against the 524,288 limit (each is under it alone on its own base; main is 514,840). Merging both needs room in that limit or a split of the file.

AI-assisted (Claude Code, Claude Sonnet 5.5): the runs are mine, on my own copy of the title. Counts only, no game data.

**@⁠Revens2** on GitHub · 2026-11-25 09:22 UTC · [original](https://github.com/fxceless/victory-fork/pull/646#issuecomment-7158251534) **RTX 5070 (32-lane): in-game check of this PR with #36 and #579 on `a26859f`: 2 of 2 runs held 600 s with `VICTORY_BVH_BUILDER=1`, no exception.** Runs: diag build, `VICTORY_RELAY=2`, builder started ~107 s in, so ~8 min with it running; world reached, 0 first-chance exceptions, 0 device removals, 0.3-0.4 fps. On the same tree with the earlier `VICTORY_THREAD_DIMS` variant (Yorivel's `2521646`, which launches ceil(x/threads) groups and lets late lanes leave at entry), both runs ended 4-6 s after `builder runs` (one at `+0x8f92a`, read of all ones). Details on #16. Two runs per arm, so a lead. Tests on that tree (`cargo test --workspace --locked`): 536 passed, 10 ignored, 1 failed: `xtask policy::tests::repository_passes_policy`, because #36 + this PR together make `lower.rs` 528,884 bytes against the 524,288 limit (each is under it alone on its own base; `main` is 514,840). Merging both needs room in that limit or a split of the file. _AI-assisted (Claude Code, Claude Sonnet 5.5): the runs are mine, on my own copy of the title. Counts only, no game data._
Author
Owner

@⁠pr0vId3nce on GitHub · 2026-11-25 16:03 UTC · original

RTX 4080 (32-lane): held 546 s with the builder on, no exceptions, and the shade is lit

Setup: RTX 4080 16 GB (driver 32.0.16.1088), Ryzen 9 7900X, 32 GB, Windows 11 26200, diag build, Series X profile. Tree: main 0b0074e0b + #156 (so the builder's three prefix-sum passes translate on 32 lanes) + this PR's 170c24269; one textual conflict between the two in emit/mod.rs's export list, nothing else. VICTORY_BVH_BUILDER=1, a checkpoint in the first gameplay scene, 540 s limit.

  • the ray-tracing structure builder runs: all of its programs have host pipelines pipelines=53, then 546 s to the time limit with 0 first-chance and 0 unhandled exceptions. Without the thread-count handling, four of four earlier runs here (c96b4f2 and 0b0074e with #156) ended in 0xc0000005 shortly after that line (8 to 10 s in the two I timed).
  • The picture: by the last captured frame (56 frames into the world) the character's back and the room's walls are lit where main leaves them black, with a few blocky tiles along the lower edge. Judged by eye against main on the same checkpoint; I have no console reference.
  • Cost: 5.2 to 6.7 s a frame, 37.6 GB peak commit.

Two card tests beside the PR's own, both on the RTX 4080 and on a Ryzen 7900X iGPU (gfx1036), host waves of 32 (neither device took the 64-lane form of these programs, so that mode did not run here):

  • the PR's spilled_compute_masks_partial_dispatch_threads_on_wave64_and_wave32: passes;
  • one I wrote for what the builder's pass does and that test does not: two groups of 64 with the limit falling in the second, and the console compiler's wave total and prefix sum, which turn every lane on (s_or_saveexec_b64 -1) and mask by the saved EXEC. Limits 70, 100, 33, 1 and none: all 256 dwords right. I can send it as a patch if it is wanted.

Independent of the thread (found before I read its later half), in case it helps a reviewer:

  • Only the programs at DLL 0x25c40 and 0x28770 (28918b7150a7aad5, caa78b8ca62bc3d6) come through DispatchX with 0x20: 2,244 and 4,002 of the 12,589 builder dispatches before the crash.
  • The sizes say x is threads: three levels of one structure are 205,568, 69,632 and 27,264 bytes long (differences of root constant 0) and their x are 1,606, 544 and 213; 28918b71 gives each thread 128 bytes (group << 13 for 64 threads). As groups, 1,606 covers 13 MB.
  • Dropping stages one at a time gave Revens2's result: without those two, 428 s with no fault; with either, a crash.

What comes next on this card: no number left for another copy … COPIES=1023 comes two seconds into the world and shaders touched pages that had no copy 50 times in the run, so part of the structures reads as zeros. In a trace of another run the builder's root views alone name 529 distinct 4 MiB windows in its first frame and 838 over 58 frames. The frame time is the per-list refresh and compare of those copies, as #284 describes.

One thing for whoever merges: main + #156 + this PR puts lower.rs at 530,706 bytes, over the 512 KiB limit of cargo xtask policy (Revens2 saw the same with #36).

AI-assisted (Claude Code); measured on my machine. No game data.

**@⁠pr0vId3nce** on GitHub · 2026-11-25 16:03 UTC · [original](https://github.com/fxceless/victory-fork/pull/646#issuecomment-7167552896) **RTX 4080 (32-lane): held 546 s with the builder on, no exceptions, and the shade is lit** Setup: RTX 4080 16 GB (driver 32.0.16.1088), Ryzen 9 7900X, 32 GB, Windows 11 26200, diag build, Series X profile. Tree: `main` `0b0074e0b` + #156 (so the builder's three prefix-sum passes translate on 32 lanes) + this PR's `170c24269`; one textual conflict between the two in `emit/mod.rs`'s export list, nothing else. `VICTORY_BVH_BUILDER=1`, a checkpoint in the first gameplay scene, 540 s limit. - `the ray-tracing structure builder runs: all of its programs have host pipelines pipelines=53`, then 546 s to the time limit with 0 first-chance and 0 unhandled exceptions. Without the thread-count handling, four of four earlier runs here (`c96b4f2` and `0b0074e` with #156) ended in `0xc0000005` shortly after that line (8 to 10 s in the two I timed). - The picture: by the last captured frame (56 frames into the world) the character's back and the room's walls are lit where `main` leaves them black, with a few blocky tiles along the lower edge. Judged by eye against `main` on the same checkpoint; I have no console reference. - Cost: 5.2 to 6.7 s a frame, 37.6 GB peak commit. Two card tests beside the PR's own, both on the RTX 4080 and on a Ryzen 7900X iGPU (gfx1036), host waves of 32 (neither device took the 64-lane form of these programs, so that mode did not run here): - the PR's `spilled_compute_masks_partial_dispatch_threads_on_wave64_and_wave32`: passes; - one I wrote for what the builder's pass does and that test does not: two groups of 64 with the limit falling in the second, and the console compiler's wave total and prefix sum, which turn every lane on (`s_or_saveexec_b64 -1`) and mask by the saved EXEC. Limits 70, 100, 33, 1 and none: all 256 dwords right. I can send it as a patch if it is wanted. Independent of the thread (found before I read its later half), in case it helps a reviewer: - Only the programs at DLL 0x25c40 and 0x28770 (`28918b7150a7aad5`, `caa78b8ca62bc3d6`) come through `DispatchX` with `0x20`: 2,244 and 4,002 of the 12,589 builder dispatches before the crash. - The sizes say x is threads: three levels of one structure are 205,568, 69,632 and 27,264 bytes long (differences of root constant 0) and their x are 1,606, 544 and 213; `28918b71` gives each thread 128 bytes (`group << 13` for 64 threads). As groups, 1,606 covers 13 MB. - Dropping stages one at a time gave Revens2's result: without those two, 428 s with no fault; with either, a crash. What comes next on this card: `no number left for another copy … COPIES=1023` comes two seconds into the world and `shaders touched pages that had no copy` 50 times in the run, so part of the structures reads as zeros. In a trace of another run the builder's root views alone name 529 distinct 4 MiB windows in its first frame and 838 over 58 frames. The frame time is the per-list refresh and compare of those copies, as #284 describes. One thing for whoever merges: `main` + #156 + this PR puts `lower.rs` at 530,706 bytes, over the 512 KiB limit of `cargo xtask policy` (Revens2 saw the same with #36). _AI-assisted (Claude Code); measured on my machine. No game data._
Author
Owner

@⁠mynzjerko on GitHub · 2026-11-25 17:05 UTC · original

Thanks @⁠Revens2 and @⁠pr0vId3nce for the thorough 32-lane hardware and in-game verifications (RTX 5070 600 s and RTX 4080 546 s with zero exceptions and lit shade)!

I've rebased this PR onto latest \main\ (\ca8829f, now commit \36a2257) to resolve the conflict in \crates/victory-gpu/src/draw.rs's unit tests, and moved \effect_guard\ and \dispatch_threads_prologue\ into a small child module \crates/victory-shader/src/emit/dispatch.rs\ (same #[path = ...]\ pattern as \intersect.rs). That brings \lower.rs\ down to 517,044 bytes (+2,204 bytes over \main's 514,840, leaving >7 KiB of headroom under the 512 KiB \xtask policy\ limit) so it combines more easily with #36 / #156.

Re-verified on RX 9070:

  • \cargo xtask policy: \sset policy: 182 files ok\
  • \cargo test -p victory-shader --locked: 217 passed, 0 failed, 2 ignored
  • \cargo test -p victory-gpu --locked: 183 passed, 0 failed, 5 ignored
  • \cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean

@⁠pr0vId3nce I'd gladly include your multi-group wave-reduction / prefix-sum test (limits 70, 100, 33, 1, none) if you'd like to share it as a patch or gist.

**@⁠mynzjerko** on GitHub · 2026-11-25 17:05 UTC · [original](https://github.com/fxceless/victory-fork/pull/646#issuecomment-7168985245) Thanks @⁠Revens2 and @⁠pr0vId3nce for the thorough 32-lane hardware and in-game verifications (RTX 5070 600 s and RTX 4080 546 s with zero exceptions and lit shade)! I've rebased this PR onto latest \main\ (\ca8829f\, now commit \36a2257\) to resolve the conflict in \crates/victory-gpu/src/draw.rs\'s unit tests, and moved \effect_guard\ and \dispatch_threads_prologue\ into a small child module \crates/victory-shader/src/emit/dispatch.rs\ (same \#[path = ...]\ pattern as \intersect.rs\). That brings \lower.rs\ down to **517,044 bytes** (+2,204 bytes over \main\'s 514,840, leaving >7 KiB of headroom under the 512 KiB \xtask policy\ limit) so it combines more easily with #36 / #156. Re-verified on RX 9070: - \cargo xtask policy\: \sset policy: 182 files ok\ - \cargo test -p victory-shader --locked\: 217 passed, 0 failed, 2 ignored - \cargo test -p victory-gpu --locked\: 183 passed, 0 failed, 5 ignored - \cargo clippy -p victory-shader --all-targets --locked -- -D warnings\: clean @⁠pr0vId3nce I'd gladly include your multi-group wave-reduction / prefix-sum test (limits 70, 100, 33, 1, none) if you'd like to share it as a patch or gist.
Author
Owner

@⁠Dathinel on GitHub · 2026-11-26 00:22 UTC · original

Two portable RTX 3050 Laptop (wave32) checks for review at 36a2257b, using synthetic inputs:

  • Two-group buffer test and patch. Each group has its own 512-byte output region. At limits 65 through 128 and the uncapped control, the first group stays full and the second group returns the expected active count and wave OR. All 16,640 words matched. This is a reduction test; the per-lane prefix sum mentioned above is separate.
  • Texture readback, image and patch. The same tail wrote to a 64 x 2 RGBA32_FLOAT UAV. All 33,280 channel values matched. At limit 96, disabling just the partial-dispatch guard on image stores made the last 32 texels of row 2 change; the other 96 texels were identical.

Hardware runs used the PR integrated onto local 504db0e. Both standalone patches apply to the PR head. No game files or scene-quality measurements in these tests. AI-assisted.

**@⁠Dathinel** on GitHub · 2026-11-26 00:22 UTC · [original](https://github.com/fxceless/victory-fork/pull/646#issuecomment-7178687336) Two portable RTX 3050 Laptop (wave32) checks for review at 36a2257b, using synthetic inputs: - [Two-group buffer test and patch](https://github.com/Dathinel/victory-fork/blob/ae2fb70af5790044be72ed8860a762d29dee2a35/docs/dispatchx-two-group.md). Each group has its own 512-byte output region. At limits 65 through 128 and the uncapped control, the first group stays full and the second group returns the expected active count and wave OR. All 16,640 words matched. This is a reduction test; the per-lane prefix sum mentioned above is separate. - [Texture readback, image and patch](https://github.com/Dathinel/victory-fork/blob/10d589e973e98c99abd376d58941ea26faec8369/docs/dispatchx-texture.md). The same tail wrote to a 64 x 2 RGBA32_FLOAT UAV. All 33,280 channel values matched. At limit 96, disabling just the partial-dispatch guard on image stores made the last 32 texels of row 2 change; the other 96 texels were identical. Hardware runs used the PR integrated onto local 504db0e. Both standalone patches apply to the PR head. No game files or scene-quality measurements in these tests. AI-assisted.
Author
Owner

@⁠KyleS98 on GitHub · 2026-11-26 13:03 UTC · original

An independent confirmation from an RTX 3090 Ti (32-lane), and a note on why this no longer merges.

I opened #1292 for the same bug without having seen this PR, and have closed it in favour of this one. I have not run this PR's code; what follows is from my own smaller version of the same fix (x only) on main 06702fe.

The counts are threads: one more piece of evidence. Tracing every builder dispatch with its root arguments, one structure gets 25 DispatchX calls in a row, alternating the two box stages. Each stage's records begin exactly x times the node size after the previous stage's:

28918b71 x=5348 offset 0x15fc80   next +0xa7200 = 5348 x 128 bytes
caa78b8c x=17   offset 0x206e80   next +0x440   =   17 x  64 bytes
28918b71 x=1761 offset 0x2072c0   next +0x37080 = 1761 x 128 bytes
caa78b8c x=12   offset 0x23e340   next +0x300   =   12 x  64 bytes
...
28918b71 x=1    offset 0x2683c0   next +0x80    =    1 x 128 bytes

Flags I saw: 0x20 on 28918b7150a7aad5 and caa78b8ca62bc3d6, 0x8020 on 4ddd6f9702fab2a7 and 5062bc7a48e842f8. Every other builder program came through plain Dispatch, and every DispatchX had y = z = 1.

In the title (Series X, VICTORY_BVH_BUILDER=1 VICTORY_FIRSTLANE_OWN=1, 300 s): with the counts taken as threads the builder ran about 3 minutes to the end of the run, with no exception and no device loss. Before, every run of mine died within seconds of the first builder submission. It also crashes that way on an AMD card running the wave64 programs natively, so it is not the paired 32-lane form.

It was not usable: 4 to 7 s a frame, and no number left for another copy; its pages read zeros COPIES=1023 in the log. That matches what others report here and on #994.

Why this conflicts with main now (head 36a2257 against ceb9e1f): draw.rs, emit/mod.rs and emit/shader.rs. The one that needs a decision is shader.rs: main has since taken RootType::Other(0x104) for USER_DISPATCH_SPREAD, the code this PR uses for USER_DISPATCH_THREADS, so the word needs a new number (0x105 is USER_THREAD_LIMIT in #994, if the two are meant to coexist). The other two look like both sides adding lines at the same place.

AI-assisted (Claude Code, Claude Fable 5.2).

**@⁠KyleS98** on GitHub · 2026-11-26 13:03 UTC · [original](https://github.com/fxceless/victory-fork/pull/646#issuecomment-7192808939) An independent confirmation from an RTX 3090 Ti (32-lane), and a note on why this no longer merges. I opened #1292 for the same bug without having seen this PR, and have closed it in favour of this one. **I have not run this PR's code**; what follows is from my own smaller version of the same fix (x only) on `main` `06702fe`. **The counts are threads: one more piece of evidence.** Tracing every builder dispatch with its root arguments, one structure gets 25 `DispatchX` calls in a row, alternating the two box stages. Each stage's records begin exactly `x` times the node size after the previous stage's: ``` 28918b71 x=5348 offset 0x15fc80 next +0xa7200 = 5348 x 128 bytes caa78b8c x=17 offset 0x206e80 next +0x440 = 17 x 64 bytes 28918b71 x=1761 offset 0x2072c0 next +0x37080 = 1761 x 128 bytes caa78b8c x=12 offset 0x23e340 next +0x300 = 12 x 64 bytes ... 28918b71 x=1 offset 0x2683c0 next +0x80 = 1 x 128 bytes ``` Flags I saw: `0x20` on `28918b7150a7aad5` and `caa78b8ca62bc3d6`, `0x8020` on `4ddd6f9702fab2a7` and `5062bc7a48e842f8`. Every other builder program came through plain `Dispatch`, and every `DispatchX` had y = z = 1. **In the title** (Series X, `VICTORY_BVH_BUILDER=1 VICTORY_FIRSTLANE_OWN=1`, 300 s): with the counts taken as threads the builder ran about 3 minutes to the end of the run, with no exception and no device loss. Before, every run of mine died within seconds of the first builder submission. It also crashes that way on an AMD card running the wave64 programs natively, so it is not the paired 32-lane form. It was not usable: 4 to 7 s a frame, and `no number left for another copy; its pages read zeros COPIES=1023` in the log. That matches what others report here and on #994. **Why this conflicts with `main` now** (head `36a2257` against `ceb9e1f`): `draw.rs`, `emit/mod.rs` and `emit/shader.rs`. The one that needs a decision is `shader.rs`: `main` has since taken `RootType::Other(0x104)` for `USER_DISPATCH_SPREAD`, the code this PR uses for `USER_DISPATCH_THREADS`, so the word needs a new number (0x105 is `USER_THREAD_LIMIT` in #994, if the two are meant to coexist). The other two look like both sides adding lines at the same place. AI-assisted (Claude Code, Claude Fable 5.2).
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/draw.rs
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/mod.rs
  • crates/victory-shader/src/emit/shader.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/646/head:github-bot/gh-646'
git switch 'github-bot/gh-646'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-646'
git switch 'github-bot/gh-646'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-646'
git switch 'github-bot/gh-646'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-646'
git switch 'main'
git merge --squash 'github-bot/gh-646'
git switch 'main'
git merge --ff-only 'github-bot/gh-646'
git switch 'main'
git merge 'github-bot/gh-646'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.