Repository navigation
Conversation
A GPU hang in a retail title costs a whole game run per experiment. The plan is to write one draw or dispatch of a named shader to disk during a run and to run it again alone, in seconds (this stack: the format, the hook, the textures, xcl replay). This is the format only: capture::manifest, the manifest.json of a capture folder (the call, shader files, the PC pipeline description, root arguments, fixed-function state, targets, memory ranges, textures, views, samplers, descriptor slots, what was left out) with Manifest::write and Manifest::read. Structures D3D12 gives as plain data are kept as hex of their bytes. Nothing writes a capture yet. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
XCL_CAPTURE_DRAW=<container fnv64, hex>[:N] writes the Nth draw or dispatch whose VS, PS or CS is that console shader to <data>/captures: the shader containers, the PC pipeline description, the root arguments and the io words bind_abi made, the list's fixed-function state, targets, PC vertex and index buffer views, the non-zero slots of each descriptor table, the samplers made so far, and the unified memory the tables, root buffers and V# name. Textures are listed with their descriptions and the PC views made of them; their contents follow in the next change. The call is taken in bind_abi, where the io words and the argument table exist. Memory is read at the submit of the call's list, not when the call is recorded: titles fill buffers in between. The matching calls are not run unless XCL_CAPTURE_RUN=1: the switch is for calls that hang the GPU. To find the hash to give: with the variable set (XCL_CAPTURE_DRAW=list for that alone) every pipeline made from translated console shaders is logged with its shaders' hashes, the first 200, where dred::label names it – the one place all five pipeline kinds pass. Draws of VS + PS pipelines and dispatches of single compute pipelines are captured; geometry, mesh and split compute pipelines are listed only. To name what a slot's T# means on the PC, the SRV / UAV made at each heap index, the RTV / DSV at each handle, samplers and the last transition of a resource are noted while a shader is chosen. A view counts only if its resource was not released since. Without the variable every hook returns at capture::on(). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
XCL_CAPTURE_DRAW=<container fnv64, hex>[:N]writes the Nth draw or dispatch whose VS, PS or CS is that console shader to<data>\captures\: everything needed to run it again alone except the textures' contents, which the next PR adds. Off unless the variable is set. Part of #675.The matching calls are not run in that run (
XCL_CAPTURE_RUN=1runs them): the switch is for a call that hangs the GPU.XCL_CAPTURE_DRAW=listonly logs each translated pipeline's shader hashes, to find the hash to give.Over 400 lines: the hook is one piece. The notes it needs (the view at each heap index, the last transition of a resource) are of no use without the call that reads them, and the call cannot be written without them.
Stacked on #2429; only the top commit belongs here.
What is in it
hle/d3d12x/capture.rs: the switch; what is noted while it is set (pipelines with the chosen shader, the SRV / UAV made at each heap index, RTV / DSV by handle, samplers, the last transition of a resource; a view counts only if its resource was not released since);on_call(shader containers, PC pipeline description, root arguments and theiowords, fixed-function state, targets, vertex / index buffer views, the non-zero slots of each descriptor table, textures with their descriptions and views); memory read on the CPU at the submit of the call's list (titles fill buffers after recording the call); the pipeline listing.bind.rs: the call's arguments, and the capture at the end ofbind_abi, where theiowords and the argument table exist.real.rs,console_heap.rs,list_x.rs,dred.rs: one-line notes at pipeline, view, sampler and target-view creation, descriptor copies, transitions, resource release, before and after ExecuteCommandLists;list_x::capture_state.Tested
cargo test --release -p xcl --lib -- capture:: dred: 12 passed, 0 failedcargo test --release -p xcl --lib -- hle::d3d12x:: --test-threads=4: 223 passed, 1 failed, 2 ignored (run before the pipeline listing was added; after it, the line above).hle::d3d12x::bind::tests::execute_indirect_reads_the_arguments_written_before_itfails on this Windows 10 machine in the mixed run, on the first branch of the stack already (which changes no runtime code); it passed in another run of the same tree: order-dependent, not from this stackXCL_CAPTURE_DRAW=listin its menus listed 8 pipelines (5 VS + PS, 3 CS); two draws were then captured by hash (:3, a DrawIndexed of 30 with 4 textures;:100, a Draw of 3) and replayed.cargo test --workspace --no-fail-fast -- --test-threads=4onc2569b0: 1265 passed, 4 failed, 46 ignored. The failures:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 540),hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory(Tests: align XMemVirtualQuery buffers and verify CPU flags #650) and the e2e teststest_title_runs_and_game_folder_is_untouchedandtest_title_draws_with_a_root_signature_under_the_debug_layer, which fail onmainon this machine too. SKIPPED: the six per-lane cases off16_programs_on_the_gpu/f32_programs_on_the_gpu(refused),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)Regression run
scripts/smoke.ps1, 60 s, release builds, the same title on the same day.main:
PR:
Not tested
XCL_CAPTURE_EXTRA).AI use
🤖 Generated with Claude Code