ProjectScarlett start menu: compute roots, faster compiles, watchdog pause #216

Manually merged
github merged 12 commits from github-bot/gh-216 into main 2026-11-26 11:23:32 +00:00 AGit
Owner

@⁠bbijsterbosch on GitHub · 2026-11-26 08:50 UTC · original
bbijsterbosch:projectscarlett/start-menu → main · +1667 −103 · 57 files · 12 commits · merged 2026-11-26 11:19 UTC

Summary

With this branch, ProjectScarlett 1.0.2.1 boots to its start menu on an NVIDIA laptop GPU under GE-Proton11-14. When the menu was up, no stand-in pipeline was bound (null usage … compute=0 raster=0).

Stand-ins remain during boot. 288 distinct stages had no translation (207 compute, 45 pixel, 32 mesh, 4 vertex). With the default 20 s deadline, many large compute pipelines also returned a stand-in while their driver compile went on.

The run used these twelve commits on ac4f099. They are now rebased onto main (773278a) without conflicts. Each commit builds on its own and passes the translator tests. The only addition to the build that ran is a one-line test fix (a missing strides field in an inline-arena test initializer).

Translator (xshader)

Commit Change
lower long jumps and waterfall lane reads A s_getpc/s_add_u32/s_addc_u32/s_setpc long jump with a provable target becomes a branch. A waterfall loop that gives each lane the value of the lane it names becomes a single group gather through the compute swizzle exchange.
lower DPP16 row-shift prefix sums The wave32 compaction scan (four row_shr adds, v_permlanex16, upper-row add) becomes WavePrefixSum. A select-then-copy into the accumulator is first merged into one select.
follow SCC through packed-root pointer masks SCC provenance is a 107th state word: s_cselect/s_addc/s_subb are accepted when SCC came from plain data.
take root table SGPRs from FSSM user-data records A user-data record that names a table pointer's SGPR overrides the per-stage default.
keep unproved uniform loops in the full-mask mode Structured loops with wave-uniform scalars translate and keep the emitter's watchdog. VCC is accepted as an SMEM offset.
or jump flags together in compute programs Compute guards use | and j = j | (c). The resolve kernels' unoptimised DXIL has a third fewer blocks, and DXC optimises them in 45 s instead of 83–110 s.
refuse translations beyond DXC's memory budget HLSL above 8 MiB is refused. Two 10 MB programs had taken 11 GB of DXC memory each.
read heap buffer strides from the runtime's table With root SRV t1, space32766 in the root, heap-loaded buffer descriptors get word 1 (the stride) from the runtime, so heap-indexed IDXEN accesses translate.

Runtime (d3d12, dxbc)

  • Compute programs bound to the root the title pairs them with:
    • Roots with more than two tables, or with root descriptors and constants after the tables, are accepted when the user data confirms every binding.
    • A pipeline root replaces an embedded RTS0.
    • Literal samplers that a root without flag 0x800 lacks become private statics. A root that reflection cannot describe gets a samplers-only extension, bound around each dispatch.
    • Paged heaps keep a per-slot buffer stride table, from view creation and descriptor copies. A program refused only for want of strides is retried with that table appended as a root SRV, and each dispatch binds it.
    • A rejected raster stream records its guest root and stages under the existing capture variables.
  • clzero: ProjectScarlett's hot clearing routine (RVA 0x4E8AA10) gets AVX stores in place of five clzero loops. On hosts without CLZERO, every call used to trap five times, about four million exceptions in half an hour.
  • Hang watchdog: ProjectScarlett's watchdog is paused while a title thread waits on a translation or a driver compile. It used to crash the title after long waits.

Both title patches write nothing unless the code matches 1.0.2.1 byte for byte. TUXBOX_KEEP_TITLE_WATCHDOG=1 keeps the watchdog.

Launcher

  • The -O0 compile cap scales with the HLSL size: 90 s per MB, between 90 and 600 s. The 2.5 MB resolve kernels used to time out on every boot.
  • Game runs set VKD3D_SHADER_DEBUG=err, so DXIL conversion failures name the construct the shader compiler rejected.

Host-profile record

host_profiles.txt changes for the saveexec and empty programs on every profile. Their jump-flag guards are now joined with | (commit "or jump flags together in compute programs"). Nothing else in the record changes.

Verified on Lanes

A pull request is not merged until Lanes passes on a GPU. Run:

python tuxbox.py check
  • python tuxbox.py check passed on this branch: every stage that ran passed, including Lanes and the fixtures on the GPU. The D3D12 regression controls and the translator GPU checks did not run, because they need --proton, --prefix and --windows-dxc.
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below.
    • The clzero and watchdog patches match ProjectScarlett 1.0.2.1 code bytes and change nothing elsewhere, so Lanes cannot exercise them. Their unit tests check the byte matching.
    • The translator lowerings have unit tests built from the ProjectScarlett instruction sequences. They are not yet in check_translator_gpu.py.
    • The runtime root and stride binding could be covered by a Lanes scenario, but none has been added yet.

GPU, driver and backend: NVIDIA RTX 3000 Ada Generation Laptop GPU (10de:2838, host profile wave 32-32), driver 620.73.04, Proton backend with GE-Proton11-14 (vkd3d-proton v3.1-83-gcae8353ed), Linux 7.3.5.

  • This changes code both vendors run, and the check passed on an AMD and an NVIDIA card (why). Otherwise, say which vendor still needs to run it: AMD still needs to run it. NVIDIA passed the check above and ran ProjectScarlett with this build.

Paste the summary printed at the end:

Summary
  passed   Build the shader compiler (0s)
  passed   Python tests (3s)
  passed   Shader compiler tests (0s)
  passed   DXBC tests (0s)
  passed   XG layout tests (1s)
  passed   D3D12 Windows typecheck (0s)
  passed   Build (23s)
  passed   Lanes and fixtures on the GPU (201s)
  not run: pass --proton, --prefix and --windows-dxc D3D12 regression controls (0s)
  not run: pass --proton, --prefix and --windows-dxc Shader translator on the GPU (0s)

All checks that ran passed.

ProjectScarlett 1.0.2.1 with this build at its start menu, from the game log:

TuxBox d3d12_xs: host profile: adapter=10de:2838 wave=32-32 section-import=aliased descriptor-bytes=32/32
TuxBox d3d12_xs: replaced clzero loops at RVA 0x4e8aa10 with AVX stores (host lacks CLZERO)
TuxBox d3d12_xs: pausing the title's hang watchdog (RVA 0x71b6330) while shaders compile
TuxBox d3d12_xs: translated a compute shader with the heap stride table
TuxBox d3d12_xs: null usage interval recorded=0 display_bound=0 tracked=0 overflow=0 overflow_display_bound=0 compute=0 raster=0 interval=279 trigger=present_sample
TuxBox d3d12_xs: presented 124 frames in 10s, 142055 in total

Checks

CI runs the Python unit tests, the shader compiler, DXBC, and XG layout tests, and a Windows typecheck of tuxbox-d3d12.

These ran locally on the rebased tip, as in CI:

Check Result
python -m unittest discover -s tests -q 371 tests, OK (18 skipped)
cargo test … tools/shader-compiler 334 passed; before the rebase, it also passed at every translator commit
cargo test -p tuxbox-dxbc --features native-bindings 66 passed
cargo test -p tuxbox-xg-layout 14 passed
cargo check --target x86_64-pc-windows-msvc -p tuxbox-d3d12 clean, also with --tests, here and at every runtime commit before the rebase

No evidence JSON changes.

🤖 Generated with Claude Code

**@⁠bbijsterbosch** on GitHub · 2026-11-26 08:50 UTC · [original](https://github.com/brcly/TuxBox/pull/216) `bbijsterbosch:projectscarlett/start-menu` → `main` · +1667 −103 · 57 files · 12 commits · merged 2026-11-26 11:19 UTC ## Summary With this branch, ProjectScarlett 1.0.2.1 boots to its start menu on an NVIDIA laptop GPU under GE-Proton11-14. When the menu was up, no stand-in pipeline was bound (`null usage … compute=0 raster=0`). Stand-ins remain during boot. 288 distinct stages had no translation (207 compute, 45 pixel, 32 mesh, 4 vertex). With the default 20 s deadline, many large compute pipelines also returned a stand-in while their driver compile went on. The run used these twelve commits on `ac4f099`. They are now rebased onto `main` (`773278a`) without conflicts. Each commit builds on its own and passes the translator tests. The only addition to the build that ran is a one-line test fix (a missing `strides` field in an inline-arena test initializer). ### Translator (`xshader`) | Commit | Change | | --- | --- | | lower long jumps and waterfall lane reads | A `s_getpc`/`s_add_u32`/`s_addc_u32`/`s_setpc` long jump with a provable target becomes a branch. A waterfall loop that gives each lane the value of the lane it names becomes a single group gather through the compute swizzle exchange. | | lower DPP16 row-shift prefix sums | The wave32 compaction scan (four `row_shr` adds, `v_permlanex16`, upper-row add) becomes `WavePrefixSum`. A select-then-copy into the accumulator is first merged into one select. | | follow SCC through packed-root pointer masks | SCC provenance is a 107th state word: `s_cselect`/`s_addc`/`s_subb` are accepted when SCC came from plain data. | | take root table SGPRs from FSSM user-data records | A user-data record that names a table pointer's SGPR overrides the per-stage default. | | keep unproved uniform loops in the full-mask mode | Structured loops with wave-uniform scalars translate and keep the emitter's watchdog. VCC is accepted as an SMEM offset. | | or jump flags together in compute programs | Compute guards use `\|` and `j = j \| (c)`. The resolve kernels' unoptimised DXIL has a third fewer blocks, and DXC optimises them in 45 s instead of 83–110 s. | | refuse translations beyond DXC's memory budget | HLSL above 8 MiB is refused. Two 10 MB programs had taken 11 GB of DXC memory each. | | read heap buffer strides from the runtime's table | With root SRV `t1, space32766` in the root, heap-loaded buffer descriptors get word 1 (the stride) from the runtime, so heap-indexed IDXEN accesses translate. | ### Runtime (`d3d12`, `dxbc`) - **Compute programs bound to the root the title pairs them with:** - Roots with more than two tables, or with root descriptors and constants after the tables, are accepted when the user data confirms every binding. - A pipeline root replaces an embedded RTS0. - Literal samplers that a root without flag 0x800 lacks become private statics. A root that reflection cannot describe gets a samplers-only extension, bound around each dispatch. - Paged heaps keep a per-slot buffer stride table, from view creation and descriptor copies. A program refused only for want of strides is retried with that table appended as a root SRV, and each dispatch binds it. - A rejected raster stream records its guest root and stages under the existing capture variables. - **clzero:** ProjectScarlett's hot clearing routine (RVA 0x4E8AA10) gets AVX stores in place of five `clzero` loops. On hosts without CLZERO, every call used to trap five times, about four million exceptions in half an hour. - **Hang watchdog:** ProjectScarlett's watchdog is paused while a title thread waits on a translation or a driver compile. It used to crash the title after long waits. Both title patches write nothing unless the code matches 1.0.2.1 byte for byte. `TUXBOX_KEEP_TITLE_WATCHDOG=1` keeps the watchdog. ### Launcher - The -O0 compile cap scales with the HLSL size: 90 s per MB, between 90 and 600 s. The 2.5 MB resolve kernels used to time out on every boot. - Game runs set `VKD3D_SHADER_DEBUG=err`, so DXIL conversion failures name the construct the shader compiler rejected. ### Host-profile record `host_profiles.txt` changes for the `saveexec` and `empty` programs on every profile. Their jump-flag guards are now joined with `|` (commit "or jump flags together in compute programs"). Nothing else in the record changes. ## Verified on Lanes A pull request is not merged until Lanes passes on a GPU. Run: ```sh python tuxbox.py check ``` - [x] `python tuxbox.py check` passed on this branch: every stage that ran passed, including Lanes and the fixtures on the GPU. The D3D12 regression controls and the translator GPU checks did not run, because they need `--proton`, `--prefix` and `--windows-dxc`. - [ ] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below. - The clzero and watchdog patches match ProjectScarlett 1.0.2.1 code bytes and change nothing elsewhere, so Lanes cannot exercise them. Their unit tests check the byte matching. - The translator lowerings have unit tests built from the ProjectScarlett instruction sequences. They are not yet in `check_translator_gpu.py`. - The runtime root and stride binding could be covered by a Lanes scenario, but none has been added yet. GPU, driver and backend: NVIDIA RTX 3000 Ada Generation Laptop GPU (10de:2838, host profile wave 32-32), driver 620.73.04, Proton backend with GE-Proton11-14 (vkd3d-proton v3.1-83-gcae8353ed), Linux 7.3.5. - [ ] This changes code both vendors run, and the check passed on an AMD and an NVIDIA card ([why](../CONTRIBUTING.md#amd-and-nvidia)). Otherwise, say which vendor still needs to run it: **AMD still needs to run it.** NVIDIA passed the check above and ran ProjectScarlett with this build. Paste the summary printed at the end: ```text Summary passed Build the shader compiler (0s) passed Python tests (3s) passed Shader compiler tests (0s) passed DXBC tests (0s) passed XG layout tests (1s) passed D3D12 Windows typecheck (0s) passed Build (23s) passed Lanes and fixtures on the GPU (201s) not run: pass --proton, --prefix and --windows-dxc D3D12 regression controls (0s) not run: pass --proton, --prefix and --windows-dxc Shader translator on the GPU (0s) All checks that ran passed. ``` ProjectScarlett 1.0.2.1 with this build at its start menu, from the game log: ```text TuxBox d3d12_xs: host profile: adapter=10de:2838 wave=32-32 section-import=aliased descriptor-bytes=32/32 TuxBox d3d12_xs: replaced clzero loops at RVA 0x4e8aa10 with AVX stores (host lacks CLZERO) TuxBox d3d12_xs: pausing the title's hang watchdog (RVA 0x71b6330) while shaders compile TuxBox d3d12_xs: translated a compute shader with the heap stride table TuxBox d3d12_xs: null usage interval recorded=0 display_bound=0 tracked=0 overflow=0 overflow_display_bound=0 compute=0 raster=0 interval=279 trigger=present_sample TuxBox d3d12_xs: presented 124 frames in 10s, 142055 in total ``` ## Checks CI runs the Python unit tests, the shader compiler, DXBC, and XG layout tests, and a Windows typecheck of `tuxbox-d3d12`. These ran locally on the rebased tip, as in CI: | Check | Result | | --- | --- | | `python -m unittest discover -s tests -q` | 371 tests, OK (18 skipped) | | `cargo test … tools/shader-compiler` | 334 passed; before the rebase, it also passed at every translator commit | | `cargo test -p tuxbox-dxbc --features native-bindings` | 66 passed | | `cargo test -p tuxbox-xg-layout` | 14 passed | | `cargo check --target x86_64-pc-windows-msvc -p tuxbox-d3d12` | clean, also with `--tests`, here and at every runtime commit before the rebase | No evidence JSON changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ProjectScarlett's compute programs reach code beyond a short jump with
s_getpc_b64, s_add_u32 lo, s_addc_u32 hi (0 or -1) and s_setpc_b64. With a
constant offset that lands on an instruction, and no branch into the
sequence, it becomes a branch like the existing two-instruction form. A
sequence that cannot be proven stays indirect.

A waterfall loop (v_readfirstlane, v_cmpx_eq, v_readlane and v_mov,
s_andn2_wrexec, s_cbranch_execnz) gives every lane the value held by the
lane its own VGPR names. When the loop has exactly that shape and the
scalars it leaves behind are dead, it is lowered to one group gather:
every lane publishes its value through the compute swizzle exchange and
reads the lane it names within its 64-lane block. Two more ProjectScarlett
programs translate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ProjectScarlett's compaction kernels build an inclusive wave32 prefix sum
from four row_shr adds, a v_permlanex16_b32 that carries lane 15 of the
other row, and an add under the upper-row EXEC, after a SAVEEXEC that
enables every lane. That sequence becomes one WavePrefixSum, with the
permute's register given the lower row's total as before.

Some of these reductions first select into a spare register and copy it
to the accumulator. The copy is now the same select into the accumulator,
so the reduction starts from the form the matcher knows, and the spare
register keeps its value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The packed-root analysis refused any s_cselect_b32, s_addc_u32 or
s_subb_u32 because SCC might carry bits of a root address. It now tracks
where SCC came from as a 107th state word: a consumer is admitted when the
last SCC writer on every path read plain data, and still refused when it
read part of a pointer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Root tables were assumed to arrive in consecutive user SGPRs from a fixed
start per stage. The FSSM user-data records name the parameter of each
table pointer and its SGPR, so where a record names the SGPR it decides.
A vertex program that starts with s_swappc_b64 s4, s4 (4b929a1c), for
one, still receives its tables in s8 and s9.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
In the whole-wave mode a program without a termination proof was refused
unless its loops went through the block dispatcher. When every scalar it
writes stays wave-uniform, the lanes take each branch together and leave
each loop together, watchdog included, so structured programs now
translate with the watchdog kept. A termination proof is still tried
first and drops it.

Scalar loads may also take VCC (s106/s107) as their offset in this mode,
where comparison masks are wave-uniform ballots.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A guard over pending forward jumps was `!(j1 || j2 || ...)` and each
taken branch `if (c) j = true;`. Both make a block per flag, and a guard
can name hundreds. Compute programs compile unoptimised or under a DXC
time budget, so they now use `|` and `j = j | (c)`: the raytracing
resolve kernels' unoptimised DXIL lost a third of its blocks, and DXC
finished optimising them in 45 s instead of 83-110 s. Optimised graphics
stages keep `||`, which DXC folds into smaller code.

Which labels are pending at an instruction now comes from the earliest
branch to each label rather than a scan of every branch per instruction.

The host-profile record changes for the saveexec and empty programs, on
every profile, because their guards now use `|`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DXC needs about 1.1 GB of memory per MB of generated HLSL at -O0. Two
10 MB ProjectScarlett programs took 11 GB each while the title ran and
starved it. A translation above 8 MiB of HLSL is now refused instead of
being handed to the compiler.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A buffer descriptor loaded from the resource heap and then read with
IDXEN needs its element stride, which the console keeps in bits 16..29 of
V# word 1. Translated programs never see the console V#, so these were
refused ("raw buffer IDXEN needs the console descriptor stride").

When the root carries the runtime's stride table (root SRV t1,
space32766, one u32 per guest heap slot), a heap descriptor load fills
word 1 from it, and IDXEN on that descriptor decodes the stride from
there. Without the table nothing changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The console binds by user SGPR, so a title can pair a program with a root
other than the one it was compiled for.

- Compute roots with more than two tables, or with root descriptors and
  constants after the tables. The FSSM reader accepts descriptors in later
  tables and constants in a later parameter when a root is given, and
  reflection accepts the root only when the user data confirms every
  binding. Root constants keep their parameter, and a reflected root
  moves that parameter to the register the program reads.
- A pipeline root replaces an embedded RTS0, as for mesh stages, and the
  binding reader ignores the embedded root.
- Literal samplers that a root without sampler-heap indexing (flag 0x800)
  lacks become private static samplers (space32765). A root that
  reflection cannot describe gets a copy with only those samplers added,
  bound around each dispatch.
- The heap stride table for the translator: each paged heap keeps the
  console buffer stride of every guest slot, from view creation and
  descriptor copies, in a mapped upload buffer. A program refused only for
  want of strides is translated again with that table as an appended root
  SRV (t1, space32766), which each dispatch binds.
- A raster stream the host rejects records its guest root and stages under
  TUXBOX_CAPTURE_RASTER_ROOTS or TUXBOX_CAPTURE_SHADER_INPUTS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ProjectScarlett 1.0.2.1 calls one clearing routine (RVA 0x4E8AA10) a few
hundred times a second. Its fast path is five clzero loops, so on a host
without CLZERO every call raised five exceptions for the trap fallback:
about four million in half an hour on an Intel host, each logged by Wine.

When the routine's bytes match exactly and the host has AVX2, the fast
path is replaced, before title code runs, by AVX stores over the same
range that end in the routine's own tail. The overflow slow path keeps
its clzero loops and the trap fallback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ProjectScarlett 1.0.2.1 runs a watchdog thread that crashes the title on
purpose when its heartbeat has not moved for 30 one-second checks or a
registered thread has not checked in for 300 seconds. A title thread
waiting on a shader translation or a driver compile can take that long
under TuxBox, and the run then ended with the store to address 0 after
"presented N frames in 40s".

The watchdog skips both checks while bit 0 of its pause flag is set.
TuxBox sets that bit while any title thread waits on a translation or a
pipeline compile, and clears it five seconds after the last wait ends, so
released threads can check in. A bit the title set itself is never
cleared. Nothing is written unless the watchdog's code matches this build
byte for byte, and TUXBOX_KEEP_TITLE_WATCHDOG=1 leaves it alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The raytracing resolve kernels translate to about 2.5 MB of HLSL each,
and one needs about 77 s at -O0 while the title runs with four compiling
at once, so the fixed 90 s cap refused them on every boot. The cap is now
90 s per MB of HLSL, at least the old 90 s and at most 600 s.

DXIL conversion failures report only a result code on VKD3D_DEBUG. Game
runs now set VKD3D_SHADER_DEBUG=err as well, unless it is already set, so
the log says which construct the shader compiler rejected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:55:11 +00:00
Author
Owner

@⁠bbijsterbosch on GitHub · 2026-11-26 09:06 UTC · original

Please note performance of shader compilation is very poor. will optimize after ive resolved more unsupported shaders.

**@⁠bbijsterbosch** on GitHub · 2026-11-26 09:06 UTC · [original](https://github.com/brcly/TuxBox/pull/216#issuecomment-7187422249) Please note performance of shader compilation is very poor. will optimize after ive resolved more unsupported shaders.
Author
Owner

@⁠NickStallman on GitHub · 2026-11-26 09:26 UTC · original

AMD run of python tuxbox.py check on this PR's head (7e0ad65):

  • GPU: AMD Raphael iGPU of a Ryzen 9 9950X (1002:13c0, RADV RAPHAEL_MENDOCINO), Mesa 26.0.8, GE-Proton11-14, Linux 7.0.0.
  • Every group passed except "Lanes and fixtures on the GPU": 95 gates passed and 5 failed. The 5 are guest-present, guest-present-rgb10, guest-present-4k-owned, guest-present-4k-oversized and guest-present-4k-fit.
  • Those 5 fail the same way on main and on every other branch I've run on this machine. They come from how this host samples the screen, so they aren't caused by this change.
  • D3D12 regression controls and the shader translator on the GPU both passed.
  passed   Build the shader compiler
  passed   Python tests
  passed   Shader compiler tests
  passed   DXBC tests
  passed   XG layout tests
  passed   D3D12 Windows typecheck
  passed   Build
  FAILED   Lanes and fixtures on the GPU   (only the 5 guest-present gates above)
  passed   D3D12 regression controls
  passed   Shader translator on the GPU
**@⁠NickStallman** on GitHub · 2026-11-26 09:26 UTC · [original](https://github.com/brcly/TuxBox/pull/216#issuecomment-7187986453) AMD run of `python tuxbox.py check` on this PR's head (`7e0ad65`): - GPU: AMD Raphael iGPU of a Ryzen 9 9950X (1002:13c0, RADV RAPHAEL_MENDOCINO), Mesa 26.0.8, GE-Proton11-14, Linux 7.0.0. - Every group passed except "Lanes and fixtures on the GPU": 95 gates passed and 5 failed. The 5 are `guest-present`, `guest-present-rgb10`, `guest-present-4k-owned`, `guest-present-4k-oversized` and `guest-present-4k-fit`. - Those 5 fail the same way on `main` and on every other branch I've run on this machine. They come from how this host samples the screen, so they aren't caused by this change. - D3D12 regression controls and the shader translator on the GPU both passed. ``` passed Build the shader compiler passed Python tests passed Shader compiler tests passed DXBC tests passed XG layout tests passed D3D12 Windows typecheck passed Build FAILED Lanes and fixtures on the GPU (only the 5 guest-present gates above) passed D3D12 regression controls passed Shader translator on the GPU ```
Author
Owner

@⁠bbijsterbosch on GitHub · 2026-11-26 09:55 UTC · original · edited 2026-11-26 10:11 UTC

@⁠NickStallman you manage to get past the loading screen?
edit: read your pr nice work!

**@⁠bbijsterbosch** on GitHub · 2026-11-26 09:55 UTC · [original](https://github.com/brcly/TuxBox/pull/216#issuecomment-7188667195) · edited 2026-11-26 10:11 UTC @⁠NickStallman you manage to get past the loading screen? edit: read your pr nice work!
Author
Owner

@⁠NickStallman on GitHub · 2026-11-26 10:24 UTC · original

@⁠bbijsterbosch Thanks! Partly. I ran this PR plus #217 on main 773278a, on an RTX 5090 (595.99.02, GE-Proton11-14). ProjectScarlett gets through the front end and the story loading screens and reaches Game Running (mission 0x98c85f2a, SRL fbk_stry000_FBK_STRY000_INTRO). Then, in both runs, the GPU was lost at Prestream Metadata, before the intro starts:

  • Run 1: kernel NVRM: Xid 13 … SKEDCHECK36_DEPENDENCE_COUNTER_UNDERFLOW, then vkd3d-proton VK_ERROR_DEVICE_LOST, about 22 min in.
  • Run 2: NVRM: Xid 109 … CTX SWITCH TIMEOUT, then VK_ERROR_DEVICE_LOST, about 19 min in. VKD3D_CONFIG=breadcrumbs was set but printed no dump.
  • After the loss: the title's 30 s heartbeat watchdog fires at +0x23CF683 (#215), because the render thread spins on a label the lost device never writes.
  • Not this PR's doing: your watchdog pause and the compile paths. No title thread was in a TuxBox compile at the time.
  • On main without this PR: four runs on the same machine never lost the device. They reached the same point and died of label-wait stalls instead (#215).
  • Not proven: I haven't established that this PR causes the loss.
  • What ran just before it: the null-usage ranks show compute stand-ins being dispatched (CS=b51813bc…, 5aafeb77…), and the second loss is a hang. So the new loop and long-jump lowerings might be worth checking for a loop that never exits on the GPU.

I can rerun with any diagnostics you'd like.

**@⁠NickStallman** on GitHub · 2026-11-26 10:24 UTC · [original](https://github.com/brcly/TuxBox/pull/216#issuecomment-7189325033) @⁠bbijsterbosch Thanks! Partly. I ran this PR plus #217 on `main` 773278a, on an RTX 5090 (595.99.02, GE-Proton11-14). ProjectScarlett gets through the front end and the story loading screens and reaches `Game Running` (mission 0x98c85f2a, SRL `fbk_stry000_FBK_STRY000_INTRO`). Then, in both runs, the GPU was lost at `Prestream Metadata`, before the intro starts: - **Run 1:** kernel `NVRM: Xid 13 … SKEDCHECK36_DEPENDENCE_COUNTER_UNDERFLOW`, then vkd3d-proton `VK_ERROR_DEVICE_LOST`, about 22 min in. - **Run 2:** `NVRM: Xid 109 … CTX SWITCH TIMEOUT`, then `VK_ERROR_DEVICE_LOST`, about 19 min in. `VKD3D_CONFIG=breadcrumbs` was set but printed no dump. - **After the loss:** the title's 30 s heartbeat watchdog fires at `+0x23CF683` (#215), because the render thread spins on a label the lost device never writes. - **Not this PR's doing:** your watchdog pause and the compile paths. No title thread was in a TuxBox compile at the time. - **On `main` without this PR:** four runs on the same machine never lost the device. They reached the same point and died of label-wait stalls instead (#215). - **Not proven:** I haven't established that this PR causes the loss. - **What ran just before it:** the null-usage ranks show compute stand-ins being dispatched (`CS=b51813bc…`, `5aafeb77…`), and the second loss is a hang. So the new loop and long-jump lowerings might be worth checking for a loop that never exits on the GPU. I can rerun with any diagnostics you'd like.
github manually merged commit ed742e8c85 into main 2026-11-26 11:23:32 +00:00
Author
Owner

@⁠JeffreyBytes on GitHub · 2026-11-26 11:10 UTC · original

AMD run of ProjectScarlett 1.0.2.1 on this PR's head (7e0ad65), compared with main (773278a).

RX 6700 XT (1002:73df), Mesa RADV 26.3.1, Linux 7.3.6, GE-Proton11-14, i5-12600K. Both sides ran with the ANONONLY preload from #191 (host profile section-import=aliased), because without it this card only gets the 1 fps copy path.

Shader preparation

main this PR
checked 30,941 31,383
compiled 28,792 29,303
unsupported 2,149 2,080
time, 8 jobs 143 s (all DXIL reused) 1,560 s (27,515 reused)

Three launches in a row on this PR, from the Account Picker to the story loading screen:

main (warm) launch 1 launch 2 launch 3
time to the Account Picker under 1 min about 15 min 88 s 49 s
shaders compiled live 0 391 0 0
loading screen 12 to 19 fps 44 falling to 15 fps about 20 fps about 27 fps
compute stand-ins, distinct 605 324 666 263
… not translated 293 145 136 136
… driver compile failed 312 129 82 127
… driver compile deadline 0 50 448 0
vertex + pixel stand-ins 189 179 179 179
mesh + pixel rejected (0x80070057, 0x80004001, 0x80004005) 417 / 184 / 29 same same same

So on this card the PR halves the compute shaders that have no translation (293 to 136) and more than halves the driver compile failures. The deadline stand-ins are a one-launch effect: on launch 2, the first with nothing left to translate, 448 compute pipelines missed the driver compile deadline; on launch 3 the driver cache had them and none did.

The log has replaced clzero loops at RVA 0x4e8aa10 with AVX stores (host lacks CLZERO), pausing the title's hang watchdog (RVA 0x71b6330) while shaders compile and translated a compute shader with the heap stride table. No stand-in was bound at the picker (null usage … compute=0 raster=0), same as the NVIDIA result.

How each launch ended. Two to three minutes after leaving the picker the device was lost and the title exited with code 5. This is the page-remap device loss from #191 (radv/amdgpu: The CS has been rejected (-14) after one CopyPageMappingsBatchX batch). It happens at the same point on main, so it is not caused by this PR, but it means I can't see past the story loading screen on AMD yet.

Not run: python tuxbox.py check. On this machine its translator stage currently fails on main for an unrelated reason (#219).

**@⁠JeffreyBytes** on GitHub · 2026-11-26 11:10 UTC · [original](https://github.com/brcly/TuxBox/pull/216#issuecomment-7190361944) AMD run of ProjectScarlett 1.0.2.1 on this PR's head (`7e0ad65`), compared with `main` (`773278a`). RX 6700 XT (`1002:73df`), Mesa RADV 26.3.1, Linux 7.3.6, GE-Proton11-14, i5-12600K. Both sides ran with the `ANONONLY` preload from #191 (host profile `section-import=aliased`), because without it this card only gets the 1 fps copy path. **Shader preparation** | | `main` | this PR | | --- | --- | --- | | checked | 30,941 | 31,383 | | compiled | 28,792 | 29,303 | | unsupported | 2,149 | 2,080 | | time, 8 jobs | 143 s (all DXIL reused) | 1,560 s (27,515 reused) | **Three launches in a row on this PR**, from the Account Picker to the story loading screen: | | `main` (warm) | launch 1 | launch 2 | launch 3 | | --- | --- | --- | --- | --- | | time to the Account Picker | under 1 min | about 15 min | 88 s | 49 s | | shaders compiled live | 0 | 391 | 0 | 0 | | loading screen | 12 to 19 fps | 44 falling to 15 fps | about 20 fps | about 27 fps | | compute stand-ins, distinct | 605 | 324 | 666 | 263 | | … not translated | 293 | 145 | 136 | 136 | | … driver compile failed | 312 | 129 | 82 | 127 | | … driver compile deadline | 0 | 50 | 448 | 0 | | vertex + pixel stand-ins | 189 | 179 | 179 | 179 | | mesh + pixel rejected (`0x80070057`, `0x80004001`, `0x80004005`) | 417 / 184 / 29 | same | same | same | So on this card the PR halves the compute shaders that have no translation (293 to 136) and more than halves the driver compile failures. The deadline stand-ins are a one-launch effect: on launch 2, the first with nothing left to translate, 448 compute pipelines missed the driver compile deadline; on launch 3 the driver cache had them and none did. The log has `replaced clzero loops at RVA 0x4e8aa10 with AVX stores (host lacks CLZERO)`, `pausing the title's hang watchdog (RVA 0x71b6330) while shaders compile` and `translated a compute shader with the heap stride table`. No stand-in was bound at the picker (`null usage … compute=0 raster=0`), same as the NVIDIA result. **How each launch ended.** Two to three minutes after leaving the picker the device was lost and the title exited with code 5. This is the page-remap device loss from #191 (`radv/amdgpu: The CS has been rejected (-14)` after one `CopyPageMappingsBatchX` batch). It happens at the same point on `main`, so it is not caused by this PR, but it means I can't see past the story loading screen on AMD yet. **Not run:** `python tuxbox.py check`. On this machine its translator stage currently fails on `main` for an unrelated reason (#219).
Author
Owner

@⁠gtb-sbe on GitHub · 2026-11-26 13:25 UTC · original

One more AMD data point, this time RDNA4 and after the merge, without the preload.

Host: RX 9060 XT (1002:7590), Mesa 26.2.6 RADV, Linux 6.18, GE-Proton11-14, main at 9b31fd8. Host profile wave=32-64 section-import=substituted descriptor-bytes=32/16, so the #200 copy path.

tuxbox.py check with --backend proton --proton ... --windows-dxc ...: everything passes, including the five guest-present* gates, all 19 regression controls (buffer-remap and the new buffer-unmap-* too) and the translator checks.

ProjectScarlett 1.0.2.1, offline, cold translation cache, the same machine before and after this PR:

main cb8c38b main 9b31fd8
Pipelines not delivered (rank_pipeline_failures.py) 651 312
vkd3d result -3, all after dxil-spirv: Failed to remap ... 276 108
… sampler 32765:0 44 27
Present samples at 22 draws per frame all black lit=0.998

The sampler remaps are what #227 covers; I can run those branches here once they're up. The rest of the 108 are SRV and CBV remaps (SRV 0:126 17, 1:63 9, 0:7 8, 1:239 6, CBV 1:0 4, ...), about 56 on compute and 52 on raster.

On the compute side, every remaining rejection used the plain translation of the program (CS.used equals the source digest in the failure record). In 24 of them the root-keyed lookup is recorded as missing first, so the provider fell back to the root-less translation (.or_else(|| prepared(bytes)) in the reflected arm, prepared(bytes).or_else(...) in the last arm). Does missing there mean the translator refused the program for this root, or that its translation wasn't ready yet? If it was a refusal, recording that reason instead of trying the root-less variant would end in the same stand-in but name the real cause. I have the captured roots for these and can look into it if that's useful.

**@⁠gtb-sbe** on GitHub · 2026-11-26 13:25 UTC · [original](https://github.com/brcly/TuxBox/pull/216#issuecomment-7193329790) One more AMD data point, this time RDNA4 and after the merge, without the preload. **Host:** RX 9060 XT (`1002:7590`), Mesa 26.2.6 RADV, Linux 6.18, GE-Proton11-14, `main` at `9b31fd8`. Host profile `wave=32-64 section-import=substituted descriptor-bytes=32/16`, so the #200 copy path. **`tuxbox.py check`** with `--backend proton --proton ... --windows-dxc ...`: everything passes, including the five `guest-present*` gates, all 19 regression controls (`buffer-remap` and the new `buffer-unmap-*` too) and the translator checks. **ProjectScarlett 1.0.2.1**, offline, cold translation cache, the same machine before and after this PR: | | `main` `cb8c38b` | `main` `9b31fd8` | | --- | --- | --- | | Pipelines not delivered (`rank_pipeline_failures.py`) | 651 | 312 | | `vkd3d result -3`, all after `dxil-spirv: Failed to remap ...` | 276 | 108 | | … sampler `32765:0` | 44 | 27 | | Present samples at 22 draws per frame | all black | `lit=0.998` | The sampler remaps are what #227 covers; I can run those branches here once they're up. The rest of the 108 are SRV and CBV remaps (SRV `0:126` 17, `1:63` 9, `0:7` 8, `1:239` 6, CBV `1:0` 4, ...), about 56 on compute and 52 on raster. On the compute side, every remaining rejection used the plain translation of the program (`CS.used` equals the source digest in the failure record). In 24 of them the root-keyed lookup is recorded as `missing` first, so the provider fell back to the root-less translation (`.or_else(|| prepared(bytes))` in the reflected arm, `prepared(bytes).or_else(...)` in the last arm). Does `missing` there mean the translator refused the program for this root, or that its translation wasn't ready yet? If it was a refusal, recording that reason instead of trying the root-less variant would end in the same stand-in but name the real cause. I have the captured roots for these and can look into it if that's useful.
This discussion has been locked. Commenting is limited to contributors.
No description provided.