fix(shader,gpu): add heap slot lookup tables and partial dispatch thread counts #3426

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

@⁠legayclightning22 on GitHub · 2026-11-27 00:45 UTC · original
legayclightning22:fix/heap-slot-tables-and-partial-dispatch → main · +690 −37 · 13 files · 1 commits · open

Summary

Adds host-uploaded shader heap slot lookup tables (t252) for computed descriptor indices and preserves DispatchX(..., flags & 0x20) partial-dispatch thread counts (74974eb, 11 files, +497/-34).

Changes

  • Build and upload buffer-view address/byte-length/stride tables by heap slot (State::heap_views) and clamp/read them via root SRV t252 (SLOT_VIEWS, Lower::view_address_indexed).
  • Pass real X tail thread counts via USER_DISPATCH_THREADS_X (emit/lower/partial.rs) and exit out-of-range lanes before wave/LDS/store operations.
  • Add unit tests covering computed heap-slot lookups and partial-dispatch thread bounds.

Verification

  • Targeted victory-shader and victory-gpu test suites
  • cargo clippy --locked -p victory-shader -p victory-gpu --all-targets --all-features -- -D warnings
  • cargo xtask policy
**@⁠legayclightning22** on GitHub · 2026-11-27 00:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/3426) `legayclightning22:fix/heap-slot-tables-and-partial-dispatch` → `main` · +690 −37 · 13 files · 1 commits · open ## Summary Adds host-uploaded shader heap slot lookup tables (`t252`) for computed descriptor indices and preserves `DispatchX(..., flags & 0x20)` partial-dispatch thread counts (`74974eb`, 11 files, `+497/-34`). ## Changes - Build and upload buffer-view address/byte-length/stride tables by heap slot (`State::heap_views`) and clamp/read them via root SRV `t252` (`SLOT_VIEWS`, `Lower::view_address_indexed`). - Pass real X tail thread counts via `USER_DISPATCH_THREADS_X` (`emit/lower/partial.rs`) and exit out-of-range lanes before wave/LDS/store operations. - Add unit tests covering computed heap-slot lookups and partial-dispatch thread bounds. ## Verification - Targeted `victory-shader` and `victory-gpu` test suites - `cargo clippy --locked -p victory-shader -p victory-gpu --all-targets --all-features -- -D warnings` - `cargo xtask policy` ```[cite: 59]
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:07:20 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-27 00:50 UTC · original · approved these changes

LGTM — verified on Windows (RTX 5090):

  • cargo test -p victory-shader --lib emit::tests:: passed (17/17) and emit::lower::tests:: passed (34/34, including partial_dispatch_guards_threads_past_the_tail)
  • cargo test -p victory-gpu --lib passed (230/230, skipping the 2 pre-existing origin/main RTX 5090 failures)
  • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings passed with 0 warnings
  • cargo xtask policy passed (192 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-27 00:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/3426#pullrequestreview-6082071914) · **approved these changes** LGTM — verified on Windows (RTX 5090): - `cargo test -p victory-shader --lib emit::tests::` passed (17/17) and `emit::lower::tests::` passed (34/34, including `partial_dispatch_guards_threads_past_the_tail`) - `cargo test -p victory-gpu --lib` passed (230/230, skipping the 2 pre-existing `origin/main` RTX 5090 failures) - `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings` passed with 0 warnings - `cargo xtask policy` passed (`192 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-27 01:02 UTC · original · requested changes

Four concrete issues reproduced locally need to be fixed before this can merge:

  1. Library build fails clippy --lib -- -D warnings (crates/victory-shader/src/emit/lower.rs:99):
    Since emit_with now calls lower::lower_with_thread_limit(...), pub(crate) fn lower(parts: &Parts) is only referenced by #[cfg(test)] code. Running cargo clippy --lib -p victory-shader -- -D warnings fails to compile:

    error: function `lower` is never used
      --> crates\victory-shader\src\emit\lower.rs:99:15
       |
    99 | pub(crate) fn lower(parts: &Parts) -> Result<Lowered, ShaderError> {
       |               ^^^^^
    

    Marking lower #[cfg(test)] (or routing through a single entry point) fixes the build.

  2. view_address_indexed corrupts the buffer virtual address by adding the descriptor-table byte offset a.offset (crates/victory-shader/src/emit/lower/partial.rs:95):
    self.heap_index(site, first, false) (lower.rs:5813-5823) already adds the instruction's immediate offset into the descriptor table address before shifting by >> 5 to compute the heap slot index. read_view_slot(c, slot) then loads the descriptor's buffer virtual address (lo, hi). Calling:

    let (lo, hi) = self.address_plus(lo, hi, a.offset as i32);
    

    adds the descriptor table byte offset (a.offset) onto the buffer's virtual address. Reproduced on s_load_dwordx4 s[8:11], s[4:5], s0 offset:64 (scalar = (offset=64, dynamic=Some(Value(0)))), which shifts the loaded buffer base pointer forward by 64 bytes.

  3. Intercepting count == 8 in view_addresses breaks dynamically indexed image descriptor loads and duplicates dwords 0..3 into 4..7 (crates/victory-shader/src/emit/lower.rs:4836-4861):

    • Previously, dynamically indexed s_load_dwordx8 loads fell through to view_addresses_handle() (t1 in MEMORY_SPACE), which provides image_words (width, height, mip levels, type) for textures. Now if count <= 8 && count.is_multiple_of(4) routes count == 8 to SLOT_VIEWS (t252), where HostHeap::write_view only records view.and_then(buffer_range) — returning (0, 0, 0, 0) for every image/texture view and breaking dynamically indexed texture size queries.
    • In for group in 0..count / 4, group = 1 (first = 4) passes first = 4 to heap_index, which computes (addr + 16) >> 5 — the same 32-byte descriptor slot as group = 0 — duplicating (lo, hi, len, stride) into dwords 4..7 instead of marking them Val::Missing. Reproduced by lowering s_load_dwordx8 s[8:15], s[4:5], s0 reading s12 (dword 4): it lowered with root_srvs = [252] and view_addresses = false.
    • Even for 4-dword buffer descriptors (s_load_dwordx4), placing raw byte stride in dword 3 and raw byte length in dword 2 does not match the hardware V# descriptor layout (where stride lives in dword 1 bits 16..29, dword 2 is num_records, and dword 3 holds format/swizzle/OOB fields).
  4. HostHeap::raw_view_at and raw_pair_at leave stale entries in self.views (crates/victory-gpu/src/descriptor/host.rs:489, 717-718):
    Both methods call self.write_stride(index, 4) and self.note_address(index, None) directly without clearing self.views (self.write_view(index, None, 0)). Reproduced live on RTX 5090: overwriting a View::Placed buffer slot with raw_view_at(slot, None, 0, 0, false) leaves the previous buffer's address, length, and stride intact in self.views.

(Additional note on DispatchX partial dispatches): draw.rs:1164-1180 converts thread counts to div_ceil(size) for any compute pipeline dispatched with flags & 0x20, whereas emit/mod.rs:506-510 only emits partial_dispatch_prologue (USER_DISPATCH_THREADS_X) for two hardcoded shader digests (and only guards X, not Y/Z). Any other compute shader dispatched with flags & 0x20 will run trailing lanes past the thread count unguarded.

**@⁠fuzeofficlal** on GitHub · 2026-11-27 01:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/3426#pullrequestreview-6082139024) · **requested changes** Four concrete issues reproduced locally need to be fixed before this can merge: 1. **Library build fails `clippy --lib -- -D warnings` (`crates/victory-shader/src/emit/lower.rs:99`)**: Since `emit_with` now calls `lower::lower_with_thread_limit(...)`, `pub(crate) fn lower(parts: &Parts)` is only referenced by `#[cfg(test)]` code. Running `cargo clippy --lib -p victory-shader -- -D warnings` fails to compile: ```text error: function `lower` is never used --> crates\victory-shader\src\emit\lower.rs:99:15 | 99 | pub(crate) fn lower(parts: &Parts) -> Result<Lowered, ShaderError> { | ^^^^^ ``` Marking `lower` `#[cfg(test)]` (or routing through a single entry point) fixes the build. 2. **`view_address_indexed` corrupts the buffer virtual address by adding the descriptor-table byte offset `a.offset` (`crates/victory-shader/src/emit/lower/partial.rs:95`)**: `self.heap_index(site, first, false)` (`lower.rs:5813-5823`) already adds the instruction's immediate `offset` into the descriptor table address before shifting by `>> 5` to compute the heap slot index. `read_view_slot(c, slot)` then loads the descriptor's buffer virtual address `(lo, hi)`. Calling: ```rust let (lo, hi) = self.address_plus(lo, hi, a.offset as i32); ``` adds the *descriptor table* byte offset (`a.offset`) onto the *buffer's* virtual address. Reproduced on `s_load_dwordx4 s[8:11], s[4:5], s0 offset:64` (`scalar = (offset=64, dynamic=Some(Value(0)))`), which shifts the loaded buffer base pointer forward by 64 bytes. 3. **Intercepting `count == 8` in `view_addresses` breaks dynamically indexed image descriptor loads and duplicates dwords `0..3` into `4..7` (`crates/victory-shader/src/emit/lower.rs:4836-4861`)**: - Previously, dynamically indexed `s_load_dwordx8` loads fell through to `view_addresses_handle()` (`t1` in `MEMORY_SPACE`), which provides `image_words` (width, height, mip levels, type) for textures. Now `if count <= 8 && count.is_multiple_of(4)` routes `count == 8` to `SLOT_VIEWS` (`t252`), where `HostHeap::write_view` only records `view.and_then(buffer_range)` — returning `(0, 0, 0, 0)` for every image/texture view and breaking dynamically indexed texture size queries. - In `for group in 0..count / 4`, `group = 1` (`first = 4`) passes `first = 4` to `heap_index`, which computes `(addr + 16) >> 5` — the *same* 32-byte descriptor slot as `group = 0` — duplicating `(lo, hi, len, stride)` into dwords `4..7` instead of marking them `Val::Missing`. Reproduced by lowering `s_load_dwordx8 s[8:15], s[4:5], s0` reading `s12` (dword 4): it lowered with `root_srvs = [252]` and `view_addresses = false`. - Even for 4-dword buffer descriptors (`s_load_dwordx4`), placing raw byte `stride` in dword 3 and raw byte length in dword 2 does not match the hardware `V#` descriptor layout (where stride lives in dword 1 bits 16..29, dword 2 is `num_records`, and dword 3 holds format/swizzle/OOB fields). 4. **`HostHeap::raw_view_at` and `raw_pair_at` leave stale entries in `self.views` (`crates/victory-gpu/src/descriptor/host.rs:489`, `717-718`)**: Both methods call `self.write_stride(index, 4)` and `self.note_address(index, None)` directly without clearing `self.views` (`self.write_view(index, None, 0)`). Reproduced live on RTX 5090: overwriting a `View::Placed` buffer slot with `raw_view_at(slot, None, 0, 0, false)` leaves the previous buffer's address, length, and stride intact in `self.views`. *(Additional note on `DispatchX` partial dispatches)*: `draw.rs:1164-1180` converts thread counts to `div_ceil(size)` for *any* compute pipeline dispatched with `flags & 0x20`, whereas `emit/mod.rs:506-510` only emits `partial_dispatch_prologue` (`USER_DISPATCH_THREADS_X`) for two hardcoded shader digests (and only guards X, not Y/Z). Any other compute shader dispatched with `flags & 0x20` will run trailing lanes past the thread count unguarded.
github-bot force-pushed github-bot/gh-3426 from 74974eb059 to 3f477b13b0 2026-11-27 02:21:15 +00:00 Compare
Author
Owner

@⁠legayclightning22 on GitHub · 2026-11-27 02:23 UTC · original

Pushed <NEW_SHA> fixing all four blocking issues and the DispatchX note:

  1. Gated lower under #[cfg(test)] in crates/victory-shader/src/emit/lower.rs so cargo clippy --locked -p victory-shader --lib -- -D warnings builds with zero unused-function errors.
  2. Removed the duplicate self.address_plus(lo, hi, a.offset as i32) in view_address_indexed (crates/victory-shader/src/emit/lower/partial.rs) since self.heap_index already includes a.offset.
  3. Stopped intercepting count == 8 (s_load_dwordx8) in view_addresses (crates/victory-shader/src/emit/lower.rs) so dynamically indexed texture/image descriptors continue using view_addresses_handle() (t1), and aligned 4-dword SLOT_VIEWS (t252) descriptor layout with hardware V# fields (num_records in dword 2, stride in dword 3 bits 16..29) without duplicating dwords 0..3 into 4..7.
  4. Cleared self.views via self.write_view(index, None, 0) in HostHeap::raw_view_at and raw_pair_at (crates/victory-gpu/src/descriptor/host.rs) so overwriting a View::Placed buffer slot does not leave stale buffer metadata behind.
  5. Scoped draw.rs DispatchX thread-to-group conversion to shaders where the partial-dispatch prologue is emitted so other flags & 0x20 dispatches are never left with unguarded trailing lanes.

Added regression tests covering each of these cases and re-verified victory-shader, victory-gpu, clippy --all-targets --all-features -- -D warnings, and cargo xtask policy.

**@⁠legayclightning22** on GitHub · 2026-11-27 02:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/3426#issuecomment-7208074596) Pushed `<NEW_SHA>` fixing all four blocking issues and the `DispatchX` note: 1. Gated `lower` under `#[cfg(test)]` in `crates/victory-shader/src/emit/lower.rs` so `cargo clippy --locked -p victory-shader --lib -- -D warnings` builds with zero unused-function errors. 2. Removed the duplicate `self.address_plus(lo, hi, a.offset as i32)` in `view_address_indexed` (`crates/victory-shader/src/emit/lower/partial.rs`) since `self.heap_index` already includes `a.offset`. 3. Stopped intercepting `count == 8` (`s_load_dwordx8`) in `view_addresses` (`crates/victory-shader/src/emit/lower.rs`) so dynamically indexed texture/image descriptors continue using `view_addresses_handle()` (`t1`), and aligned 4-dword `SLOT_VIEWS` (`t252`) descriptor layout with hardware `V#` fields (`num_records` in dword 2, stride in dword 3 bits 16..29) without duplicating dwords `0..3` into `4..7`. 4. Cleared `self.views` via `self.write_view(index, None, 0)` in `HostHeap::raw_view_at` and `raw_pair_at` (`crates/victory-gpu/src/descriptor/host.rs`) so overwriting a `View::Placed` buffer slot does not leave stale buffer metadata behind. 5. Scoped `draw.rs` `DispatchX` thread-to-group conversion to shaders where the partial-dispatch prologue is emitted so other `flags & 0x20` dispatches are never left with unguarded trailing lanes. Added regression tests covering each of these cases and re-verified `victory-shader`, `victory-gpu`, `clippy --all-targets --all-features -- -D warnings`, and `cargo xtask policy`.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-27 02:40 UTC · original · requested changes

Good progress on the previous items (cargo clippy -p victory-shader --lib -- -D warnings is now clean, partial.rs no longer adds the table offset to lo, count == 8 falls through to view_addresses, raw_view_at clears self.views, and emit/lower.rs stays under 512 KiB at 523,797 bytes), but there are three remaining correctness bugs in the new 4-dword SLOT_VIEWS path:

Blocking Issues

  1. Wrong RDNA2 V# 4-dword buffer descriptor bit layout (crates/victory-shader/src/emit/lower.rs:561, 4837-4859)

    • In GFX10/RDNA2 4-dword buffer resource descriptors (V#), the 14-bit byte stride (stride & 0x3FFF) << 16 lives in dword 1 bits [29:16] (hi | ((stride & 0x3FFF) << 16) — as already parsed at crates/victory-shader/src/emit/lower.rs:9464-9474), and the identity component swizzle DST_SEL_X/Y/Z/W in dword 3 is 0xFAC (as used at lower.rs:4423 and descriptor/host.rs:1148).
    • Currently lower.rs:4846-4855 leaves dword 1 (hi) with 0 in bits [29:16] (verified locally: bin_of(word(1)) == None), so shaders extracting stride via (V#[1] >> 16) & 0x3FFF read 0, while placing (stride & 0x3FFF) << 16 into dword 3 (mapped) — clobbering FORMAT/INDEX_STRIDE/ADD_TID_ENABLE/OOB_SELECT — and ORing it with SLOT_VIEW_MAPPING = 0x1688 (which is the D3D12 API constant D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING, not an RDNA2 V#[3] encoding).
    • Fix: Pack ((stride & 0x3FFF) << 16) into dword 1 (hi = (hi & 0xFFFF) | ((stride & 0x3FFF) << 16)), and construct dword 3 with valid RDNA2 V#[3] bits (DST_SEL 0xFAC plus appropriate format/OOB bits).
  2. count == 4 does not check a.offset.is_multiple_of(32) (crates/victory-shader/src/emit/lower.rs:4837)

    • A 4-dword load at a.offset = 16 (the upper half, dwords 4–7, of an 8-dword image descriptor) satisfies count == 4 and is currently hijacked to SLOT_VIEWS (verified locally with offset = 16, count = 4), overwriting image descriptor words 4–7 with [lo, hi, records, mapped].
    • Fix: Gate the SLOT_VIEWS path on count == 4 && a.offset.is_multiple_of(32).
  3. HostHeap::write_view records [0, 0, 0, 4] for View::Constant slots (crates/victory-gpu/src/descriptor/host.rs:514-536, 1154)

    • buffer_range(view) returns None for View::Constant(address, size), while view_stride(&View::Constant(..)) returns 4. Verified locally on HostHeap::make_at(5, &View::Constant(0x1_0000_0000, 256)): self.views stores [0, 0, 0, 4], losing the constant buffer's address and byte length.
    • Fix: Handle View::Constant(address, size) when writing self.views (and consider lazy-allocating the 32 MiB self.views upload buffer on demand like self.addresses, rather than eagerly on every HostHeap::new).
**@⁠fuzeofficlal** on GitHub · 2026-11-27 02:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/3426#pullrequestreview-6082778630) · **requested changes** Good progress on the previous items (`cargo clippy -p victory-shader --lib -- -D warnings` is now clean, `partial.rs` no longer adds the table offset to `lo`, `count == 8` falls through to `view_addresses`, `raw_view_at` clears `self.views`, and `emit/lower.rs` stays under 512 KiB at `523,797` bytes), but there are three remaining correctness bugs in the new 4-dword `SLOT_VIEWS` path: ### Blocking Issues 1. **Wrong RDNA2 `V#` 4-dword buffer descriptor bit layout (`crates/victory-shader/src/emit/lower.rs:561, 4837-4859`)** - In GFX10/RDNA2 4-dword buffer resource descriptors (`V#`), the 14-bit byte stride `(stride & 0x3FFF) << 16` lives in **dword 1 bits `[29:16]`** (`hi | ((stride & 0x3FFF) << 16)` — as already parsed at `crates/victory-shader/src/emit/lower.rs:9464-9474`), and the identity component swizzle `DST_SEL_X/Y/Z/W` in dword 3 is `0xFAC` (as used at `lower.rs:4423` and `descriptor/host.rs:1148`). - Currently `lower.rs:4846-4855` leaves dword 1 (`hi`) with `0` in bits `[29:16]` (verified locally: `bin_of(word(1)) == None`), so shaders extracting stride via `(V#[1] >> 16) & 0x3FFF` read `0`, while placing `(stride & 0x3FFF) << 16` into **dword 3** (`mapped`) — clobbering `FORMAT`/`INDEX_STRIDE`/`ADD_TID_ENABLE`/`OOB_SELECT` — and ORing it with `SLOT_VIEW_MAPPING = 0x1688` (which is the D3D12 API constant `D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING`, not an RDNA2 `V#[3]` encoding). - **Fix**: Pack `((stride & 0x3FFF) << 16)` into dword 1 (`hi = (hi & 0xFFFF) | ((stride & 0x3FFF) << 16)`), and construct dword 3 with valid RDNA2 `V#[3]` bits (`DST_SEL` `0xFAC` plus appropriate format/OOB bits). 2. **`count == 4` does not check `a.offset.is_multiple_of(32)` (`crates/victory-shader/src/emit/lower.rs:4837`)** - A 4-dword load at `a.offset = 16` (the upper half, dwords 4–7, of an 8-dword image descriptor) satisfies `count == 4` and is currently hijacked to `SLOT_VIEWS` (verified locally with `offset = 16`, `count = 4`), overwriting image descriptor words 4–7 with `[lo, hi, records, mapped]`. - **Fix**: Gate the `SLOT_VIEWS` path on `count == 4 && a.offset.is_multiple_of(32)`. 3. **`HostHeap::write_view` records `[0, 0, 0, 4]` for `View::Constant` slots (`crates/victory-gpu/src/descriptor/host.rs:514-536, 1154`)** - `buffer_range(view)` returns `None` for `View::Constant(address, size)`, while `view_stride(&View::Constant(..))` returns `4`. Verified locally on `HostHeap::make_at(5, &View::Constant(0x1_0000_0000, 256))`: `self.views` stores `[0, 0, 0, 4]`, losing the constant buffer's address and byte length. - **Fix**: Handle `View::Constant(address, size)` when writing `self.views` (and consider lazy-allocating the 32 MiB `self.views` upload buffer on demand like `self.addresses`, rather than eagerly on every `HostHeap::new`).
Author
Owner

@⁠CocoBeans64 on GitHub · 2026-11-27 17:16 UTC · original

DispatchX flag 0x20 (FIND-38) checked in the title on an RX 6800 XT (RDNA 2, 32..64 lanes): with this PR the builder's two thread-count programs run about the threads they ask for, instead of 64× as many. Two other programs that set the flag (as 0x8020) are not converted and still run 32× theirs.

Setup:

  • Hardware: RX 6800 XT, Windows 10 22H2, Agility SDK 1.614 runtime.
  • Trees: main 63bcca4 + #2118 (78f36cf), with and without this PR at 3f477b1.
  • Builds and runs: diag, VICTORY_GPU_TIMING=1, DRED, default Series X output. Menus by hand, then a few minutes in the opening world area.
  • Local counter in dispatch_x (not part of any PR), for each program and flag value:
    • calls;
    • the product of the counts passed;
    • threads per group, from the console program's numthreads;
    • the threads the dispatch runs: groups × group size, with groups = counts on main, and, with this PR, its own dispatch_counts rule;
    • whether the program is translated with the tail guard (partial_dispatch).

Over 300 frames while the builder runs:

program (threads per group, flags) tail guard threads asked (counts as threads) threads run, main threads run, this PR
28918b7150a7aad5 (64, 0x20) yes 1.4–1.7 M 88.3 M (×64) 2.36 M (×1.37)
caa78b8ca62bc3d6 (64, 0x20) yes 0.31–0.36 M 19.6 M (×64) 1.84 M (×5.1)
5062bc7a48e842f8 (32, 0x8020) no 18.6–32.0 M 596 M (×32) 1,024 M (×32), unchanged
4ddd6f9702fab2a7 (32, 0x8020) no 3,808–4,556 ×32 ×32, unchanged
  • The builder's programs: the residual factor with this PR is the rounding up to whole groups. Most of these dispatches are small: caa78b8ca62bc3d6 averages about 13 threads per call, so most of each 64-thread group exits at the guard.
  • The two 0x8020 programs: they get guarded = false, so dispatch_counts keeps the counts as groups. Both set bit 0x20 too.
    • Either they need the same tail guard in the translator, or the conversion should not depend on it.
    • The second option would need another way to stop the extra lanes, so I am not suggesting it as is.
    • I have not looked at why the translator gives them no guard.
  • What stays the same: #2118 still holds the builder back after its first frames, on both trees, for another reason: a root view's offset: no root view, or outside title buffers. So total GPU time is the same within noise (158 vs 160 ms of commands per frame), and this run cannot show the builder's own cost with and without the fix.
  • Stability: no device removal or crash on either tree.
  • Image: no visible difference between the two trees.
  • Prebuild: with this PR, 5 pipelines are new in the library and the other 27,130 are unchanged.

Not covered: the image effect of the builder running fully, which is blocked here by the hold above; your heap-slot lookup tables (t252), which I did not look at separately; the test suites at this head.

No title data in this comment. AI-assisted (Claude).

**@⁠CocoBeans64** on GitHub · 2026-11-27 17:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/3426#issuecomment-7224226369) **`DispatchX` flag `0x20` (FIND-38) checked in the title on an RX 6800 XT (RDNA 2, 32..64 lanes): with this PR the builder's two thread-count programs run about the threads they ask for, instead of 64× as many. Two other programs that set the flag (as `0x8020`) are not converted and still run 32× theirs.** **Setup:** - Hardware: RX 6800 XT, Windows 10 22H2, Agility SDK 1.614 runtime. - Trees: `main` `63bcca4` + #2118 (`78f36cf`), with and without this PR at `3f477b1`. - Builds and runs: diag, `VICTORY_GPU_TIMING=1`, DRED, default Series X output. Menus by hand, then a few minutes in the opening world area. - Local counter in `dispatch_x` (not part of any PR), for each program and flag value: - `calls`; - the product of the counts passed; - threads per group, from the console program's `numthreads`; - the threads the dispatch runs: groups × group size, with groups = counts on `main`, and, with this PR, its own `dispatch_counts` rule; - whether the program is translated with the tail guard (`partial_dispatch`). **Over 300 frames while the builder runs:** | program (threads per group, flags) | tail guard | threads asked (counts as threads) | threads run, `main` | threads run, this PR | |---|---|---:|---:|---:| | `28918b7150a7aad5` (64, `0x20`) | yes | 1.4–1.7 M | 88.3 M (×64) | **2.36 M** (×1.37) | | `caa78b8ca62bc3d6` (64, `0x20`) | yes | 0.31–0.36 M | 19.6 M (×64) | **1.84 M** (×5.1) | | `5062bc7a48e842f8` (32, `0x8020`) | **no** | 18.6–32.0 M | 596 M (×32) | 1,024 M (×32), unchanged | | `4ddd6f9702fab2a7` (32, `0x8020`) | **no** | 3,808–4,556 | ×32 | ×32, unchanged | - **The builder's programs:** the residual factor with this PR is the rounding up to whole groups. Most of these dispatches are small: `caa78b8ca62bc3d6` averages about 13 threads per call, so most of each 64-thread group exits at the guard. - **The two `0x8020` programs:** they get `guarded = false`, so `dispatch_counts` keeps the counts as groups. Both set bit `0x20` too. - Either they need the same tail guard in the translator, or the conversion should not depend on it. - The second option would need another way to stop the extra lanes, so I am not suggesting it as is. - I have not looked at why the translator gives them no guard. - **What stays the same:** #2118 still holds the builder back after its first frames, on both trees, for another reason: `a root view's offset: no root view, or outside title buffers`. So total GPU time is the same within noise (158 vs 160 ms of commands per frame), and this run cannot show the builder's own cost with and without the fix. - **Stability:** no device removal or crash on either tree. - **Image:** no visible difference between the two trees. - **Prebuild:** with this PR, 5 pipelines are new in the library and the other 27,130 are unchanged. **Not covered:** the image effect of the builder running fully, which is blocked here by the hold above; your heap-slot lookup tables (`t252`), which I did not look at separately; the test suites at this head. No title data in this comment. AI-assisted (Claude).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3426'
git switch 'github-bot/gh-3426'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3426'
git switch 'github-bot/gh-3426'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3426'
git switch 'main'
git merge --squash 'github-bot/gh-3426'
git switch 'main'
git merge --ff-only 'github-bot/gh-3426'
git switch 'main'
git merge 'github-bot/gh-3426'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3426
No description provided.