shader: consume startup requests and publish runtime cache entries in compile_dxil #2955
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2955"
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 consolelogkyo on 2026-11-26T23:12:53Z.
Summary
Make
compile_dxil --requestsconsume revision-28 startup requests (including ASCIIreq_<key>.psinstream descriptions) and publish runtime-named stage binaries and<key>.txtmanifests accepted directly by the startup runtime cache loaders:.psinstream descriptions (src/shader_compute_request.cpp,src/gfx1013_compute_native.cpp,src/gfx1013_direct_graphics.inl,src/guest_shader_container.h):req_<key>.psin(psin1 <16-hex-key> ena=0x<mask> addr=0x<mask>), reject malformed lines, duplicate/missing masks, embedded keys naming another pipeline, or contradictory(ena & ~addr) != 0masks, and foldb"psin1" + struct.pack("<II", ena, addr)into the graphics FNV-1a key identically totools/startup/gfx2hlsl.py:pipeline_key.SPI_PS_INPUT_ADDR(entry VGPR layout) andSPI_PS_INPUT_ENA(loaded entry inputs) in raw graphics lowering, refusing reads of allocated-but-disabled pixel entry VGPRs and keying raw parameter/wave acceptance off verifiedenable_maskcenter inputs rather than a binary interpolant count..c67requests report"compute request key mismatch".src/direct_compute_cache.cpp,tools/startup/compile_dxil.cpp):req_from--requestsoutput stems (<key>.vs.cso/<key>.ps.cso,<key>.gs.csoforgfx1013-container-rect, and<key>.cs.csofor compute).x2w-manifest(1/2for graphics,2+stage cs+groupfor compute) for stage bindings modelled byd3d12_draw.inl:load_translationandd3d12_compute_dispatch.inl:load_compute_translation, skipping manifest emission for unmodelled bindings (such as IAvertex_fetchlayouts, rectangle GS batches, typed/half/indexed-atomic buffer views, or comparison samplers in compute).<key>.txtbefore updating stages or on refusal, write<key>.psdepwhen.psinwas used, and atomically publish<key>.txtlast.FILE_SHARE_DELETEduring cache lookups (src/direct_compute_cache.cpp,src/shader_dxil_compiler.cpp) so concurrent--jobsworkers sharing a stage do not fail whenMoveFileExWreplaces an identical entry.tests/native_startup_request_cache_check.py(tests/cmake/native_startup_request_cache.cmake) anddocs/experiments/native-startup-request-cache.md.Closes #2933
Verification
Windows 11 (
10.0.26100), Release preset (MSVC 19.44, Windows SDK10.0.26100.0DXC),X2W_D3D12_DEBUG=1(0D3D12 debug-layer errors) on Microsoft Basic Render Driver (WARP) (1414:008c, driver10.0.26100.9818) and AMD Radeon RX 9070 XT (1002:7550, driver32.0.32029.2010):native_startup_request_cache_controls: PASS (in-place.psingraphics +.c67compute publication,gfx2hlsl.pending_keyscompletion check, revision-literal pinning betweenshader_compute_request.cppandd3d12_draw.inl, stale-stage manifest withdrawal, and 8 fresh-directory refusal controls)native_startup_request_cache_warp: PASS (91-pixel.psindraws for(0x8002, 0x8003)and(0x8002, 0x8002)+ mismatched-mask negative control, end-to-endstartup_stream_consumer->compile_dxil --requests->d3d12_xsgraphics draw, and Wave-4 WARP compute manifest/root loader check)native_startup_request_cache_hardware(RX 9070 XT): PASS (full end-to-end.psindraws,d3d12_xsgraphics draw, andd3d12_xsslot-67.c67Dispatch(3, 2, 2)matching all 320 output dwords without manual renaming)^native_suite (40tests:39passed,1skippednative_comparison_pso_warp) +docs_links+bidi_controls: PASSAI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T23:23:43Z.
Review: APPROVED
Review of head
6137bed2, tested merged ontocpp-migration49e0e36d(after #2950 and #2952). It auto-merges cleanly, and CI on the head is green. I read it against @Not-Saii's notes on #2933. Approving and merging, with follow-ups below.Checked against those notes:
-28, then a, b, root,.ia, thenpsin1+<II>(ena, addr), the same asgfx2hlsl.pipeline_key. Compute hashes-28cswith the same framing..psinline: it is parsed toread_ps_inputs' rules: at most 128 bytes,psin1 <16 hex>withena=0x/addr=0xonce each, the named key must equal the request's (pixel input description names another pipeline), both masks are required, andena & ~addris refused. A key mismatch with a description reportsstale pixel input description.<key>.txtis withdrawn first, VS/PS (and GS) are compiled in memory, then published atomically, then.psdep, then the manifest last, which matchesgfx2hlsl.translate_to.d3d12_draw.inl,d3d12_compute_dispatch.inl).indexed_atomic_uav, comparison samplers in compute, constant blocks over 8 words or 32 in total, vertex fetch and non-SV_VertexID/SV_InstanceIDinputs get no manifest.Runs (Windows 11 26300.9974, AMD Radeon RX 9070 XT, driver 32.0.32029.2010, release):
ctest --preset release --no-tests=error -R '^native_': 43 tests, 42 passed and 1 skipped (77,native_comparison_pso_warp).native_startup_request_cache_{controls,warp,hardware}all pass.described_key != expectedcheck failsnative_startup_request_cache_controlsatpsin-other-pipeline. With it restored, it passes..c67and 628 graphics requests, run withcompile_dxil --jobs 8 … --requests. Compute: 270 compiled, 100 with a manifest. Graphics: 3 compiled, 1 with a manifest. Of the 59 compute keys that also have agfx2hlslmanifest, 43 have identical binding lines, and 9 differ only in hex formatting (00000092against0x92, which the loader's%xreads the same). The rest are binding choices that differ per compiler, which is fine, since each manifest describes its own shader, plus the sampler point below.Follow-ups, not blocking:
format_*_runtime_manifestreturnsnullopt. The stage files are published with no manifest and no message saying why. That is safe, because the runtime will not load them, but areportline naming the binding (as #2933 suggested) would make these countable the way--refusalsis forgfx2hlsl.bufSRV branch (buffer_srv,raw_vector_srv,byte_window_srv) does not checkarray_count == 1, while the texture branches do.smpl 0 00000092 00000000 …, wheregfx2hlslwritessmp 0 0x92 0xc00000 …for the same request. If I readSQ_IMG_SAMP_WORD1right, native drops MAX_LOD (12.0 → 0), which would clamp explicit-LOD sampling to mip 0 once these manifests are loaded. That is worth an issue on the sampler extraction.I will close #2933 by hand.
AI-assisted; the commands above were run locally.