startup: run native shader compilation and compute dispatch through the runtime #2934

Closed
opened 2026-11-27 01:29:36 +00:00 by github-bot · 3 comments
Owner

@⁠sydney-0o on GitHub · 2026-11-26 22:00 UTC · original

Target branch: cpp-migration

Problem

At 7f951fd3, x2w_shader_compiler is linked into compile_dxil and test executables. The startup runtime has no caller for ShaderDxilCompiler::runtime_worker, NativeRecording, or NativeDispatchStates. The Windows startup launcher still starts the Python gfx2hlsl.py --watch process when shader translation is enabled. The native compiler and recording fixtures therefore do not yet demonstrate execution through the startup runtime.

Compiler build targets · Native recording fixture · Startup launcher

Done when

  • With native translation enabled and an empty cache, a source-built compute workload passes through the normal startup runtime entry point. It compiles and records a dispatch without starting the Python watcher. Compare the fenced GPU readback with a CPU reference.
  • Add a Windows integration check that exercises the runtime entry point. Include a negative control that refuses an unsupported workload without changing the output buffer. Report the tested commit, commands, adapter, driver, Windows build, debug-layer status, and any capability skips separately.
  • Verify the dispatch on a supported physical GPU. Preserve the existing WARP package smoke test on adapters without the required wave width.

If the runtime route uses the on-disk shader cache, it depends on #2933.

**@⁠sydney-0o** on GitHub · 2026-11-26 22:00 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2934) Target branch: `cpp-migration` ## Problem At `7f951fd3`, `x2w_shader_compiler` is linked into `compile_dxil` and test executables. The startup runtime has no caller for `ShaderDxilCompiler::runtime_worker`, `NativeRecording`, or `NativeDispatchStates`. The Windows startup launcher still starts the Python `gfx2hlsl.py --watch` process when shader translation is enabled. The native compiler and recording fixtures therefore do not yet demonstrate execution through the startup runtime. [Compiler build targets](https://github.com/R0Y00/Xbox2Windows/blob/7f951fd3/CMakeLists.txt#L15) · [Native recording fixture](https://github.com/R0Y00/Xbox2Windows/blob/7f951fd3/tests/native_recording_check.cpp) · [Startup launcher](https://github.com/R0Y00/Xbox2Windows/blob/7f951fd3/tools/startup/run.ps1#L69) ## Done when - With native translation enabled and an empty cache, a source-built compute workload passes through the normal startup runtime entry point. It compiles and records a dispatch without starting the Python watcher. Compare the fenced GPU readback with a CPU reference. - Add a Windows integration check that exercises the runtime entry point. Include a negative control that refuses an unsupported workload without changing the output buffer. Report the tested commit, commands, adapter, driver, Windows build, debug-layer status, and any capability skips separately. - Verify the dispatch on a supported physical GPU. Preserve the existing WARP package smoke test on adapters without the required wave width. If the runtime route uses the on-disk shader cache, it depends on #2933.
github-bot 2026-11-27 01:29:36 +00:00
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:29:36 +00:00
Author
Owner

@⁠Not-Saii on GitHub · 2026-11-26 22:35 UTC · original

Claiming this.

Environment: Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), Windows SDK 10.0.26100, plus WARP.

Part I will do, on cpp-migration: route a source-built compute workload through the stand-in's normal slot 67 and Dispatch path with native translation enabled and an empty cache. It compiles in-process with the pieces the issue names (ShaderDxilCompiler::runtime_worker, NativeRecording, NativeDispatchStates) and records the dispatch, with no gfx2hlsl.py --watch process. The Windows check compares the fenced readback with a CPU reference. Its negative control is an unsupported workload that is refused while the output buffer keeps its sentinel. Hardware run on the RTX 4090; the WARP package smoke test stays, with the wave-width skip reported separately.

Shared interfaces I expect to touch: the compute dispatch path in src/startup_stubs/d3d12_compute_dispatch.inl, the stand-in's link against x2w_shader_compiler, and the translation switch in tools/startup/run.ps1. I plan to compile in-process, so I do not expect to depend on the on-disk cache work in #2933. I will say here if tracing shows otherwise.

AI-assisted (Claude Code).

**@⁠Not-Saii** on GitHub · 2026-11-26 22:35 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2934#issuecomment-7204810488) Claiming this. Environment: Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), Windows SDK 10.0.26100, plus WARP. Part I will do, on `cpp-migration`: route a source-built compute workload through the stand-in's normal slot 67 and Dispatch path with native translation enabled and an empty cache. It compiles in-process with the pieces the issue names (`ShaderDxilCompiler::runtime_worker`, `NativeRecording`, `NativeDispatchStates`) and records the dispatch, with no `gfx2hlsl.py --watch` process. The Windows check compares the fenced readback with a CPU reference. Its negative control is an unsupported workload that is refused while the output buffer keeps its sentinel. Hardware run on the RTX 4090; the WARP package smoke test stays, with the wave-width skip reported separately. Shared interfaces I expect to touch: the compute dispatch path in `src/startup_stubs/d3d12_compute_dispatch.inl`, the stand-in's link against `x2w_shader_compiler`, and the translation switch in `tools/startup/run.ps1`. I plan to compile in-process, so I do not expect to depend on the on-disk cache work in #2933. I will say here if tracing shows otherwise. AI-assisted (Claude Code).
Author
Owner

@⁠Not-Saii on GitHub · 2026-11-26 23:29 UTC · original

Update to my claim, after tracing and a first run on the RTX 4090.

The route does not use NativeRecording or NativeDispatchStates. The stand-in's dispatch path (record_translated_dispatch) already resolves raw table buffers, tracks their states and refuses what it cannot bind. So on the first Dispatch of a slot 67 pipeline the stand-in translates the request in-process (x2w::read_compute_request, x2w::translate_compute, then ShaderDxilCompiler::runtime_worker) and fills the same ComputeTranslation a published <key>.txt fills. The two helpers stay unused until a binder handles textures and typed views.

What it accepts so far is what the fixture runs: root constants, a raw table buffer loaded per lane and a raw table buffer stored to. Everything else, a scalar buffer load included, is refused by name and left to a published translation.

Two things the runs showed:

  • The C++ frontend refuses case A of startup_gfx2hlsl_compute_check.py (unaligned descriptor table entry): that program takes its second buffer descriptor from table byte 16, and the frontend reads a table as 32-byte records. The fixture uses the same program with the descriptors at bytes 0 and 32, and case A as the refused workload.
  • WARP has no 32-lane waves here (Microsoft Basic Render Driver 10.0.26100.9818), so the WARP variant checks the refusals and the fallback and then reports a capability skip. The full readback is the _hardware variant.

It reads the request files the stand-in itself wrote, through the reader that #2939 moved to revision 28, so it needs nothing else from #2933. PR to follow.

AI-assisted (Claude Code).

**@⁠Not-Saii** on GitHub · 2026-11-26 23:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2934#issuecomment-7205588818) Update to my claim, after tracing and a first run on the RTX 4090. The route does not use `NativeRecording` or `NativeDispatchStates`. The stand-in's dispatch path (`record_translated_dispatch`) already resolves raw table buffers, tracks their states and refuses what it cannot bind. So on the first Dispatch of a slot 67 pipeline the stand-in translates the request in-process (`x2w::read_compute_request`, `x2w::translate_compute`, then `ShaderDxilCompiler::runtime_worker`) and fills the same `ComputeTranslation` a published `<key>.txt` fills. The two helpers stay unused until a binder handles textures and typed views. What it accepts so far is what the fixture runs: root constants, a raw table buffer loaded per lane and a raw table buffer stored to. Everything else, a scalar buffer load included, is refused by name and left to a published translation. Two things the runs showed: - The C++ frontend refuses case A of `startup_gfx2hlsl_compute_check.py` (`unaligned descriptor table entry`): that program takes its second buffer descriptor from table byte 16, and the frontend reads a table as 32-byte records. The fixture uses the same program with the descriptors at bytes 0 and 32, and case A as the refused workload. - WARP has no 32-lane waves here (Microsoft Basic Render Driver 10.0.26100.9818), so the WARP variant checks the refusals and the fallback and then reports a capability skip. The full readback is the `_hardware` variant. It reads the request files the stand-in itself wrote, through the reader that #2939 moved to revision 28, so it needs nothing else from #2933. PR to follow. AI-assisted (Claude Code).
Author
Owner

@⁠MasterDomino on GitHub · 2026-11-27 00:08 UTC · original

Closed by #2958 (@⁠Not-Saii), merged into cpp-migration as b260984f. With X2W_NATIVE_SHADERS (run.ps1 -NativeShaders), the stand-in translates a slot 67 compute request in-process on its first Dispatch, with no Python watcher. startup_compute_dispatch_native_hardware passes on an RTX 4090 and an RX 9070 XT, and the WARP smoke test still passes. In a 300 s start-up run with the switch, the run was stable; all logged attempts were refused, as the narrow scope intends. AI-assisted.

**@⁠MasterDomino** on GitHub · 2026-11-27 00:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2934#issuecomment-7206207318) Closed by #2958 (@⁠Not-Saii), merged into `cpp-migration` as `b260984f`. With `X2W_NATIVE_SHADERS` (`run.ps1 -NativeShaders`), the stand-in translates a slot 67 compute request in-process on its first Dispatch, with no Python watcher. `startup_compute_dispatch_native_hardware` passes on an RTX 4090 and an RX 9070 XT, and the WARP smoke test still passes. In a 300 s start-up run with the switch, the run was stable; all logged attempts were refused, as the narrow scope intends. AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#2934
No description provided.