Skip to content

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

Done

Description

@sydney-0o

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.

Activity

  1. added
    help wanted
    on Nov 26, 2026
  2. Not-Saii commented on Nov 26, 2026

    @Not-Saii
    Contributor

    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).

  3. Not-Saii commented on Nov 26, 2026

    @Not-Saii
    Contributor

    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).

  4. MasterDomino commented on Nov 27, 2026

    @MasterDomino
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions