D3D12.X: the present copy is XCL's own work and does not look again #1075
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1075
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1075"
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?
@iggyvilla on GitHub · 2026-11-24 11:19 UTC · original
iggyvilla:xcl-present-own-work→main· +20 −2 · 2 files · 1 commits · openpresent_now(crates/xcl/src/hle/d3d12x/present.rs) submits its copy to the swap chain withq.ExecuteCommandLists, which is XCL's own hook. So it came back intoq_execute_command_lists→title_textures::refreshoutsideown_work. As a result, every presented frame paid a second full look at the title's memory:GetWriteWatchover every watched range, then a hash of each dirty texture. That look is only for the title's own work. The copy is now submitted asown_work, the same way XCL's texture uploads are.Why skipping that look can't miss a write the present needs: the copy reads only the presented resource.
vram::place) and are not kept in step with title memory, so no look could bring a CPU write to them.GetWriteWatchresets its bits only during a look. It is uploaded before the title's nextExecuteCommandLists, which is the first work that can read it.title_textures::addressknows it) still gets the look, as before.vram::before_execute). The copy now calls that itself insideown_work, as XCL's other own-work submits do, so skipping the look never skips that wait.sparse::before_execute(CPU writes into mapped sparse tiles) andrecheck_gpu_view_sources. The copy skips both; the title's nextExecuteCommandListsruns them. The copy reads only the presented resource, which is either GPU-owned (vram::place, no sparse window) or kept in step (it then gets the look). That no title presents a sparse-window resource that is not kept in step is a hypothesis, not measured.Conflicts with open PRs: #674 (triple-buffer
Presenter) and #711 (draft, its 2-buffer subset) change the sameq.ExecuteCommandListsline inpresent.rs(they move it intopresent_frame_on). Whichever lands second re-applies this wrapper: keep theirpresent_frame_onandp.queue, and wrap only theExecuteCommandListsin theown_workconditional (aftervram::before_execute); the meaning is the same. No code dependency on #693, #455, #562 or #786.What is in it
crates/xcl/src/hle/d3d12x/present.rs: the copy'sExecuteCommandListsruns insidetitle_textures::own_workunless the presented resource is kept in step, aftervram::before_execute(+13/−1).crates/xcl/src/hle/d3d12x/title_textures.rs:gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesnow also checks that a refresh insideown_workuploads nothing, and that the next refresh uploads the write. That is the rule the change relies on. The test checks existing behaviour, so it passes without thepresent.rschange too. Testing the present path itself would need a window and a swap chain.Tested
AMD Radeon RX 6650 XT (RDNA2), driver 32.0.21045.29003, Ryzen 7 5700X, Windows 10.0.26300, rustc 1.100.0. Debug for the tests; release for the smoke runs (with
CARGO_PROFILE_RELEASE_DEBUG=1for the profiles).cargo test --workspace --no-fail-fast -- --test-threads=4on0f77bf1: 724 passed, 3 failed, 41 ignored, 0 SKIPPED. The 3 failures are the ones already onmain:placed_title_textures_share_vram_and_preserve_pixelsalso fails on its own. It is the packed-mip bug that #470 fixes.transitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memorypass on their own. In the full run they fail fromPoisonErrorafter the first failure; #673 fixes that.Submit-thread profile of a retail title past the account prompt: a 20 s sample at 125 s, the same steps on both builds (taken on
1d22c03, before adding thevram::before_executewait):mainbefore #693 (merged asde1809c), the render thread'sVirtualQueryingpu_vawas the limit. The submit thread wasn't among the two busiest threads, so this profile was taken on #693's head (f44cc79), with and without this commit. It predates the rebase onto the currentmain; I did not repeat it. There is no code dependency on #693:refreshreached frompresent_now(hash +GetWriteWatch+VirtualQuery)mainbase alone (dd2ae9aagainst 1d22c03), one run each gave 5.8 and 7.1 fps. That is within this title's run-to-run noise.Regression run
The title's first minute varies a lot between runs on this machine (earlier runs gave 300 to 1500 frames); these eight runs all landed in the same mode. After an unmeasured warm-up of each build, with no other build or title run on the machine, the runs alternated: head 446,
main449,main446, head 447 frames; no device removals or crashes. The second pair is shown.main:This PR:
Not tested
mainalone: there, the render thread hides it.AI use
claude-opus-5-5): wrote the change, the test, the initial profiles, and the initial PR description.4d0a00a, verifiedscripts/pr_check.py --local, and updated this description.claude-sonnet-5-5): rebased the branch ontomain6efdabc, reran the suite and the smoke runs above on0f77bf1, and updated this description.@fromthemoonx on GitHub · 2026-11-24 11:27 UTC · original
NVIDIA run, since Not tested lists NVIDIA.
Tested
stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug0f77bf18498dae6497b539db2b5ded8ed96a744d(on its base6efdabc), clean worktree:cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4: 727 passed, 0 failed, 41 ignored (lib 685 / 0 / 21)main47efa2e(no conflict): the same command gives 741 passed, 0 failed, 41 ignoredPresentXine2e.cargo test -p xcl --test e2e -- --test-threads=1on the merged tree, 10 runs: 10 of 10 passed (test_title_runs_and_game_folder_is_untouched,test_title_draws_with_a_root_signature_under_the_debug_layer, and the third e2e test).XCL_D3D12_DEBUG=1run logs the same set of debug-layer errors and warnings on the merged tree as onmain. Nothing new from submitting the present copy asown_work.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareXCL_SAMPLE_*not setNot tested
title_textures::refresh, and there's no retail title. So the second look per present going away is not measured on this machine.AI use
@thehollowedone on GitHub · 2026-11-24 11:45 UTC · original
I measured the actual windowed PresentX copy at 0f77bf1 on Windows 11 with an RTX 3080 Ti (621.35) and Graphics Tools. I used the stock synthetic title with a scratch counter after the refresh guard and another after the write-watch scan.
For its direct PresentX copy from a DEFAULT render target, restoring the old submit path in the same binary gave one refresh and one write-watch scan. The PR path gave zero of each. Both runs passed the debug-layer e2e test and logged the same D3D12 message IDs and counts. Neither reported device removal.
This measures scan count for the synthetic render target. It leaves CPU time and the path for textures kept in step with title memory unmeasured. AI-assisted. Codex (GPT-6) added the scratch counters and ran the comparison.
@thaqiart139-alt on GitHub · 2026-11-24 22:49 UTC · original
Test report for this PR's head
0f77bf1, merged intomain689f2db(no conflicts), on AMD RDNA2 with native 64-lane waves and on a 32-lane NVIDIA card.Tested
XCL_ADAPTER.cargo test --workspace --no-fail-fast -- --test-threads=4:main689f2dbmain, from #1679's new fuzz tests, and both are already reported on #1679:fuzz_validate_and_gpu_0to_3(CreateComputePipelineState:0x8007000E)fuzz_validate_and_gpu_1(seed 540: res[833] = 0x7, CPU 0x6)mainpass here on both GPUs, onmainand with this PR:placed_title_textures_share_vram_and_preserve_pixels,transitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory.SKIPPED tests (the same on
mainand with this PR)gpu::recomp::lower::tests:a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpugpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu, and the wave64 cases of itsf16/f32/f64/integer_programs_on_the_gpugpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwarelower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused ("its #1426 semantics differ from the console's")heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode is off)gpu::dxil::geometry_tests::gpu_geometry_direct_records,emitted_ms_primitive_attribute_reaches_the_pixel_shader,emitted_ms_ps_draw_a_triangle,gpu_geometry_mode_es_gs_strip,gpu_geometry_mode_es_gs_strip_with_branches,gpu_mesh_mode_two_passeslower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused, as aboveheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)pso_measurement_compiles_an_exact_synthetic_record(Developer Mode is off)Not tested
AI use
@DavidM1911 on GitHub · 2026-11-25 08:51 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@S1m0ne1997 on GitHub · 2026-11-25 14:30 UTC · original
Test report for
0f77bf18498dae6497b539db2b5ded8ed96a744d(this PR's head), for #1607.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)x86_64-pc-windows-msvc, debug.cargo build --workspace, thencargo test --workspace -- --test-threads=4at the head: 727 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64).Regression run (retail title,
scripts/smoke.ps1 -Seconds 60, release;mainbuilt from the commit in its block, this PR from its head, no uncommitted changes)main:
this PR:
Not tested
AI use: Claude Code with Claude Opus 5.5 ran the build, the suite and the regression run and wrote this report at my request.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.