Skip to content

D3D12.X: the capture format of one draw or dispatch - #2429

Open
madaraXor wants to merge 1 commit into
xcl-dev:mainfrom
madaraXor:capture-format
Open

madaraXor wants to merge 1 commit into
xcl-dev:mainfrom
madaraXor:capture-format

Conversation

@madaraXor

Copy link
Copy Markdown
Contributor

A GPU hang in a retail title costs a whole game run per experiment. This stack writes one draw or dispatch of a named shader to disk during a run (XCL_CAPTURE_DRAW) and runs it again alone, in seconds (xcl replay). Part of #675.

This first part is the format of a capture only; nothing writes one yet.

What is in it

  • hle/d3d12x/capture/manifest.rs: 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), Manifest::write / Manifest::read with a version check. D3D12 structures are kept as hex of their bytes.
  • hle/d3d12x/capture.rs, mod.rs: the module.
  • Tests: a manifest reads back as written; another version, or no file, is an error naming the file; a manifest without a later field still reads; hex round trip.

Tested

  • AMD Radeon RX 6700 XT 12 GB (RDNA2), driver 32.0.21045; Ryzen 5 5600X, 16 GB; Windows 10 22H2 (19045); rustc 1.90.0; release
  • cargo test --release -p xcl --lib -- capture::: 4 passed, 0 failed
  • cargo test --release -p xcl --lib -- hle::d3d12x:: --test-threads=4: 220 passed, 1 failed, 2 ignored; SKIPPED: shader_cache_session::tests::rejected_create_shader_cache_session_falls_back_to_working_in_memory_session (no GPU). hle::d3d12x::bind::tests::execute_indirect_reads_the_arguments_written_before_it fails 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 stack
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on d41c111: 1263 passed, 6 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 tests test_title_runs_and_game_folder_is_untouched and test_title_draws_with_a_root_signature_under_the_debug_layer, which fail on main on this machine too; hle::d3d12x::list_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list and hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory failed in this whole-suite run and passed alone (3 of 3 runs); they fail the same way in some whole-suite runs of the first branch of the stack, which runs no new code, and the second one on a main run on this machine. SKIPPED: the six per-lane cases of f16_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

  • No runtime code runs differently: the new module is not called yet.

scripts/smoke.ps1, 60 s, release builds, the same title on the same day.

main:

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: AMD Radeon RX 6700 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 770 (PresentX 771)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19836 MB

PR:

xcl-smoke v1
commit: d41c11103039e92918d59a7ccc16407ed2a83ad8
gpu: AMD Radeon RX 6700 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 761 (PresentX 761)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19359 MB

Not tested

  • Reading a capture written by a build with other windows crate structure layouts (the manifest keeps their bytes).

AI use

  • Claude Code. Claude Fable 5.2 wrote the code, the tests and this description, and ran the tests listed above. Claude Opus 5.5 coordinated the work and ran the game checks.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant