Ray-tracing builder: none of its compute shaders translate in the title (root UAVs, addresses in root constants) #614

Open
opened 2026-11-26 04:10:05 +00:00 by github-bot · 9 comments
Owner

@⁠etcetera-yt on GitHub · 2026-11-24 05:36 UTC · original

Counts and container-format facts only: no shader hashes, disassembly or other game data.

What happens

XboxBvhBuilder.dll holds 52 compute programs. In a release run into the first mission, the title uses 35 of
them, and all 35 fail at pipeline creation, so their dispatches are dropped. In that run, 4 of the 7 programs
dropping the most dispatches per frame are builder programs: about 690 dropped dispatches per frame together.
Whatever reads the structures they should build then reads nothing.

How the builder's programs get their arguments

Read from the containers as crates/victory-shader/src/native.rs documents them:

  • Each container has an RTS0 root signature (version 2, flags 0x3000000: directly indexed heaps) made only of
    root views (UAV, SRV) and root constants (1 to 19 dwords); no descriptor tables.
  • Each compute record has a root layout table (3 to 9 entries) whose first parameter starts at user-data dword 16,
    while COMPUTE_PGM_RSRC2 asks for 4 user SGPRs. The program reads its arguments through the table s[0:1]
    points to (the high dword masked to a 40-bit address): dword 16 + k of the user data is at byte 4 * k.

That is the spill-table case #302 handles. With #302 merged, the 35 programs the title uses still fail, for these
reasons:

programs reason
10 a root UAV or typed root view is not supported (most builder buffers are root UAVs)
8 an address from a root parameter that is no address (addresses passed as two root constants)
12 an address not from a root parameter (not looked at yet)
4 console wave64 lanes on a host without 64-lane waves
1 an address in an SGPR that is no root parameter

What it needs

  1. Root UAVs end to end (#294 adds them).
  2. Addresses held in a pair of root constants, treated like a root view's address (translator and the GPU side).
  3. A look at the 12 programs whose addresses come from neither.

Note: victory translate does not apply #302's spill rewrite (apps/victory/src/translate.rs calls ir::build),
so on the command line all 52 still fail with "an address in an SGPR that is no root parameter". Comment on #302.

Related: #274 (the builder's containers use the same native format as the title's), #302, #294.

Checked on: main (d2a4bae) with #175, #89, #302, #489, #307, #320, #550, #483, #452, #587 and 162 other open PRs
merged locally, release build, Windows 10 19045, RTX 5060 Ti (driver 621.14). Not checked on AMD.

AI use: Claude Code, Claude Opus 5.5.

**@⁠etcetera-yt** on GitHub · 2026-11-24 05:36 UTC · [original](https://github.com/Marvisak/VIctory/issues/614) Counts and container-format facts only: no shader hashes, disassembly or other game data. ## What happens `XboxBvhBuilder.dll` holds 52 compute programs. In a release run into the first mission, the title uses 35 of them, and all 35 fail at pipeline creation, so their dispatches are dropped. In that run, 4 of the 7 programs dropping the most dispatches per frame are builder programs: about 690 dropped dispatches per frame together. Whatever reads the structures they should build then reads nothing. ## How the builder's programs get their arguments Read from the containers as `crates/victory-shader/src/native.rs` documents them: - Each container has an `RTS0` root signature (version 2, flags 0x3000000: directly indexed heaps) made only of root views (UAV, SRV) and root constants (1 to 19 dwords); no descriptor tables. - Each compute record has a root layout table (3 to 9 entries) whose first parameter starts at user-data dword 16, while `COMPUTE_PGM_RSRC2` asks for 4 user SGPRs. The program reads its arguments through the table `s[0:1]` points to (the high dword masked to a 40-bit address): dword `16 + k` of the user data is at byte `4 * k`. That is the spill-table case #302 handles. With #302 merged, the 35 programs the title uses still fail, for these reasons: | programs | reason | |---|---| | 10 | a root UAV or typed root view is not supported (most builder buffers are root UAVs) | | 8 | an address from a root parameter that is no address (addresses passed as two root constants) | | 12 | an address not from a root parameter (not looked at yet) | | 4 | console wave64 lanes on a host without 64-lane waves | | 1 | an address in an SGPR that is no root parameter | ## What it needs 1. Root UAVs end to end (#294 adds them). 2. Addresses held in a pair of root constants, treated like a root view's address (translator and the GPU side). 3. A look at the 12 programs whose addresses come from neither. Note: `victory translate` does not apply #302's spill rewrite (`apps/victory/src/translate.rs` calls `ir::build`), so on the command line all 52 still fail with "an address in an SGPR that is no root parameter". Comment on #302. Related: #274 (the builder's containers use the same native format as the title's), #302, #294. Checked on: `main` (d2a4bae) with #175, #89, #302, #489, #307, #320, #550, #483, #452, #587 and 162 other open PRs merged locally, release build, Windows 10 19045, RTX 5060 Ti (driver 621.14). Not checked on AMD. AI use: Claude Code, Claude Opus 5.5.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:10:05 +00:00
Author
Owner

@⁠itsRevela on GitHub · 2026-11-24 06:28 UTC · original

Where the an address from a root parameter that is no address programs go next, measured in the title's opening cutscene. Counts only.

The case. On plain main these programs stop earlier, at no root parameter. With #302 and #489, 8 compute programs in the cutscene stop here, all with the address passed as two root constants. 7 of the 8 first use that address in a global_load, and none stores or does atomics through it.

The prototype. I prototyped the read-only route locally:

  • the tracker recognises the constant pair, at any dword, across two parameters, and with an added offset;
  • the lowering reads through a raw root SRV;
  • the GPU layer composes the address from the constants' current values at each draw and binds it with root_view.

That's 12 unit tests and a GPU test on the RTX 3070 Ti and WARP, and the GPU bound the views without errors in the title.

The result. It clears this reason for all 8, but none of them translates yet. Each stops at the next case:

next failure programs
a scalar load (s_load_dword*) through the root-constant address 3
an address from a phi 2
a root UAV or typed root view (#294) 2
an address in an SGPR that is no root parameter (another address in the same program) 1

So on its own the change doesn't make these programs run, and I'm not opening it as a PR for now. It touches the same files as #294 and #307. Scalar loads through the same view would be the cheapest next step; the phi addresses and #294 are needed for the rest.

If someone takes this on, the branch is itsRevela/VIctory:shaders/root-constant-addresses. It's on top of #489, and I'll push it on request.

AI-assisted (Claude Code).

**@⁠itsRevela** on GitHub · 2026-11-24 06:28 UTC · [original](https://github.com/Marvisak/VIctory/issues/614#issuecomment-7123977273) Where the `an address from a root parameter that is no address` programs go next, measured in the title's opening cutscene. Counts only. **The case.** On plain `main` these programs stop earlier, at `no root parameter`. With #302 and #489, 8 compute programs in the cutscene stop here, all with the address passed as two root constants. 7 of the 8 first use that address in a `global_load`, and none stores or does atomics through it. **The prototype.** I prototyped the read-only route locally: - the tracker recognises the constant pair, at any dword, across two parameters, and with an added offset; - the lowering reads through a raw root SRV; - the GPU layer composes the address from the constants' current values at each draw and binds it with `root_view`. That's 12 unit tests and a GPU test on the RTX 3070 Ti and WARP, and the GPU bound the views without errors in the title. **The result.** It clears this reason for all 8, but none of them translates yet. Each stops at the next case: | next failure | programs | |---|---| | a scalar load (`s_load_dword*`) through the root-constant address | 3 | | `an address from a phi` | 2 | | `a root UAV or typed root view` (#294) | 2 | | `an address in an SGPR that is no root parameter` (another address in the same program) | 1 | So on its own the change doesn't make these programs run, and I'm not opening it as a PR for now. It touches the same files as #294 and #307. Scalar loads through the same view would be the cheapest next step; the phi addresses and #294 are needed for the rest. If someone takes this on, the branch is `itsRevela/VIctory:shaders/root-constant-addresses`. It's on top of #489, and I'll push it on request. AI-assisted (Claude Code).
Author
Owner

@⁠itsRevela on GitHub · 2026-11-24 07:12 UTC · original

Update to my comment above: with scalar loads through the same view, and structured access through root UAVs (#709, on top of #294), 3 of those 8 programs translate, and the host accepts their pipelines. So I opened the root-constant address work as #710 (stacked on #489). The remaining 5 stop at an address from a phi (2), another non-root address (1) and an LDS operation (1); one of them is the scalar-load case from my comment. Counts only. AI-assisted (Claude Code).

**@⁠itsRevela** on GitHub · 2026-11-24 07:12 UTC · [original](https://github.com/Marvisak/VIctory/issues/614#issuecomment-7124738028) Update to my comment above: with scalar loads through the same view, and structured access through root UAVs (#709, on top of #294), **3 of those 8 programs translate**, and the host accepts their pipelines. So I opened the root-constant address work as #710 (stacked on #489). The remaining 5 stop at `an address from a phi` (2), another non-root address (1) and an LDS operation (1); one of them is the scalar-load case from my comment. Counts only. AI-assisted (Claude Code).
Author
Owner

@⁠Cobrall on GitHub · 2026-11-24 07:30 UTC · original

"Hi everyone, seeing the struggles with shaders failing to translate or causing black screens/GPU hangs.
To help debug this, I built a verification harness that provides a bit-exact golden model for FidelityFX CAS: github.com/Cobrall/ffx-kit
Why it helps: Naive 'mathematically correct' CPU references often disagree with AMD's intended fast-math paths (like APrxLoRcpF1) by up to ~8.5%, causing false failures when validating a shader translator. This kit provides the exact expected output (including D3D saturate(NaN)=0 semantics), so you can definitively prove whether a translated shader is correct or if the bug lies elsewhere (e.g., descriptors, memory, or wave64 emulation).
It includes 8 verified fp32 .spv variants and a Python reference. Hope this saves some debugging time on the render loop!"

**@⁠Cobrall** on GitHub · 2026-11-24 07:30 UTC · [original](https://github.com/Marvisak/VIctory/issues/614#issuecomment-7125075990) "Hi everyone, seeing the struggles with shaders failing to translate or causing black screens/GPU hangs. To help debug this, I built a verification harness that provides a bit-exact golden model for FidelityFX CAS: [github.com/Cobrall/ffx-kit](https://github.com/Cobrall/ffx-kit) Why it helps: Naive 'mathematically correct' CPU references often disagree with AMD's intended fast-math paths (like APrxLoRcpF1) by up to ~8.5%, causing false failures when validating a shader translator. This kit provides the exact expected output (including D3D saturate(NaN)=0 semantics), so you can definitively prove whether a translated shader is correct or if the bug lies elsewhere (e.g., descriptors, memory, or wave64 emulation). It includes 8 verified fp32 .spv variants and a Python reference. Hope this saves some debugging time on the render loop!"
Author
Owner

@⁠Machad3x on GitHub · 2026-11-24 13:31 UTC · original

Data point for the compute shaders in this issue, measured offline with victory translate --list --validate over 48 untranslated world containers dumped from a run (fork Machad3x/VIctory, branch claude/gta6-shader-translation-crashes-705550): 48 fail on main; 41 after #302 + #489 (spill table) + #294 (root UAVs); 36 after #709, #585, #309. The 12 shaders that read through an address held in root constants (global_load through s[10:11] from root constants) are the ones still stopped by this issue; #667 does not merge cleanly on top of #294 (the root view register becomes 16 bits and draw.rs's RootView enum changes), so it needs a rebase after #294 lands. Also, one of the compute shaders that only translates since #302/#294 (4ddd6f9702fab2a7, in place, two root UAVs with the same address) stores -1 at byte 20580 and was followed once by a title fault on a corrupted pointer: root UAV write-back may need care.

**@⁠Machad3x** on GitHub · 2026-11-24 13:31 UTC · [original](https://github.com/Marvisak/VIctory/issues/614#issuecomment-7132946063) Data point for the compute shaders in this issue, measured offline with victory translate --list --validate over 48 untranslated world containers dumped from a run (fork Machad3x/VIctory, branch claude/gta6-shader-translation-crashes-705550): 48 fail on main; 41 after #302 + #489 (spill table) + #294 (root UAVs); 36 after #709, #585, #309. The 12 shaders that read through an address held in root constants (global_load through s[10:11] from root constants) are the ones still stopped by this issue; #667 does not merge cleanly on top of #294 (the root view register becomes 16 bits and draw.rs's RootView enum changes), so it needs a rebase after #294 lands. Also, one of the compute shaders that only translates since #302/#294 (4ddd6f9702fab2a7, in place, two root UAVs with the same address) stores -1 at byte 20580 and was followed once by a title fault on a corrupted pointer: root UAV write-back may need care.
Author
Owner

@⁠Machad3x on GitHub · 2026-11-24 16:27 UTC · original

Port of the root-constants idea onto a tree that already has #294/#650 (fork Machad3x/VIctory, commits 405011a, 74a2681, 8ff8a41, 31f4a19): root views are named by a 16-bit register, an address held in two root constants is bound as a root SRV (reads) or UAV (writes) whose address the host reads from the two dwords at bind time, the view size goes in a user-data dword past every parameter's registers and accesses are checked against it (also added a bounds check to global_store through root views). It follows #710's pair detection (the high-half constant identifies the pair), because #667's simpler form misses s10 + (v0 << 3) plus carry, the real shape in the corpus. Offline over 25 world compute shaders: translated compute 4 -> 9 of 25; 'an address from a root parameter that is no address' 8 -> 0; 'an address in an SGPR that is no root parameter' 1 -> 0; 'an address not from a root parameter' stays 12 but they are other shapes now (pointer chasing through GPU memory, constant<<8|12, per-branch addresses). A GPU test dispatches a program reading and writing through two constants-held addresses (re-reads the constants on the next dispatch, falls back when unset) and passes.

**@⁠Machad3x** on GitHub · 2026-11-24 16:27 UTC · [original](https://github.com/Marvisak/VIctory/issues/614#issuecomment-7137705018) Port of the root-constants idea onto a tree that already has #294/#650 (fork Machad3x/VIctory, commits 405011a, 74a2681, 8ff8a41, 31f4a19): root views are named by a 16-bit register, an address held in two root constants is bound as a root SRV (reads) or UAV (writes) whose address the host reads from the two dwords at bind time, the view size goes in a user-data dword past every parameter's registers and accesses are checked against it (also added a bounds check to global_store through root views). It follows #710's pair detection (the high-half constant identifies the pair), because #667's simpler form misses s10 + (v0 << 3) plus carry, the real shape in the corpus. Offline over 25 world compute shaders: translated compute 4 -> 9 of 25; 'an address from a root parameter that is no address' 8 -> 0; 'an address in an SGPR that is no root parameter' 1 -> 0; 'an address not from a root parameter' stays 12 but they are other shapes now (pointer chasing through GPU memory, constant<<8|12, per-branch addresses). A GPU test dispatches a program reading and writing through two constants-held addresses (re-reads the constants on the next dispatch, falls back when unset) and passes.
Author
Owner

@⁠nineforge0 on GitHub · 2026-11-24 08:12 UTC · original · edited 2026-11-24 23:13 UTC

We extracted the root parameter layouts of all 9,282 mesh shader programs and 2,647 compute shaders from the retail shader database (shaders.rpf entry 0) using forge9. Here are the findings that may help with the rootless mesh shader translation:

All mesh shaders follow a uniform 7-parameter binding model:

Slot Type SGPR count Contents
s8 Table 1 Main descriptor table (72-261 entries)
s9 Table 1 Secondary table (4-13 entries)
s10 Table 1 Single-entry table
s11 Descriptor 2 Root CBV/SRV (reg 0-9)
s13 Constants 1 1-2 dwords at b500/b501
s15 ResourceHeap 1 Bindless resource heap
s16 SamplerHeap 1 Bindless sampler heap (87% of shaders)

Key findings:

  • Tables take 1 dword in root memory, Descriptors take 2 dwords.
  • CascadeShadow shaders (522 programs) use a 5-param variant: no SamplerHeap, 1dw constants, Descriptor at s10 instead of s11.
  • Compute shaders start at s4 (not s8), consistent with the 32-SGPR compute user-data window.
  • The 64 RT trace/BVH compute shaders use only Tables + ResourceHeap + SamplerHeap in their FSSM root layouts. No root UAVs or root-constant address pairs appear in FSSM metadata.

Full docs: https://github.com/nineforge0/forge9/blob/main/docs/mesh_shader_binding_model.md

To reproduce: forge9 fssm shaders.rpf 0 --roots dumps the complete root parameter map for all 25,194 programs.

Hope this helps with the rootless shader translation path.

Edit: the source is the title's shader database (shaders.rpf entry 0), not the pipeline cache. See the correction below for the scope of the last finding.

**@⁠nineforge0** on GitHub · 2026-11-24 08:12 UTC · [original](https://github.com/Marvisak/VIctory/issues/614#issuecomment-7125858310) · edited 2026-11-24 23:13 UTC We extracted the root parameter layouts of all 9,282 mesh shader programs and 2,647 compute shaders from the retail shader database (`shaders.rpf` entry 0) using [forge9](https://github.com/nineforge0/forge9). Here are the findings that may help with the rootless mesh shader translation: **All mesh shaders follow a uniform 7-parameter binding model:** | Slot | Type | SGPR count | Contents | |------|------|-----------|----------| | s8 | Table | 1 | Main descriptor table (72-261 entries) | | s9 | Table | 1 | Secondary table (4-13 entries) | | s10 | Table | 1 | Single-entry table | | s11 | Descriptor | 2 | Root CBV/SRV (reg 0-9) | | s13 | Constants | 1 | 1-2 dwords at b500/b501 | | s15 | ResourceHeap | 1 | Bindless resource heap | | s16 | SamplerHeap | 1 | Bindless sampler heap (87% of shaders) | **Key findings:** - Tables take **1 dword** in root memory, Descriptors take **2 dwords**. - CascadeShadow shaders (522 programs) use a 5-param variant: no SamplerHeap, 1dw constants, Descriptor at s10 instead of s11. - Compute shaders start at s4 (not s8), consistent with the 32-SGPR compute user-data window. - The 64 RT trace/BVH compute shaders use only Tables + ResourceHeap + SamplerHeap in their FSSM root layouts. No root UAVs or root-constant address pairs appear in FSSM metadata. **Full docs:** https://github.com/nineforge0/forge9/blob/main/docs/mesh_shader_binding_model.md **To reproduce:** `forge9 fssm shaders.rpf 0 --roots` dumps the complete root parameter map for all 25,194 programs. Hope this helps with the rootless shader translation path. _Edit: the source is the title's shader database (`shaders.rpf` entry 0), not the pipeline cache. See the [correction below](https://git.gtahub.st/github/Marvisak--VIctory/issues/614) for the scope of the last finding._
Author
Owner

@⁠nineforge0 on GitHub · 2026-11-24 23:06 UTC · original

Correction to our comment above. Its numbers come from the title's shader database (shaders.rpf entry 0), not the pipeline cache. Its last finding, "The 64 RT trace/BVH compute shaders use only Tables + ResourceHeap + SamplerHeap in their FSSM root layouts. No root UAVs or root-constant address pairs appear in FSSM metadata", is about the ray-traversal compute shaders in that database. This issue is about the 52 compute programs in XboxBvhBuilder.dll, which we did not read. So that finding says nothing about the builder's programs and does not contradict the root UAV and root-constant address measurements in this thread.

AI use: drafted with Claude Code (Claude Opus 5.5) for @⁠nineforge0.

**@⁠nineforge0** on GitHub · 2026-11-24 23:06 UTC · [original](https://github.com/Marvisak/VIctory/issues/614#issuecomment-7147015997) Correction to [our comment above](https://git.gtahub.st/github/Marvisak--VIctory/issues/614). Its numbers come from the title's shader database (`shaders.rpf` entry 0), not the pipeline cache. Its last finding, "The 64 RT trace/BVH compute shaders use only Tables + ResourceHeap + SamplerHeap in their FSSM root layouts. No root UAVs or root-constant address pairs appear in FSSM metadata", is about the ray-traversal compute shaders in that database. This issue is about the 52 compute programs in `XboxBvhBuilder.dll`, which we did not read. So that finding says nothing about the builder's programs and does not contradict the root UAV and root-constant address measurements in this thread. AI use: drafted with Claude Code (Claude Opus 5.5) for @⁠nineforge0.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:45 UTC · original · edited 2026-11-25 06:49 UTC

Automated triage for the maintainers.

Correction to my earlier note, after the comment from @⁠fuzeofficlal: on main, an address built from a low/high pair of root constants is no longer refused. Tracer::traced_address in crates/victory-shader/src/resource.rs still returns "an address from a root parameter that is no address", but its caller Tracer::address treats that reason (with the other "data" reasons) as title memory (MEMORY), covered by the test computed_addresses_are_title_memory. So the central case of this issue may already be served by main.

What would settle it: the per-reason counts of the ray-tracing builder's compute programs from a run on current main (counts only, as before). If none are refused any more, this can be closed as fixed; if some are, the remaining reasons tell us what is still open.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:45 UTC · [original](https://github.com/Marvisak/VIctory/issues/614#issuecomment-7149919554) · edited 2026-11-25 06:49 UTC <!-- victory-issue-triage v1 verdict=needs-info seen=2026-11-25T05:55:33Z at=2026-11-25T06:49:34Z --> Automated triage for the maintainers. Correction to my earlier note, after the comment from @⁠fuzeofficlal: on `main`, an address built from a low/high pair of root constants is no longer refused. `Tracer::traced_address` in `crates/victory-shader/src/resource.rs` still returns "an address from a root parameter that is no address", but its caller `Tracer::address` treats that reason (with the other "data" reasons) as title memory (`MEMORY`), covered by the test `computed_addresses_are_title_memory`. So the central case of this issue may already be served by `main`. What would settle it: the per-reason counts of the ray-tracing builder's compute programs from a run on current `main` (counts only, as before). If none are refused any more, this can be closed as fixed; if some are, the remaining reasons tell us what is still open. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 05:55 UTC · original

Checked 940d32f while investigating this: 64-bit addresses passed in RootType::Constants (lo, hi) pairs are already served on main via the two-level raw-address page table (27c3dc9d / 0f63757, as noted on #710).

Specifically, while Tracer::traced_address (crates/victory-shader/src/resource.rs:915) still returns Err("an address from a root parameter that is no address"), its caller Tracer::address (resource.rs:810-839) matches that string in DATA and routes the access to MEMORY (Lower::memory), covered by resource::tests::computed_addresses_are_title_memory (resource.rs:2518) and emit::memory_tests::title_memory_is_read_and_written_at_computed_addresses (memory_tests.rs:61).

**@⁠fuzeofficlal** on GitHub · 2026-11-25 05:55 UTC · [original](https://github.com/Marvisak/VIctory/issues/614#issuecomment-7154269838) Checked `940d32f` while investigating this: 64-bit addresses passed in `RootType::Constants` `(lo, hi)` pairs are already served on `main` via the two-level raw-address page table (`27c3dc9d` / `0f63757`, as noted on #710). Specifically, while `Tracer::traced_address` (`crates/victory-shader/src/resource.rs:915`) still returns `Err("an address from a root parameter that is no address")`, its caller `Tracer::address` (`resource.rs:810-839`) matches that string in `DATA` and routes the access to `MEMORY` (`Lower::memory`), covered by `resource::tests::computed_addresses_are_title_memory` (`resource.rs:2518`) and `emit::memory_tests::title_memory_is_read_and_written_at_computed_addresses` (`memory_tests.rs:61`).
This discussion has been locked. Commenting is limited to contributors.
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#614
No description provided.