runtime: translate slot 67 compute requests in the stand-in #2958
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2958"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-26T23:30:32Z.
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
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T23:57:44Z.
Tested
f06d1d43on the test PC (Windows 11 25H2 26200, MSVC 19.44, NVIDIA GeForce RTX 4070 Ti driver 32.0.16.2135, Debug/devpreset, D3D12 debug layer enabled).Both exited 0.
PR tests, twice, serially, with
-j 1 --no-tests=error:startup_compute_dispatch_native_hardwarestartup_compute_dispatch_native_warpstartup_run_ps1The 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
docs_linksandbidi_controls:All 24 passed, both ctest exits 0:
native_wave_request_hardware,offscreen_warp,startup_compute_translate_e2e_{warp,hardware},startup_compute_dispatch_{warp,hardware},startup_compute_dispatch_{texture,heap,heap_word,input,entry,array,array_d16}_{warp,hardware},startup_slot67_indirect_dispatch_{warp,hardware},docs_links,bidi_controls.Control: on merge-base
e3670100(cpp-migration),tests/cmake/startup_compute_dispatch_native.cmakeandtests/startup_compute_dispatch_native_check.pyare absent, so the new tests are not registered without this PR.Not a duplicate of another open or merged PR; this is the only PR for #2934. Related but distinct: #2955 (merged;
compile_dxilpublish path) and #2912 (open; native DXIL heap-slot probe).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/
/O2build, a start-up run with-NativeShaders, and an indirect Dispatch of a natively translated program. The choice not to useNativeRecording/NativeDispatchStatesis documented and matches the two raw-buffer view kinds this path accepts. Leaving the #2955 shared manifest formatter as a follow-up also looks right, so this change does not silently widen what the stand-in will bind.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-27T00:08:30Z.
Review: APPROVED
Review of head
f06d1d43, tested merged ontocpp-migrationf934df52. It merges cleanly, and CI on the head is green. This changesd3d12_xs.dll, so it also got start-up runs. Approving and merging.Code read:
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.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_warpandnative_*families, 67 tests: 65 passed and 2 skipped (77:native_comparison_pso_warp, andstartup_compute_dispatch_native_warpbecause WARP has no 32-lane waves).startup_compute_dispatch_native_hardwarepasses.Negative control: with the native path forced off (
translate_compute_nativelyreturnsfalsebefore reading the switch),startup_compute_dispatch_native_hardwarefails withword=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:
f934df52-NativeShaders <SDK bin>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>.txtexists yet,record_translated_dispatchretries whenretry_manifest_atcomes round, about once a second, and each retry runstranslate_compute_nativelyagain, reading the request and running the frontend and possibly DXC. Remembering a refusal on theComputeTranslation, for example anative_refusedflag set in thecatch, 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.