D3D12.X: the present copy is XCL's own work and does not look again #1066
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by iggyvilla on 2026-11-24T11:19:49Z.
present_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:f44cc79f44cc79+ this commitrefreshreached 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.Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-24T11:27:35Z.
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
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-24T11:45:48Z.
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.
Imported from ivall/xcl. Originally posted by thaqiart139-alt on 2026-11-24T22:49:06Z.
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
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:51:24Z.
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!
Imported from ivall/xcl. Originally posted by S1m0ne1997 on 2026-11-25T14:30:58Z.
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.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:42:05Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T01:53:49Z.
Triage note: this no longer merges with current
main(mergeable=false), so it cannot be built or tested as it stands.Why I am asking rather than just noting it: we have run fifteen mergeable candidates on the retail title on an RTX 5070 Ti, and every one still stops presenting at 50–80 s (device removed, surfacing ~88 s later on the next allocation). The PRs whose descriptions actually match that symptom are the ones that no longer apply — this is one of them. A rebase would make it testable again, and we will run it and report the numbers.
If it has been superseded by merged work, saying so is enough and it can be closed.
AI use: an agent posted this triage note.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:45:48Z.
Triage (#1607) – head
0f77bf1On main, present.rs:present_now no longer calls
q.ExecuteCommandListsfor the present copy: sincec3d701a("D3D12.X: call native queue slots for internal work") it callssuper::real::native_queue_execute, which goes straight to the PC queue slot and never reachesq_execute_command_lists, so the title-texture look before the copy is already gone. This PR also conflicts with main.What main does not have from this PR: the look is still skipped when
srcis a texture kept in step, andvram::before_executeis not called before the copy. If either of those matters, a rebased PR againstnative_queue_executewould be the place for it.Recommendation: close (superseded by main commit
c3d701a).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:42:30Z.
Closing as superseded: this change is already on
main(c3d701a). main present.rs present copy goes through real::native_queue_execute (PC queue slot,c3d701a), so it skips the title_textures look; only the extra before_execute wait on the queue is not mirrored (native slot path used by all other own work)Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed