shader cache: schedule independent live translations concurrently #54

Merged
Valdi320 merged 1 commit from upstream-pr/54 into main 2026-11-24 19:49:31 +00:00
Valdi320 commented 2026-11-24 13:11:06 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Valdi320 on 2026-11-24T13:11:06Z.


Change

Schedule independent on-demand shader translations concurrently (default four, configurable 1–8), retain same-key serialization without hash-bucket collisions, and share still-published requests after a guest timeout. Publish failures before removing the source so the next generation cannot be confused with the prior failure. Bounded active jobs, ordered mixed request types, graceful drain, and no persistent refusal for transient tool errors.

Measured results

Ryzen 5 5600X / Bazzite, same xshader and DXC/DXV, synthetic compute corpus. Five repeats per configuration: 64 cold requests median 0.881 s serial, 0.300 s with four jobs, 0.229 s with eight. 170 timed batches, 6,350 responses, identical output hashes across corresponding variants; zero timeouts. Four jobs chosen to balance CPU/memory cost. Warm host-side burst median 0.074 -> 0.096 s; single cold request ~0.065 s. These are not retail game loading measurements.

Validation

  • 130 Python tests, two native Rust lock tests; focused worker controls repeated 30 times.
  • Windows D3D12 provider rebuilt; all six standalone GPU smoke suites passed.
  • Real Xbox D3D12 provider on RTX 4080 with Proton, no-op pipeline fallback disabled: 24 simultaneous pipeline creations for 16 distinct inputs at four jobs, repeated at eight jobs; all 48 succeeded, 16 translations in each run (no duplicate compilations), identical validated outputs. Reproduction tools and receipts included.
  • Separate local integration of eight earlier contributions passed 264 CPU tests, six GPU smoke suites and 113 synthetic numerical graphics controls. This does not make those changes part of this PR.

Limits

Synthetic inputs, no authorized retail shader corpus/gameplay tested. Cross-process/cross-session deduplication is not claimed; only per-game-process same-key serialization. Numerical sampler-specific validation remains outside this change. AI-assisted contribution.

<!-- greyfinch-sync:brcly/TuxBox:issue:6582547712 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/54). Originally posted by [Valdi320](https://github.com/Valdi320) on 2026-11-24T13:11:06Z. --- ## Change Schedule independent on-demand shader translations concurrently (default four, configurable 1–8), retain same-key serialization without hash-bucket collisions, and share still-published requests after a guest timeout. Publish failures before removing the source so the next generation cannot be confused with the prior failure. Bounded active jobs, ordered mixed request types, graceful drain, and no persistent refusal for transient tool errors. ## Measured results Ryzen 5 5600X / Bazzite, same xshader and DXC/DXV, synthetic compute corpus. Five repeats per configuration: 64 cold requests median 0.881 s serial, 0.300 s with four jobs, 0.229 s with eight. 170 timed batches, 6,350 responses, identical output hashes across corresponding variants; zero timeouts. Four jobs chosen to balance CPU/memory cost. Warm host-side burst median 0.074 -> 0.096 s; single cold request ~0.065 s. These are not retail game loading measurements. ## Validation - 130 Python tests, two native Rust lock tests; focused worker controls repeated 30 times. - Windows D3D12 provider rebuilt; all six standalone GPU smoke suites passed. - Real Xbox D3D12 provider on RTX 4080 with Proton, no-op pipeline fallback disabled: 24 simultaneous pipeline creations for 16 distinct inputs at four jobs, repeated at eight jobs; all 48 succeeded, 16 translations in each run (no duplicate compilations), identical validated outputs. Reproduction tools and receipts included. - Separate local integration of eight earlier contributions passed 264 CPU tests, six GPU smoke suites and 113 synthetic numerical graphics controls. This does not make those changes part of this PR. ## Limits Synthetic inputs, no authorized retail shader corpus/gameplay tested. Cross-process/cross-session deduplication is not claimed; only per-game-process same-key serialization. Numerical sampler-specific validation remains outside this change. AI-assisted contribution.
DrArroway commented 2026-11-24 18:07:23 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-24T18:07:23Z.


Independent check of #54 (ff033aa84) on CachyOS Linux (7.3.6-1-cachyos), AMD Ryzen 9 7900X + Radeon RX 6900 XT (1002:73bf, Mesa RADV 26.3.1-arch3.4, Proton Experimental 1794497090 experimental-11.0-20261112-x86_64):

1. Unit & Build Checks

  • .venv/bin/python -m unittest tests/test_runtime_shader_workers.py tests/test_runtime_shader_links.py -v: 14 tests OK (0.078 s)
  • .venv/bin/python -m unittest discover -s tests -q: 130 tests OK (0.601 s)
  • cargo check --locked --offline --target x86_64-pc-windows-msvc -p tuxbox-d3d12: OK
  • Built d3d12_xs.dll (build.py d3d12) and xshader.

2. Host Worker Latency Benchmark (tools/benchmark_scarlett_worker.py, 3 rounds × 64 synthetic shaders)

Tools: xshader + DXC 1.9.2609.5 + dxv. Zero failures and zero timeouts; all 18 phase runs (1,152 total shader outputs) matched SHA-256 identically across jobs=1, 4, 8:

--jobs Cold median (all 3 rounds) Warm median Cold peak RSS median Timeouts
1 0.753 s (0.773, 0.753, 0.750) 0.079 s 54.6 MiB 0
4 0.276 s (0.277, 0.276, 0.270) 0.077 s 99.1 MiB 0
8 0.209 s (0.207, 0.215, 0.209) 0.074 s 123.9 MiB 0

3. Rebuilt d3d12_xs.dll GPU/Proton Checks (1002:73bf)

10/10 passed via tuxbox.py verify: d3d12-exports, d3d12-features, d3d12-draw, d3d12-mesh, d3d12-tables, d3d12-queues, d3d12-queries, d3d12-indirect, d3d12-stream, lanes-xbox-replay.

(Note: tools/check_live_shader_worker.py was not run here because xvfb-run and Windows dxcompiler.dll/dxil.dll are not installed on this host.)

Synthetic/homebrew inputs only; no game data. AI-assisted.

<!-- greyfinch-sync:brcly/TuxBox:comment:7140189325 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/54#issuecomment-7140189325). Originally posted by [DrArroway](https://github.com/DrArroway) on 2026-11-24T18:07:23Z. --- Independent check of `#54` (`ff033aa84`) on CachyOS Linux (`7.3.6-1-cachyos`), AMD Ryzen 9 7900X + Radeon RX 6900 XT (`1002:73bf`, Mesa RADV `26.3.1-arch3.4`, Proton Experimental `1794497090 experimental-11.0-20261112-x86_64`): ### 1. Unit & Build Checks - `.venv/bin/python -m unittest tests/test_runtime_shader_workers.py tests/test_runtime_shader_links.py -v`: **14 tests OK** (`0.078 s`) - `.venv/bin/python -m unittest discover -s tests -q`: **130 tests OK** (`0.601 s`) - `cargo check --locked --offline --target x86_64-pc-windows-msvc -p tuxbox-d3d12`: OK - Built `d3d12_xs.dll` (`build.py d3d12`) and `xshader`. ### 2. Host Worker Latency Benchmark (`tools/benchmark_scarlett_worker.py`, 3 rounds × 64 synthetic shaders) Tools: `xshader` + DXC `1.9.2609.5` + `dxv`. Zero failures and zero timeouts; all 18 phase runs (`1,152` total shader outputs) matched SHA-256 identically across `jobs=1, 4, 8`: | `--jobs` | Cold median (all 3 rounds) | Warm median | Cold peak RSS median | Timeouts | |---|---:|---:|---:|---:| | `1` | **0.753 s** (`0.773`, `0.753`, `0.750`) | 0.079 s | 54.6 MiB | 0 | | `4` | **0.276 s** (`0.277`, `0.276`, `0.270`) | 0.077 s | 99.1 MiB | 0 | | `8` | **0.209 s** (`0.207`, `0.215`, `0.209`) | 0.074 s | 123.9 MiB | 0 | ### 3. Rebuilt `d3d12_xs.dll` GPU/Proton Checks (`1002:73bf`) `10/10` passed via `tuxbox.py verify`: `d3d12-exports`, `d3d12-features`, `d3d12-draw`, `d3d12-mesh`, `d3d12-tables`, `d3d12-queues`, `d3d12-queries`, `d3d12-indirect`, `d3d12-stream`, `lanes-xbox-replay`. *(Note: `tools/check_live_shader_worker.py` was not run here because `xvfb-run` and Windows `dxcompiler.dll`/`dxil.dll` are not installed on this host.)* Synthetic/homebrew inputs only; no game data. AI-assisted.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!54
No description provided.