Proposal: a GPU interpreter of RDNA2 compute code as the stand-in while a compute pipeline compiles #1455

Open
opened 2026-11-26 04:54:21 +00:00 by github-bot · 12 comments
Owner

@⁠brothernog on GitHub · 2026-11-24 16:20 UTC · original

Proposal, no code yet. I'm opening it as an issue so the work can be split, not as a claim.

The problem it targets

Everything in #1269 makes the compile faster. This targets the wait instead. Today, a graphics pipeline that isn't built yet gets a stand-in that draws nothing, but a compute pipeline is waited for at its first bind, because a skipped dispatch would corrupt what it computes (hle/d3d12x/pso_async.rs, module comment). Those waits are what stall the render thread at loading fades and trip the title's watchdog. Even with the heap windows (~3–5× less driver time on NVIDIA) and #1316 for the giant programs, a cold compute PSO still costs seconds to minutes, and the title creates them while it loads.

The idea

One compute shader that executes RDNA2 machine code: it fetches the program's dwords from a buffer, decodes, and runs them instruction by instruction, with the register file in memory.

  • It is compiled once (per driver and XCL build), then served from the driver's cache.
  • When the title binds a compute pipeline whose real PSO isn't ready, the dispatch runs on the interpreter: slow, but correct and immediate. The translated pipeline keeps building in the background and replaces it when done, as the stand-in is replaced today.
  • This is the usual two-tier setup of translators and JITs: a slow tier that always works now, and an optimising tier that takes over when it's ready. Console emulators use the same scheme for GPU shaders to remove compile stutter. It doesn't replace the translator. It only covers the first seconds of each program.

Why it may be cheaper than it sounds

  • Register access in the emitter goes through a few helpers: vreg / sreg / code32 / write32 in gpu/recomp/emit.rs. The per-opcode semantics (salu, valu, valu64, …) are format strings over operand strings. A generator could emit each opcode's body once, with operands as runtime fetches from the register file, so the interpreter's coverage follows the translator's instead of being a second implementation.
  • Memory access can use the heap-window form (#680), whose index is a runtime value anyway.

What I don't know (each could kill it)

  1. Its own compile time. A switch over a few hundred opcodes is a big shader. If the driver takes too long on it, the scheme fails at the start. This is the first thing to measure.
  2. Its speed. 256 VGPRs per lane in an indexed array will live in scratch memory. 10–100× slower than translated code may still be fine for a stand-in, but nobody knows the real figure.
  3. Image and buffer descriptors. The translator resolves samplers and formats at translation time (sampler_ref, constant_samplers). An interpreter needs them at run time, through bindless heap access from the T#/V# in SGPRs.
  4. Wave semantics. EXEC per lane, split wave64 on 32-lane GPUs, DPP and cross-lane ops, LDS and barriers.
  5. Operand modifiers. The emitter branches on neg/abs/omod/clamp/DPP in Rust. In an interpreter they become run-time work.

Pieces anyone can take (each stands alone and gives a number)

  • A. Feasibility spike: an interpreter for a subset (SALU, VALU f32/u32, s_load, buffer_load/store, branches, EXEC) as a local GPU test. It runs synthetic programs and compares against the translated form, as the recompiler's GPU tests already do.
  • B. Compile cost: the driver's CreateComputePipelineState time and memory for the interpreter at 50 / 200 / all opcodes, on NVIDIA and AMD.
  • C. Speed: the interpreter against translated code on a few retail compute programs (timings only).
  • D. Generator: opcode bodies emitted from emit.rs, so a new opcode in the translator lands in the interpreter too.
  • E. Integration: the compute stand-in in pso_async points at the interpreter with the program's dwords and the same root signature as the translated CS, so the swap stays invisible to the title.

If B or C comes out bad, the idea is dead, and that is a useful result too. I can take B on an RTX 3050 8 GB once a subset exists, and help with A.

AI-assisted.

**@⁠brothernog** on GitHub · 2026-11-24 16:20 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455) **Proposal, no code yet.** I'm opening it as an issue so the work can be split, not as a claim. ### The problem it targets Everything in #1269 makes the compile faster. This targets the wait instead. Today, a graphics pipeline that isn't built yet gets a stand-in that draws nothing, but a compute pipeline is **waited for at its first bind**, because a skipped dispatch would corrupt what it computes (`hle/d3d12x/pso_async.rs`, module comment). Those waits are what stall the render thread at loading fades and trip the title's watchdog. Even with the heap windows (~3–5× less driver time on NVIDIA) and #1316 for the giant programs, a cold compute PSO still costs seconds to minutes, and the title creates them while it loads. ### The idea One compute shader that executes RDNA2 machine code: it fetches the program's dwords from a buffer, decodes, and runs them instruction by instruction, with the register file in memory. - It is compiled **once** (per driver and XCL build), then served from the driver's cache. - When the title binds a compute pipeline whose real PSO isn't ready, the dispatch runs on the interpreter: slow, but **correct and immediate**. The translated pipeline keeps building in the background and replaces it when done, as the stand-in is replaced today. - This is the usual two-tier setup of translators and JITs: a slow tier that always works now, and an optimising tier that takes over when it's ready. Console emulators use the same scheme for GPU shaders to remove compile stutter. It doesn't replace the translator. It only covers the first seconds of each program. ### Why it may be cheaper than it sounds - Register access in the emitter goes through a few helpers: `vreg` / `sreg` / `code32` / `write32` in `gpu/recomp/emit.rs`. The per-opcode semantics (`salu`, `valu`, `valu64`, …) are format strings over operand strings. A generator could emit each opcode's body once, with operands as runtime fetches from the register file, so the interpreter's coverage follows the translator's instead of being a second implementation. - Memory access can use the heap-window form (#680), whose index is a runtime value anyway. ### What I don't know (each could kill it) 1. **Its own compile time.** A switch over a few hundred opcodes is a big shader. If the driver takes too long on it, the scheme fails at the start. This is the first thing to measure. 2. **Its speed.** 256 VGPRs per lane in an indexed array will live in scratch memory. 10–100× slower than translated code may still be fine for a stand-in, but nobody knows the real figure. 3. **Image and buffer descriptors.** The translator resolves samplers and formats at translation time (`sampler_ref`, `constant_samplers`). An interpreter needs them at run time, through bindless heap access from the T#/V# in SGPRs. 4. **Wave semantics.** EXEC per lane, split wave64 on 32-lane GPUs, DPP and cross-lane ops, LDS and barriers. 5. **Operand modifiers.** The emitter branches on neg/abs/omod/clamp/DPP in Rust. In an interpreter they become run-time work. ### Pieces anyone can take (each stands alone and gives a number) - **A. Feasibility spike:** an interpreter for a subset (SALU, VALU f32/u32, `s_load`, `buffer_load`/`store`, branches, EXEC) as a local GPU test. It runs synthetic programs and compares against the translated form, as the recompiler's GPU tests already do. - **B. Compile cost:** the driver's `CreateComputePipelineState` time and memory for the interpreter at 50 / 200 / all opcodes, on NVIDIA and AMD. - **C. Speed:** the interpreter against translated code on a few retail compute programs (timings only). - **D. Generator:** opcode bodies emitted from `emit.rs`, so a new opcode in the translator lands in the interpreter too. - **E. Integration:** the compute stand-in in `pso_async` points at the interpreter with the program's dwords and the same root signature as the translated CS, so the swap stays invisible to the title. If B or C comes out bad, the idea is dead, and that is a useful result too. I can take **B** on an RTX 3050 8 GB once a subset exists, and help with A. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:54:21 +00:00
Author
Owner

@⁠phalstead on GitHub · 2026-11-24 18:17 UTC · original

I've been experimenting with the GPU-interpreter approach proposed here and have completed two standalone feasibility spikes on an RTX 4080 (Windows 11, D3D12).

Workstream B — Compilation/PSO cost

  • Tested synthetic interpreter-shaped compute shaders with 50, 200, 400, and 800 opcode cases.
  • First PSO creation took approximately 0.83–1.46 ms across the variants.
  • DXC compilation took approximately 82–942 ms.
  • All 24 synthetic correctness checks passed.

Workstream A — Interpreter prototype

  • Implemented a 29-opcode RDNA2 subset using predecoded instruction records.
  • Passed 21/21 CPU-reference-versus-GPU correctness tests.
  • Captured GPU timestamp-based performance measurements.

Important limitations: This is not raw in-shader RDNA2 decoding or an XCL-integrated interpreter. MUBUF handling is simplified, wavefront semantics are incomplete, and the performance comparison is not yet instruction-equivalent.

The early results suggest synthetic PSO creation cost isn't an immediate blocker on this NVIDIA configuration. The remaining questions are semantic coverage and interpreter execution performance.

I have the source, build instructions, and raw results available for reproduction. Would a standalone test harness be useful to the project before attempting tighter integration with XCL's decoder and GPU tests?

**@⁠phalstead** on GitHub · 2026-11-24 18:17 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7140433976) I've been experimenting with the GPU-interpreter approach proposed here and have completed two standalone feasibility spikes on an RTX 4080 (Windows 11, D3D12). **Workstream B — Compilation/PSO cost** - Tested synthetic interpreter-shaped compute shaders with 50, 200, 400, and 800 opcode cases. - First PSO creation took approximately 0.83–1.46 ms across the variants. - DXC compilation took approximately 82–942 ms. - All 24 synthetic correctness checks passed. **Workstream A — Interpreter prototype** - Implemented a 29-opcode RDNA2 subset using predecoded instruction records. - Passed 21/21 CPU-reference-versus-GPU correctness tests. - Captured GPU timestamp-based performance measurements. **Important limitations:** This is not raw in-shader RDNA2 decoding or an XCL-integrated interpreter. MUBUF handling is simplified, wavefront semantics are incomplete, and the performance comparison is not yet instruction-equivalent. The early results suggest synthetic PSO creation cost isn't an immediate blocker on this NVIDIA configuration. The remaining questions are semantic coverage and interpreter execution performance. I have the source, build instructions, and raw results available for reproduction. Would a standalone test harness be useful to the project before attempting tighter integration with XCL's decoder and GPU tests?
Author
Owner

@⁠brothernog on GitHub · 2026-11-24 18:27 UTC · original

@⁠phalstead thanks, this is exactly the kind of number the issue was waiting for. Yes, please publish the standalone harness (a branch or repo link here is enough). A spike that anyone can rerun on their own GPU is worth more right now than an early integration.

Two things would make B conclusive before we lean on it:

  1. Cold or cached driver compile? 0.8–1.5 ms for an 800-case switch is far below what the driver spends on translated programs here (seconds to minutes on NVIDIA). Was the driver's shader cache cold for each variant? Changing a constant in the DXIL per run, or clearing the NVIDIA disk cache, would rule out a cache hit. Also: do the case bodies look like the translator's (operands fetched from an in-memory register file, written back, EXEC applied), or are they small synthetic bodies? The driver cost should scale with the body size.
  2. One instruction-equivalent comparison for A. The same small program run through the interpreter and through XCL's translated form, dispatched the way the recompiler's GPU tests do it (gpu/recomp/runner.rs), would give the first real slowdown factor.

Once the harness is up, I'll run B on an RTX 3050 8 GB (driver 610.88) for a second NVIDIA data point, with the shader cache cold.

This comment was AI-assisted.

**@⁠brothernog** on GitHub · 2026-11-24 18:27 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7140665478) @⁠phalstead thanks, this is exactly the kind of number the issue was waiting for. Yes, please publish the standalone harness (a branch or repo link here is enough). A spike that anyone can rerun on their own GPU is worth more right now than an early integration. Two things would make B conclusive before we lean on it: 1. **Cold or cached driver compile?** 0.8–1.5 ms for an 800-case switch is far below what the driver spends on translated programs here (seconds to minutes on NVIDIA). Was the driver's shader cache cold for each variant? Changing a constant in the DXIL per run, or clearing the NVIDIA disk cache, would rule out a cache hit. Also: do the case bodies look like the translator's (operands fetched from an in-memory register file, written back, EXEC applied), or are they small synthetic bodies? The driver cost should scale with the body size. 2. **One instruction-equivalent comparison for A.** The same small program run through the interpreter and through XCL's translated form, dispatched the way the recompiler's GPU tests do it (`gpu/recomp/runner.rs`), would give the first real slowdown factor. Once the harness is up, I'll run B on an RTX 3050 8 GB (driver 610.88) for a second NVIDIA data point, with the shader cache cold. This comment was AI-assisted.
Author
Owner

@⁠phalstead on GitHub · 2026-11-24 19:03 UTC · original

Thanks, this is really helpful feedback.

Agreed on both points. The original B benchmark used synthetic switch bodies, and I didn't establish that the driver cache was cold. So the 0.8–1.5 ms PSO numbers shouldn't be treated as representative of XCL's translated shader compilation costs yet.

I'm packaging the standalone harness with build instructions and raw results so it can be reproduced on another GPU. I'll also add distinct-DXIL/cache-controlled tests and more translator-shaped instruction bodies.

For A, I'll work toward one instruction-equivalent comparison using XCL's existing GPU recompiler test infrastructure in gpu/recomp/runner.rs, rather than relying solely on hand-written native HLSL.

I'll share the repository link once the package passes its clean-build and publication checks. Appreciate the offer to test it on the RTX 3050!

Workstream C update — synthetic interpreter performance

I completed a standalone RTX 4080 performance study comparing the RDNA2-subset interpreter against native HLSL across 45 synthetic workloads (450 benchmark runs).

  • All 450 benchmark rows passed the CPU-reference correctness checks for the interpreter.
  • At 32 instructions, interpreter slowdown ranged from approximately 87× to 196×.
  • At 512 instructions, slowdown ranged from approximately 184× to 4,019×.
  • GPU timestamps were collected separately from CPU submission and wall time.
  • Floating-point native comparisons required a documented tolerance of up to 7 ULPs.

These are prototype microbenchmark results, not measurements of real XCL compute workloads. The native HLSL comparison is not RDNA2-ISA-equivalent, and the interpreter still uses one GPU thread to simulate a 64-lane wave.

The results suggest that execution architecture is a significant performance concern. I haven't yet validated a cooperative multi-thread wave implementation or measured representative XCL workloads.

My proposed next step is a small, correctness-verified cooperative-wave prototype to determine whether distributing simulated lanes across GPU threads materially improves execution time before expanding opcode coverage or attempting integration.

**@⁠phalstead** on GitHub · 2026-11-24 19:03 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7141522666) Thanks, this is really helpful feedback. Agreed on both points. The original B benchmark used synthetic switch bodies, and I didn't establish that the driver cache was cold. So the 0.8–1.5 ms PSO numbers shouldn't be treated as representative of XCL's translated shader compilation costs yet. I'm packaging the standalone harness with build instructions and raw results so it can be reproduced on another GPU. I'll also add distinct-DXIL/cache-controlled tests and more translator-shaped instruction bodies. For A, I'll work toward one instruction-equivalent comparison using XCL's existing GPU recompiler test infrastructure in `gpu/recomp/runner.rs`, rather than relying solely on hand-written native HLSL. I'll share the repository link once the package passes its clean-build and publication checks. Appreciate the offer to test it on the RTX 3050! **Workstream C update — synthetic interpreter performance** I completed a standalone RTX 4080 performance study comparing the RDNA2-subset interpreter against native HLSL across 45 synthetic workloads (450 benchmark runs). - All 450 benchmark rows passed the CPU-reference correctness checks for the interpreter. - At 32 instructions, interpreter slowdown ranged from approximately 87× to 196×. - At 512 instructions, slowdown ranged from approximately 184× to 4,019×. - GPU timestamps were collected separately from CPU submission and wall time. - Floating-point native comparisons required a documented tolerance of up to 7 ULPs. These are prototype microbenchmark results, not measurements of real XCL compute workloads. The native HLSL comparison is not RDNA2-ISA-equivalent, and the interpreter still uses one GPU thread to simulate a 64-lane wave. The results suggest that execution architecture is a significant performance concern. I haven't yet validated a cooperative multi-thread wave implementation or measured representative XCL workloads. My proposed next step is a small, correctness-verified cooperative-wave prototype to determine whether distributing simulated lanes across GPU threads materially improves execution time before expanding opcode coverage or attempting integration.
Author
Owner

@⁠brothernog on GitHub · 2026-11-24 19:33 UTC · original

@⁠phalstead the C numbers are useful even as microbenchmarks, and I agree with your next step. One thought on the cooperative-wave prototype, in case it helps the design:

  • One GPU thread per simulated lane. All lanes of a wave run the same instruction stream, so fetch, decode and the opcode switch are wave-uniform: the dispatch branch doesn't diverge, and only the operation itself is per lane. VGPR v[n] of lane k lives in thread k; SGPRs, the PC and SCC/VCC are wave-uniform (one copy in groupshared, or kept uniform with WaveReadLaneFirst); EXEC becomes each thread's "active" bit. That is the same mapping XCL's translated code uses (one console lane per PC thread), which should also make the instruction-equivalent comparison more direct.
  • Wave64 on 32-lane GPUs: a 64-thread group with the cross-lane ops (DPP, ds_swizzle, v_readlane, ballots) going through groupshared, as the translator's split wave64 mode does (split_wave64 in gpu/recomp).
  • The VGPR file: 256 VGPRs per lane won't fit in registers either way; per-thread indexed arrays will spill to scratch. Allocating only the program's highest used VGPR (known from the code before the dispatch) may keep small programs out of scratch.

If most of the 87–4 019× comes from the 64 lanes running in series, this mapping should remove that factor, and what remains is the real interpreter overhead (decode and operand fetch). Rerunning the same 32 / 512-instruction workloads with it would show how much of the gap that is.

This comment was AI-assisted.

**@⁠brothernog** on GitHub · 2026-11-24 19:33 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7142258973) @⁠phalstead the C numbers are useful even as microbenchmarks, and I agree with your next step. One thought on the cooperative-wave prototype, in case it helps the design: - **One GPU thread per simulated lane.** All lanes of a wave run the same instruction stream, so fetch, decode and the opcode `switch` are wave-uniform: the dispatch branch doesn't diverge, and only the operation itself is per lane. VGPR `v[n]` of lane k lives in thread k; SGPRs, the PC and SCC/VCC are wave-uniform (one copy in groupshared, or kept uniform with `WaveReadLaneFirst`); EXEC becomes each thread's "active" bit. That is the same mapping XCL's translated code uses (one console lane per PC thread), which should also make the instruction-equivalent comparison more direct. - **Wave64 on 32-lane GPUs:** a 64-thread group with the cross-lane ops (DPP, `ds_swizzle`, `v_readlane`, ballots) going through groupshared, as the translator's split wave64 mode does (`split_wave64` in `gpu/recomp`). - **The VGPR file:** 256 VGPRs per lane won't fit in registers either way; per-thread indexed arrays will spill to scratch. Allocating only the program's highest used VGPR (known from the code before the dispatch) may keep small programs out of scratch. If most of the 87–4 019× comes from the 64 lanes running in series, this mapping should remove that factor, and what remains is the real interpreter overhead (decode and operand fetch). Rerunning the same 32 / 512-instruction workloads with it would show how much of the gap that is. This comment was AI-assisted.
Author
Owner

@⁠phalstead on GitHub · 2026-11-24 20:18 UTC · original

Thanks, that's a really useful architectural direction, especially the wave64 mapping and VGPR allocation suggestions.

I'm going to use the one-thread-per-lane model for the cooperative-wave experiment, with explicit synchronization across the two native wave32 halves and correctness checks against the existing CPU reference.

I'm also preparing the standalone A/B/C harness for a public GitHub repository so you can reproduce the existing results on your RTX 3050. The initial release will clearly distinguish synthetic benchmarks from actual XCL-translated shader measurements, and note that the NVIDIA cold-cache behavior is not yet proven.

I'll share the repository link once the clean-build and publication checks are complete. Thanks again for the detailed feedback!

**@⁠phalstead** on GitHub · 2026-11-24 20:18 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7143337957) Thanks, that's a really useful architectural direction, especially the wave64 mapping and VGPR allocation suggestions. I'm going to use the one-thread-per-lane model for the cooperative-wave experiment, with explicit synchronization across the two native wave32 halves and correctness checks against the existing CPU reference. I'm also preparing the standalone A/B/C harness for a public GitHub repository so you can reproduce the existing results on your RTX 3050. The initial release will clearly distinguish synthetic benchmarks from actual XCL-translated shader measurements, and note that the NVIDIA cold-cache behavior is not yet proven. I'll share the repository link once the clean-build and publication checks are complete. Thanks again for the detailed feedback!
Author
Owner

@⁠phalstead on GitHub · 2026-11-24 20:33 UTC · original

Thanks @⁠brothernog! The standalone harness is now published:

https://github.com/phalstead/xcl-rdna2-gpu-interpreter-bench

Commit: ee724e3d141ada87f3d67de672ecdacf7e98cbf7

It includes the RDNA2-subset GPU interpreter, benchmark sources, Windows/D3D12 build instructions, and captured results.

To reproduce:

build.cmd
out\wa.exe --list-adapters
out\wa.exe --mode cold-b --out results_cold_b --runs 3
out\wa.exe --mode translator --out results_translator --runs 3
out\wa.exe --mode xcl-compare --out results_xcl --runs 5

A few important caveats:

  • The distinct-DXIL measurements do not establish a genuinely cold NVIDIA driver shader cache.
  • The translator-shaped synthetic benchmark currently produces nearly constant-size DXIL (~2,068 bytes), so those results shouldn't be interpreted as actual XCL translation costs.
  • The standalone interpreter passes its CPU-reference checks, but the XCL-translated side of the instruction-equivalent comparison hasn't been executed yet.

I'd welcome your RTX 3050 results or any reproduction issues you encounter.

I'm also proceeding with the cooperative-wave prototype using your one-thread-per-lane design suggestions, including wave64 synchronization and program-specific VGPR allocation.

Thanks again for the guidance!

**@⁠phalstead** on GitHub · 2026-11-24 20:33 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7143724123) Thanks @⁠brothernog! The standalone harness is now published: **https://github.com/phalstead/xcl-rdna2-gpu-interpreter-bench** Commit: `ee724e3d141ada87f3d67de672ecdacf7e98cbf7` It includes the RDNA2-subset GPU interpreter, benchmark sources, Windows/D3D12 build instructions, and captured results. To reproduce: ```bat build.cmd out\wa.exe --list-adapters out\wa.exe --mode cold-b --out results_cold_b --runs 3 out\wa.exe --mode translator --out results_translator --runs 3 out\wa.exe --mode xcl-compare --out results_xcl --runs 5 ``` A few important caveats: - The distinct-DXIL measurements do not establish a genuinely cold NVIDIA driver shader cache. - The translator-shaped synthetic benchmark currently produces nearly constant-size DXIL (~2,068 bytes), so those results shouldn't be interpreted as actual XCL translation costs. - The standalone interpreter passes its CPU-reference checks, but the XCL-translated side of the instruction-equivalent comparison hasn't been executed yet. I'd welcome your RTX 3050 results or any reproduction issues you encounter. I'm also proceeding with the cooperative-wave prototype using your one-thread-per-lane design suggestions, including wave64 synchronization and program-specific VGPR allocation. Thanks again for the guidance!
Author
Owner

@⁠CowboyBingus on GitHub · 2026-11-24 20:44 UTC · original

I'm taking the implementation of this, as two stacked PRs:

  1. Stand-in tier (hle/d3d12x/pso_async.rs, bind.rs): when a compute bind would wait on its pipeline build past a small budget, it binds a stand-in pipeline with the same root signature and keeps building the translated one in the background; later binds use the translated pipeline once it's built. With no stand-in available, binds wait as they do today. It ships with no provider, so it changes nothing on its own.
  2. RDNA2 compute interpreter (new gpu/interp/) as the first provider: one program built once, running the console code from a table through XCL's rdna2::decode and the translated pipeline's root signature, with per-instruction GPU tests against the translated path. Stacked on 1.

Why compute needs an exact stand-in rather than a skip, from our runs (RTX 5070 Ti, driver 621.24):

  • On main (in some runs plus #1321), the title stops presenting at 88–109 s with the title's ring workers in pso_async::resolve_for_bind, waiting on or compiling compute pipelines (translated_compute_pso -> finish_pso).
  • In one run, 13 compute pipeline builds took 6.3–52.4 s each (196 KB–1.09 MB DXIL).
  • In our runs with compute dispatches skipped while their pipeline built (#533, #891's bound: skip-1, fresh-1, frontier-1), the GPU stalled or the device hung (0x887a0006); in the two runs that waited instead (noskip-1/-2), it didn't.

phalstead's bench is a standalone harness (own decoder, 29 ops, one thread per wave); the XCL version needs the title's real opcode set, LDS, wave ops and the translated root signature. Its numbers are a useful reference, and anything I use from it will be credited.

I'll post the opcode coverage of the slow programs and the interpreter's build and dispatch times when I have them.

AI use: Claude Code (Claude Opus 5.5) wrote this.

**@⁠CowboyBingus** on GitHub · 2026-11-24 20:44 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7143988108) I'm taking the implementation of this, as two stacked PRs: 1. **Stand-in tier** (`hle/d3d12x/pso_async.rs`, `bind.rs`): when a compute bind would wait on its pipeline build past a small budget, it binds a stand-in pipeline with the same root signature and keeps building the translated one in the background; later binds use the translated pipeline once it's built. With no stand-in available, binds wait as they do today. It ships with no provider, so it changes nothing on its own. 2. **RDNA2 compute interpreter** (new `gpu/interp/`) as the first provider: one program built once, running the console code from a table through XCL's `rdna2::decode` and the translated pipeline's root signature, with per-instruction GPU tests against the translated path. Stacked on 1. Why compute needs an exact stand-in rather than a skip, from our runs (RTX 5070 Ti, driver 621.24): - On main (in some runs plus #1321), the title stops presenting at 88–109 s with the title's ring workers in `pso_async::resolve_for_bind`, waiting on or compiling compute pipelines (`translated_compute_pso -> finish_pso`). - In one run, 13 compute pipeline builds took 6.3–52.4 s each (196 KB–1.09 MB DXIL). - In our runs with compute dispatches skipped while their pipeline built (#533, #891's bound: skip-1, fresh-1, frontier-1), the GPU stalled or the device hung (`0x887a0006`); in the two runs that waited instead (noskip-1/-2), it didn't. phalstead's [bench](https://github.com/phalstead/xcl-rdna2-gpu-interpreter-bench) is a standalone harness (own decoder, 29 ops, one thread per wave); the XCL version needs the title's real opcode set, LDS, wave ops and the translated root signature. Its numbers are a useful reference, and anything I use from it will be credited. I'll post the opcode coverage of the slow programs and the interpreter's build and dispatch times when I have them. AI use: Claude Code (Claude Opus 5.5) wrote this.
Author
Owner

@⁠phalstead on GitHub · 2026-11-24 20:49 UTC · original

Thanks @⁠CowboyBingus! Glad the standalone benchmarks are useful.

I'm happy to help with independent RTX 4080 validation as the stacked PRs develop, particularly interpreter-vs-translated correctness, dispatch timing, and NVIDIA wave32/split-wave64 behavior.

I also have the standalone harness published here for reference:
https://github.com/phalstead/xcl-rdna2-gpu-interpreter-bench

I'll avoid duplicating your implementation work. Once you have opcode coverage or a testable branch, I can focus on whichever validation gaps would be most useful.Thanks @⁠CowboyBingus! Glad the standalone benchmarks are useful.

I'm happy to help with independent RTX 4080 validation as the stacked PRs develop, particularly interpreter-vs-translated correctness, dispatch timing, and NVIDIA wave32/split-wave64 behavior.

I also have the standalone harness published here for reference:
https://github.com/phalstead/xcl-rdna2-gpu-interpreter-bench

I'll avoid duplicating your implementation work. Once you have opcode coverage or a testable branch, I can focus on whichever validation gaps would be most useful.

**@⁠phalstead** on GitHub · 2026-11-24 20:49 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7144106557) Thanks @⁠CowboyBingus! Glad the standalone benchmarks are useful. I'm happy to help with independent RTX 4080 validation as the stacked PRs develop, particularly interpreter-vs-translated correctness, dispatch timing, and NVIDIA wave32/split-wave64 behavior. I also have the standalone harness published here for reference: https://github.com/phalstead/xcl-rdna2-gpu-interpreter-bench I'll avoid duplicating your implementation work. Once you have opcode coverage or a testable branch, I can focus on whichever validation gaps would be most useful.Thanks @⁠CowboyBingus! Glad the standalone benchmarks are useful. I'm happy to help with independent RTX 4080 validation as the stacked PRs develop, particularly interpreter-vs-translated correctness, dispatch timing, and NVIDIA wave32/split-wave64 behavior. I also have the standalone harness published here for reference: https://github.com/phalstead/xcl-rdna2-gpu-interpreter-bench I'll avoid duplicating your implementation work. Once you have opcode coverage or a testable branch, I can focus on whichever validation gaps would be most useful.
Author
Owner

@⁠phalstead on GitHub · 2026-11-24 21:07 UTC · original

Follow-up on the instruction-equivalent comparison requested by @⁠brothernog.

I ran the gpu_scalar_loop_and_scc loop-prefix program through XCL's translated GPU path and our standalone predecoded RDNA2 interpreter on an RTX 4080 (NVIDIA 621.24, DXC 1.8.2502.11).

Correctness:

  • XCL recomp GPU test: PASS
  • Standalone interpreter: 30/30 PASS
  • Both produced s0 = 55 and v1 = 55 across all 64 lanes.
  • The compared program contains seven RDNA2 instructions, including scalar arithmetic and SCC-controlled branching.

Preliminary GPU timings:

  • XCL translated dispatch median: 1.024 µs
  • Standalone interpreter median: 61.44 µs
  • Observed ratio: approximately 60× slower for the interpreter.

XCL source was pinned to 4178e888; standalone harness baseline was ee724e3.

Caveat: This is a bounded, instruction-equivalent microtest, not a retail shader benchmark. The XCL dispatch timing is near the timestamp resolution, and the two harnesses have different measurement setups. The exact slowdown ratio should be treated as preliminary pending aggregated-dispatch validation.

The standalone harness is available here:
https://github.com/phalstead/xcl-rdna2-gpu-interpreter-bench

Happy to provide additional RTX 4080 correctness and timing validation as the stand-in interpreter PRs develop.

**@⁠phalstead** on GitHub · 2026-11-24 21:07 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7144505963) Follow-up on the instruction-equivalent comparison requested by @⁠brothernog. I ran the `gpu_scalar_loop_and_scc` loop-prefix program through XCL's translated GPU path and our standalone predecoded RDNA2 interpreter on an RTX 4080 (NVIDIA 621.24, DXC 1.8.2502.11). **Correctness:** - XCL recomp GPU test: PASS - Standalone interpreter: 30/30 PASS - Both produced `s0 = 55` and `v1 = 55` across all 64 lanes. - The compared program contains seven RDNA2 instructions, including scalar arithmetic and SCC-controlled branching. **Preliminary GPU timings:** - XCL translated dispatch median: 1.024 µs - Standalone interpreter median: 61.44 µs - Observed ratio: approximately 60× slower for the interpreter. XCL source was pinned to `4178e888`; standalone harness baseline was `ee724e3`. **Caveat:** This is a bounded, instruction-equivalent microtest, not a retail shader benchmark. The XCL dispatch timing is near the timestamp resolution, and the two harnesses have different measurement setups. The exact slowdown ratio should be treated as preliminary pending aggregated-dispatch validation. The standalone harness is available here: https://github.com/phalstead/xcl-rdna2-gpu-interpreter-bench Happy to provide additional RTX 4080 correctness and timing validation as the stand-in interpreter PRs develop.
Author
Owner

@⁠brothernog on GitHub · 2026-11-24 21:12 UTC · original · edited 2026-11-24 22:53 UTC

@⁠phalstead thanks for publishing it. Here is cold-b from ee724e3 on the RTX 3050 8 GB (desktop, Ryzen 7 5800XT) (NVIDIA 610.88, Windows 11 build 26300, MSVC from build.cmd, DXC 1.9.2602.17 from the Windows SDK 10.0.26100 bin\x64), --runs 3, 36 rows, 0 incorrect.

On this machine, run 0 is a cold driver compile. This harness had never run here before, and the DXIL hashes differ from the ones in your results/ for every variant, so the NVIDIA disk cache can't have held them. That covers the caveat in your first point, at least for run 0.

Variant (switch cases) DXIL DXC First PSO (cold) Repeat PSO, same process
n50 (v0 / v1 / v2) 3.6 KB 11.0–15.2 ms 24.3 / 16.6 / 14.6 ms 0.53–0.70 ms
n200 7.5 KB 30.8–32.7 ms 46.8 / 46.1 / 45.4 ms 0.60–0.78 ms
n400 13.8 KB 65.3–65.6 ms 90.7 / 85.7 / 86.5 ms 0.80–0.92 ms
n800 26.1 KB 161–169 ms 175.2 / 183.7 / 177.9 ms 1.09–1.41 ms
  • The cold PSO cost grows roughly linearly with the switch size, about 0.2 ms per case above n50. From n200 up, the three distinct variants of each size agree within about 6 %. At n50 they spread more (14.6–24.3 ms), and v0 is also the first PSO of the process.
  • This machine is faster than your 4080 numbers on n400 and n800 (n800: 175–184 ms against 279–379 ms). The driver compile runs on the CPU, so CPU and DXC version differences probably account for that more than the GPU does.
  • For scale, real translated programs on this card take seconds to minutes. ActivateRays (95cc13288a27a96e) is 2.5 MB of DXIL and took 312 s cold in the driver (#1692). An interpreter built once, at this size, costs well under a second of driver time, which is the property @⁠CowboyBingus's stand-in tier relies on.

Not run here: translator and xcl-compare.

This comment was AI-assisted.

**@⁠brothernog** on GitHub · 2026-11-24 21:12 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7144612669) · edited 2026-11-24 22:53 UTC @⁠phalstead thanks for publishing it. Here is `cold-b` from `ee724e3` on the RTX 3050 8 GB (desktop, Ryzen 7 5800XT) (NVIDIA 610.88, Windows 11 build 26300, MSVC from `build.cmd`, DXC 1.9.2602.17 from the Windows SDK 10.0.26100 `bin\x64`), `--runs 3`, 36 rows, 0 incorrect. On this machine, run 0 is a cold driver compile. This harness had never run here before, and the DXIL hashes differ from the ones in your `results/` for every variant, so the NVIDIA disk cache can't have held them. That covers the caveat in your first point, at least for run 0. | Variant (switch cases) | DXIL | DXC | First PSO (cold) | Repeat PSO, same process | |---|---|---|---|---| | n50 (v0 / v1 / v2) | 3.6 KB | 11.0–15.2 ms | 24.3 / 16.6 / 14.6 ms | 0.53–0.70 ms | | n200 | 7.5 KB | 30.8–32.7 ms | 46.8 / 46.1 / 45.4 ms | 0.60–0.78 ms | | n400 | 13.8 KB | 65.3–65.6 ms | 90.7 / 85.7 / 86.5 ms | 0.80–0.92 ms | | n800 | 26.1 KB | 161–169 ms | 175.2 / 183.7 / 177.9 ms | 1.09–1.41 ms | - The cold PSO cost grows roughly linearly with the switch size, about 0.2 ms per case above n50. From n200 up, the three distinct variants of each size agree within about 6 %. At n50 they spread more (14.6–24.3 ms), and v0 is also the first PSO of the process. - This machine is faster than your 4080 numbers on n400 and n800 (n800: 175–184 ms against 279–379 ms). The driver compile runs on the CPU, so CPU and DXC version differences probably account for that more than the GPU does. - For scale, real translated programs on this card take seconds to minutes. ActivateRays (`95cc13288a27a96e`) is 2.5 MB of DXIL and took 312 s cold in the driver ([#1692](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1692)). An interpreter built once, at this size, costs well under a second of driver time, which is the property @⁠CowboyBingus's stand-in tier relies on. Not run here: `translator` and `xcl-compare`. This comment was AI-assisted.
Author
Owner

@⁠phalstead on GitHub · 2026-11-25 01:35 UTC · original

Independent RTX 4080 benchmark follow-up for #1455 (AI-assisted investigation, human-directed).

I repeated the earlier scalar-loop microbenchmark using aggregated GPU timestamp measurements to reduce single-dispatch timestamp quantization effects.

Both the XCL translated path and standalone interpreter produced the expected results: s0 == 55 and v1[lane] == 55 across all 64 lanes.

Results — batch of 1,000 dispatches, 30 trials:

Execution path Median per dispatch
XCL translated shader 1.155 µs
Standalone interpreter 55.611 µs

Measured standalone/XCL ratio: approximately 48.1× (46.7× at batch 10,000). The earlier approximately 60× single-dispatch estimate was affected by timestamp quantization.

Environment: RTX 4080, NVIDIA 621.24, Windows 11 build 26200, DXC 1.8.2502.11.

Pinned baselines:

  • XCL: 4178e888c0b5be50a2887eda45cdb832763b68a4
  • Standalone harness: ee724e3d141ada87f3d67de672ecdacf7e98cbf7

The reproduction package includes instrumentation patches, raw results, logs, exact reproduction instructions, and measurement limitations:

github.com/phalstead/xcl-1455-bench-repro-package@0ba52685a8

The XCL instrumentation patch also passed a fresh same-machine clone reproduction.

This is a synthetic seven-instruction scalar-loop microbenchmark, not a general shader-performance or production-viability claim. Measurements include inter-dispatch barriers and command-list overhead, exclude compilation/PSO creation, and compare different execution architectures rather than identical internal execution boundaries.

This is independent benchmark evidence only, not a competing production interpreter implementation.

**@⁠phalstead** on GitHub · 2026-11-25 01:35 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7149729036) Independent RTX 4080 benchmark follow-up for #1455 (AI-assisted investigation, human-directed). I repeated the earlier scalar-loop microbenchmark using aggregated GPU timestamp measurements to reduce single-dispatch timestamp quantization effects. Both the XCL translated path and standalone interpreter produced the expected results: `s0 == 55` and `v1[lane] == 55` across all 64 lanes. **Results — batch of 1,000 dispatches, 30 trials:** | Execution path | Median per dispatch | |---|---:| | XCL translated shader | 1.155 µs | | Standalone interpreter | 55.611 µs | Measured standalone/XCL ratio: approximately **48.1×** (46.7× at batch 10,000). The earlier approximately 60× single-dispatch estimate was affected by timestamp quantization. Environment: RTX 4080, NVIDIA 621.24, Windows 11 build 26200, DXC 1.8.2502.11. Pinned baselines: - XCL: `4178e888c0b5be50a2887eda45cdb832763b68a4` - Standalone harness: `ee724e3d141ada87f3d67de672ecdacf7e98cbf7` The reproduction package includes instrumentation patches, raw results, logs, exact reproduction instructions, and measurement limitations: https://github.com/phalstead/xcl-1455-bench-repro-package/commit/0ba52685a8ed969263905b457820bd863c7215a6 The XCL instrumentation patch also passed a fresh same-machine clone reproduction. This is a synthetic seven-instruction scalar-loop microbenchmark, not a general shader-performance or production-viability claim. Measurements include inter-dispatch barriers and command-list overhead, exclude compilation/PSO creation, and compare different execution architectures rather than identical internal execution boundaries. This is independent benchmark evidence only, not a competing production interpreter implementation.
Author
Owner

@⁠brothernog on GitHub · 2026-11-25 02:07 UTC · original

A static census of the retail pack's compute programs, to size the interpreter against the issue's unknowns. It's local and offline, numbers only: main c2dcef3 plus a small local xcl shaders --census that decodes every program and counts what each one uses. It reproduces the existing totals (26 698 programs; image_gather4_l in 16 shaders, 58 occurrences).

Population. 2 689 programs have a compute interface. I banded them by console instruction count, as in #1096, because only the big programs compile slowly enough to need a stand-in.

Band (instructions) Programs Share of compute instructions Distinct mnemonics, programs fully covered at 90 % / 95 % / 100 % Base opcodes (SDWA/DPP folded)
< 500 897 0.9 % 272 / 300 / 358 313
500–2k 370 2.7 % 325 / 343 / 358 317
2k–5k 554 10.5 % 294 / 311 / 354 311
≥ 5k 868 85.9 % 273 / 298 / 348 308
all compute 2 689 100 % 320 / 348 / 421 365

Coverage is greedy: mnemonics are taken in order of how many programs in the band use them.

What each band uses (share of programs using the feature at least once, plus its share of instructions):

Feature ≥ 5k programs 2k–5k Share of instructions, ≥ 5k
wave64 (as recomp::detect_wave64 sees it) 6 % 16 %
LDS (ds_* except swizzle/permute) 7 % 11 % 0.02 %
s_barrier 1 program 3 %
lane reads/writes, swizzle, permute 99 % 93 % 1.2 %
DPP 91 % 9 % 0.16 %
SDWA 93 % 87 % 0.1 %
image sample/gather 98 % 88 %
image load/store/atomic 98 % 78 %
any image op 0.96 %
VOP3 neg/abs/omod/clamp 100 % 100 % 6.3 %

What this says about the unknowns.

  • 1, its own compile time. There's no small subset that serves the programs that matter. A useful interpreter needs about 300–350 cases. The synthetic cold-b switch was 86–91 ms cold at 400 cases on the RTX 3050, but its case bodies are trivial. Real bodies (descriptor fetches, modifiers, 64-bit ops) will cost more, so B on the real interpreter is still the measurement that decides it.
  • 3, descriptors. This one is required from the start: 98 % of the big programs sample or load images. Run-time T#/S# decoding through the bindless heap can't be deferred.
  • 4, wave semantics. It's narrower than feared for the big programs. Only 6 % of them are wave64, 7 % use LDS, and 1 of 868 uses a barrier. Lane ops (v_readfirstlane 42 %, v_readlane 40 %, v_writelane 15 %, v_permlanex16 3 %) and DPP are near universal, but they're about 1.4 % of instructions.
  • 5, operand modifiers. They're everywhere, but at 6 % of instructions. Treating them as a per-instruction run-time cost looks affordable.

Limits. These are static counts. They can't say how often an instruction runs, so they say nothing about speed (C). Instruction count stands in for compile time: #1096 found DXC time roughly proportional to it, and the slowest driver compiles there were the biggest programs. I didn't check which of these programs are the ones a run actually waits on.

@⁠CowboyBingus I don't see the two stacked branches yet, and I don't want to step on your PR 2. Would it help if I took D (opcode bodies generated from emit.rs), or would you rather I wait and run B and the per-instruction tests of your branch on the 3050? The census patch is 83 lines. I can open it as a PR if a --census mode would be useful to others.

This comment was AI-assisted.

**@⁠brothernog** on GitHub · 2026-11-25 02:07 UTC · [original](https://github.com/xcl-dev/xcl/issues/1455#issuecomment-7150351794) A static census of the retail pack's compute programs, to size the interpreter against the issue's unknowns. It's local and offline, numbers only: `main` `c2dcef3` plus a small local `xcl shaders --census` that decodes every program and counts what each one uses. It reproduces the existing totals (26 698 programs; `image_gather4_l` in 16 shaders, 58 occurrences). **Population.** 2 689 programs have a compute interface. I banded them by console instruction count, as in #1096, because only the big programs compile slowly enough to need a stand-in. | Band (instructions) | Programs | Share of compute instructions | Distinct mnemonics, programs fully covered at 90 % / 95 % / 100 % | Base opcodes (SDWA/DPP folded) | |---|---|---|---|---| | < 500 | 897 | 0.9 % | 272 / 300 / 358 | 313 | | 500–2k | 370 | 2.7 % | 325 / 343 / 358 | 317 | | 2k–5k | 554 | 10.5 % | 294 / 311 / 354 | 311 | | ≥ 5k | 868 | 85.9 % | 273 / 298 / 348 | 308 | | all compute | 2 689 | 100 % | 320 / 348 / 421 | 365 | Coverage is greedy: mnemonics are taken in order of how many programs in the band use them. **What each band uses** (share of programs using the feature at least once, plus its share of instructions): | Feature | ≥ 5k programs | 2k–5k | Share of instructions, ≥ 5k | |---|---|---|---| | wave64 (as `recomp::detect_wave64` sees it) | 6 % | 16 % | | | LDS (`ds_*` except swizzle/permute) | 7 % | 11 % | 0.02 % | | `s_barrier` | 1 program | 3 % | | | lane reads/writes, swizzle, permute | 99 % | 93 % | 1.2 % | | DPP | 91 % | 9 % | 0.16 % | | SDWA | 93 % | 87 % | 0.1 % | | image sample/gather | 98 % | 88 % | | | image load/store/atomic | 98 % | 78 % | | | any image op | | | 0.96 % | | VOP3 neg/abs/omod/clamp | 100 % | 100 % | 6.3 % | **What this says about the unknowns.** - **1, its own compile time.** There's no small subset that serves the programs that matter. A useful interpreter needs about 300–350 cases. The synthetic `cold-b` switch was 86–91 ms cold at 400 cases on the RTX 3050, but its case bodies are trivial. Real bodies (descriptor fetches, modifiers, 64-bit ops) will cost more, so **B** on the real interpreter is still the measurement that decides it. - **3, descriptors.** This one is required from the start: 98 % of the big programs sample or load images. Run-time T#/S# decoding through the bindless heap can't be deferred. - **4, wave semantics.** It's narrower than feared for the big programs. Only 6 % of them are wave64, 7 % use LDS, and 1 of 868 uses a barrier. Lane ops (`v_readfirstlane` 42 %, `v_readlane` 40 %, `v_writelane` 15 %, `v_permlanex16` 3 %) and DPP are near universal, but they're about 1.4 % of instructions. - **5, operand modifiers.** They're everywhere, but at 6 % of instructions. Treating them as a per-instruction run-time cost looks affordable. **Limits.** These are static counts. They can't say how often an instruction runs, so they say nothing about speed (**C**). Instruction count stands in for compile time: #1096 found DXC time roughly proportional to it, and the slowest driver compiles there were the biggest programs. I didn't check which of these programs are the ones a run actually waits on. @⁠CowboyBingus I don't see the two stacked branches yet, and I don't want to step on your PR 2. Would it help if I took **D** (opcode bodies generated from `emit.rs`), or would you rather I wait and run **B** and the per-instruction tests of your branch on the 3050? The census patch is 83 lines. I can open it as a PR if a `--census` mode would be useful to others. This comment was AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.