Repository navigation
runtime: translate slot 67 compute requests in the stand-in - #2958
Conversation
…00#2934) With X2W_NATIVE_SHADERS naming the directory of dxcompiler.dll and dxil.dll, the first Dispatch of a slot 67 pipeline reads the request the stand-in published, runs the C++ compute frontend and the DXIL compiler in-process, and fills the ComputeTranslation that a published <key>.txt fills. The existing dispatch path then binds the table buffers. Accepted: root constants, a raw table buffer loaded per lane and a raw table buffer stored to. Every other view kind, a sampler, an adapter without 32-lane waves and whatever the frontend refuses are logged by reason and left to a published translation. run.ps1 -Render -NativeShaders <dir> sets the switch. startup_compute_dispatch_native_{warp,hardware} dispatches a source-built program from an empty cache and compares all 320 output words with the CPU reference; an unsupported program is refused with the output untouched. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Route, program and controls, commands, the results on the RTX 4090 and on WARP (capability skip: no 32-lane waves) for a58e08f, and the limits of what was run. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…(Refs R0Y00#2934) tools/package-gpu-check.ps1 at 89a7531: the extracted package passes its WARP run, 11 tests and 68 of 68 recorded shader cases; bvh_wave64_warp reports a capability skip (no 64-lane waves). Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
|
Tested Both exited 0. PR tests, twice, serially, with
The WARP skip is a capability skip, not a failure: Microsoft Basic Render Driver 10.0.26100.8521 has no 32-lane waves. Before exiting 77 the check confirmed the native translation is refused by that name with every word untouched, that case A is refused the same way, and that the first program then matches all 320 words through its published translation. Related family once, including All 24 passed, both ctest exits 0: Control: on merge-base Not a duplicate of another open or merged PR; this is the only PR for #2934. Related but distinct: #2955 (merged; The author's RTX 4090 result holds on a second NVIDIA GPU and a newer driver. Still unrun, as the PR already notes: a non-NVIDIA GPU, a Release/ AI-Assisted |
MasterDomino
left a comment
There was a problem hiding this comment.
Review of head f06d1d43, tested merged onto cpp-migration f934df52. It merges cleanly, and CI on the head is green. This changes d3d12_xs.dll, so it also got start-up runs. Approving and merging.
Code read:
- Without
X2W_NATIVE_SHADERSin the environment,translate_compute_nativelyreturnsfalseat once and the manifest path runs as before. DXC is only loaded on the first native attempt. - Accepted are root constants,
raw_vector_srvandraw_buffer_uavwitharray_count == 1in register order. Anything else is refused with a logged reason and left to the published translation.
Fixtures (Windows 11 26300.9974, AMD Radeon RX 9070 XT, driver 32.0.32029.2010, release): the startup_compute_dispatch*, startup_slot67_indirect_dispatch_warp, startup_compute_translate_e2e_warp, startup_run_ps1, offscreen_warp and native_* families, 67 tests: 65 passed and 2 skipped (77: native_comparison_pso_warp, and startup_compute_dispatch_native_warp because WARP has no 32-lane waves). startup_compute_dispatch_native_hardware passes.
Negative control: with the native path forced off (translate_compute_natively returns false before reading the switch), startup_compute_dispatch_native_hardware fails with word=0 got=c5c5c5c5 … (288 words differ). With it restored, it passes.
Start-up runs, 300 s each, back to back, lazy memory off, the same input script, each from a fresh copy of the same shader cache, counts only:
base f934df52 |
this PR, no switch | this PR, -NativeShaders <SDK bin> |
|
|---|---|---|---|
| end | timeout, no second-chance exception | timeout | timeout |
| frames | 8,049 | 8,362 | 8,185 |
| storage requests done | 10,511 | 10,582 | 10,778 |
| textures uploaded | 1,392 | 1,431 | 1,390 |
| graphics pipelines over time | 14 at ≈198 s, 18 at ≈278 s, 46 at ≈288 s | 14 / 18 / 46 at ≈195 / 275 / 290 s | 14 / 18 at ≈205 / 285 s (last sample before the late step) |
- Without the switch the run matches the base, so the default path is unchanged.
- With the switch the run is stable and follows the same scene timing. No program translated natively in this run: all 16 logged attempts (the log cap) were refused, as the narrow scope intends. The reasons were
view kind … is not bound for a natively translated program(6),raw buffer load needs offen with zero scalar offset and no modifiers(3),unsupported DPP lane selection(2),non-contiguous resource descriptor(2), and one each of SDWA, an unbound numeric SGPR and image modifiers. Every refused program fell back to its published translation.
Follow-up, not blocking: the native attempt is not quite "once per key". When it fails and no <key>.txt exists yet, record_translated_dispatch retries when retry_manifest_at comes round, about once a second, and each retry runs translate_compute_natively again, reading the request and running the frontend and possibly DXC. Remembering a refusal on the ComputeTranslation, for example a native_refused flag set in the catch, would make it once per key as the description says, and keep the CPU cost of a refused program out of the draw lock.
I will close #2934 by hand.
AI-assisted; the commands above were run locally.
Resolves the conflicts with R0Y00#2932-R0Y00#2971 (keeps both sides: HeapViewContract next to the MODE tracking and lane-shape checks; .views handling inside the new compile_one). The check follows the new --requests output name <key>.cs.cso from R0Y00#2955, and the notes mention the stand-in's native slot 67 path (R0Y00#2958), which translates without a heap view contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #2934
With
X2W_NATIVE_SHADERSnaming the directory ofdxcompiler.dllanddxil.dll, the stand-in translates a slot 67 compute request in-process on the pipeline's first Dispatch and records the Dispatch, with an empty shader cache and no Python watcher.Two things to know first
NativeRecordingorNativeDispatchStates, which the issue names. The stand-in's dispatch path (record_translated_dispatch) already resolves raw table buffers, tracks their states and refuses what it cannot bind. So the new code reads the request the stand-in itself published (x2w::read_compute_request), runsx2w::translate_computeandShaderDxilCompiler::runtime_worker, and fills the sameComputeTranslationa published<key>.txtfills. The two helpers stay unused until a binder handles textures and typed views.offscreen_check.exe, which compiles the stand-in source without the new define.tools/package-gpu-check.ps1was run at89a75318(same code asa58e08f9, plus the note): the extracted package passes its WARP run with 11 tests and 68 of 68 recorded shader cases.bvh_wave64_warpreports a capability skip there (no 64-lane waves), which the script does not require.What changed
src/startup_stubs/d3d12_compute_dispatch.inl:translate_compute_natively, tried once per key and before a published<key>.txt. Root signature and pipeline creation moved into a helper shared with the manifest loader.CMakeLists.txt:d3d12_xs_shimlinksx2w_shader_compilerand definesX2W_NATIVE_SHADERSwhen that target exists. Both use the static CRT.tools/startup/run.ps1:-Render -NativeShaders <dir>sets the switch;tests/startup_run_ps1_check.pycovers it with a mutant.tests/startup_compute_dispatch_native_check.py(startup_compute_dispatch_native_{warp,hardware}) and adispatch-records32mode intests/startup_stream_consumer.cpp.docs/startup-runtime.mdand a note,docs/experiments/startup-compute-native-dispatch.md.The check
The program is case A of
startup_gfx2hlsl_compute_check.pywith its two buffer descriptors loaded from 32-byte table records (bytes 0 and 32). The C++ frontend reads a table as 32-byte records and refuses case A as written (unaligned descriptor table entry), so case A is the unsupported workload.no translation; every word keeps the sentinel.gfx2hlsl.py --pendingpublishes both requests; case A then runs through the published translation and all 320 words match.Commands and results
Commit
a58e08f9oncpp-migrationate3670100, Windows 11 build 26300.9974, Debug build (devpreset), D3D12 debug layer enabled.startup_compute_dispatch_native_hardwarestartup_compute_dispatch_hardwarenative_wave_request_hardwarestartup_compute_dispatch_warpand the family above)offscreen_warp-V, adapter line not read)tools/package-gpu-check.ps1(Release, at89a75318)bvh_wave64_warpcapability skipCapability skip, not a pass:
startup_compute_dispatch_native_warpexits 77. A direct compute module declares wave size 32 and this WARP reports no 32-lane waves. Before exiting, the check confirms that the native translation is refused by that name with every word untouched, and it runs steps 3 and 4 and the first program through its published translation.Pure-Python checks run:
startup_run_ps1_check.py,docs_links_check.py,bidi_controls_check.py.Limits
v_nopprefix was only checked withcompile_dxil, not dispatched.<shader cache>\nativeis reused).format_compute_runtime_manifestwhile this was being tested. This PR keeps its own narrower mapping (the two view kinds its fixture runs); moving to the shared formatter would widen what is accepted and is left for a follow-up.🤖 Generated with Claude Code