Repository navigation
D3D12.X: stencil, topology and scissor sets go into deferred two-pass runs - #3036
Conversation
… runs With XCL_TWO_PASS_BATCH=2 a run of deferred two-pass draws was recorded before every title call except the root signature / argument sets, SetPipelineState to a two-pass pipeline, ExecuteIndirect and DispatchMesh. On the retail title we run, OMSetStencilRef ended most runs, then IASetPrimitiveTopology, the console's stub method xcl-dev#142 and RSSetScissorRects (run ends at 533 s: 470,956 / 90,177 / 69,975 / 32,433 of 1,048,576), so runs were 12.7 draws long. OMSetStencilRef, IASetPrimitiveTopology and RSSetScissorRects now go into the run (RunItem / Step / Cmd StencilRef, Topology, Scissors) and are set among the mesh passes where the title made them, so each mesh pass draws with the state of its draw; a run with no draws applies them as they came. The newer layout's xcl-dev#142, which XCL stubs (it records nothing), no longer ends a run. Runs are then 24.3 draws long. Measured on the title (RTX 5070 Ti, timed 480 s runs, one each, same build and env with XCL_TWO_PASS_BATCH=2): 10.2-10.3 fps with runs ended as before, 11.1-11.2 fps with this. Tests: the kept slots, and runs with stencil / topology / scissor sets between draws give each mesh pass the state and order the unbatched path gives it. Co-Authored-By: Antigravity (Gemini 4 Neon) <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent desktop NVIDIA verification of PR #3036 at head Environment
Targeted tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib -- --nocapture state_sets_in_a_run_come_between_the_mesh_passes_in_the_titles_order (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1727 filtered out × 3 (0.00s, 0.00s, 0.00s, 0 skipped) |
cargo test --release -p xcl --lib -- --nocapture hle::d3d12x::bind:: hle::d3d12x::list_x:: (3 consecutive runs) |
104 passed; 0 failed; 0 ignored; 1624 filtered out × 3 (0.88s, 0.89s, 0.91s; 103 executed + 1 self-skipped two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1)) |
cargo build --release -p xcl |
Clean build (2m 05s, exit 0, 0 new warnings in bind.rs or list_x.rs) |
Paired quiet 60 s retail smoke (title: 29640639, XCL_PREPARE=0, XCL_NETWORK=0)
Exact parent & merge-base (a5e2d851a503fc0e04609f773ea53f2d2c4e3269, nvidia-dev ancestor):
xcl-smoke v1
commit: a5e2d851a503fc0e04609f773ea53f2d2c4e3269
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1513 (PresentX 1513)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14868 MB
PR #3036 (6f3ad70ccc22acb777205cdea1d512bf24421299):
xcl-smoke v1
commit: 6f3ad70ccc22acb777205cdea1d512bf24421299
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1587 (PresentX 1587)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14690 MB
Limits of coverage
state_sets_in_a_run_come_between_the_mesh_passes_in_the_titles_order(1/1,0skipped) andhle::d3d12x::bind::+hle::d3d12x::list_x::(103executed +1opt-inXCL_HEAP_WINDOWS=1self-skip) passed3/3, directly verifying thatOMSetStencilRef,IASetPrimitiveTopology, andRSSetScissorRectsqueue into active deferred two-pass runs and replay between mesh passes in title order.- Both smokes were run with
XCL_PREPARE=0andXCL_NETWORK=0(0device removals,0crashes, steady 60 Hz; steady-state memory at ~58.3 s:14603 MBcommitted,6115 MB local,4732 MB non-local); visual correctness of interleaved stencil/topology/scissor state changes in complex in-world scenes was not separately inspected beyond the 60 s startup smoke and unit test.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
|
merge-check base: d1be810 head: 6f3ad70 merge: clean uncommitted trial merge into the current build: tests: review: I traced both changed files. Deferred stencil, topology, and scissor sets replay in title order before the corresponding mesh passes; the compute passes precede them and these setters change graphics state. No new source-level blocker found in this diff. This does not establish visual parity for the author's intermittent obstruction reports. performance: the feature remains off by default. With batching enabled, fewer fixed-state calls force a run flush; I did not measure frame time on this GPU. verdict: not yet: the PR's hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (NVIDIA 621.35), rustc 1.99.1 MSVC; OpenAI Codex (GPT-6.2 Sol) traced the source and ran the three suites. Not tested here: a title run, opt-in batching performance, AMD, Intel, or Wine. |
|
merge-check claim |
|
merge-check |
… runs With XCL_TWO_PASS_BATCH=2 a run of deferred two-pass draws was recorded before every title call except the root signature / argument sets, SetPipelineState to a two-pass pipeline, ExecuteIndirect and DispatchMesh. On the retail title we run, OMSetStencilRef ended most runs, then IASetPrimitiveTopology, the console's stub method #142 and RSSetScissorRects (run ends at 533 s: 470,956 / 90,177 / 69,975 / 32,433 of 1,048,576), so runs were 12.7 draws long. OMSetStencilRef, IASetPrimitiveTopology and RSSetScissorRects now go into the run (RunItem / Step / Cmd StencilRef, Topology, Scissors) and are set among the mesh passes where the title made them, so each mesh pass draws with the state of its draw; a run with no draws applies them as they came. The newer layout's #142, which XCL stubs (it records nothing), no longer ends a run. Runs are then 24.3 draws long. Measured on the title (RTX 5070 Ti, timed 480 s runs, one each, same build and env with XCL_TWO_PASS_BATCH=2): 10.2-10.3 fps with runs ended as before, 11.1-11.2 fps with this. Tests: the kept slots, and runs with stencil / topology / scissor sets between draws give each mesh pass the state and order the unbatched path gives it. Upstream PR #3036 (6f3ad70 on origin/main), cherry-picked: the deferred runs of XCL_TWO_PASS_BATCH=2 go on across these sets on the title run here too. No change to translated shaders. (cherry picked from commit 6f3ad70) Co-Authored-By: Antigravity (Gemini 4 Neon) <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… runs With XCL_TWO_PASS_BATCH=2 a run of deferred two-pass draws was recorded before every title call except the root signature / argument sets, SetPipelineState to a two-pass pipeline, ExecuteIndirect and DispatchMesh. On the retail title we run, OMSetStencilRef ended most runs, then IASetPrimitiveTopology, the console's stub method xcl-dev#142 and RSSetScissorRects (run ends at 533 s: 470,956 / 90,177 / 69,975 / 32,433 of 1,048,576), so runs were 12.7 draws long. OMSetStencilRef, IASetPrimitiveTopology and RSSetScissorRects now go into the run (RunItem / Step / Cmd StencilRef, Topology, Scissors) and are set among the mesh passes where the title made them, so each mesh pass draws with the state of its draw; a run with no draws applies them as they came. The newer layout's xcl-dev#142, which XCL stubs (it records nothing), no longer ends a run. Runs are then 24.3 draws long. Measured on the title (RTX 5070 Ti, timed 480 s runs, one each, same build and env with XCL_TWO_PASS_BATCH=2): 10.2-10.3 fps with runs ended as before, 11.1-11.2 fps with this. Tests: the kept slots, and runs with stencil / topology / scissor sets between draws give each mesh pass the state and order the unbatched path gives it. Upstream PR xcl-dev#3036 (6f3ad70 on origin/main), cherry-picked: the deferred runs of XCL_TWO_PASS_BATCH=2 go on across these sets on the title run here too. No change to translated shaders. (cherry picked from commit 6f3ad70) Co-Authored-By: Antigravity (Gemini 4 Neon) <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With
XCL_TWO_PASS_BATCH=2(off by default) a run of deferred two-pass draws is recorded before nearly every other title call on the list. On the title we run,OMSetStencilRefwas the most frequent single reason a run ended (470,956 of 1,048,576 run ends), ahead of a full batch record buffer (249,518),IASetPrimitiveTopology(90,177), the console's method #142 (69,975; a stub in XCL: it records nothing) andRSSetScissorRects(32,433), so runs were 12.7 draws long. These sets now go into the run and are made among its mesh passes where the title made them; #142 no longer ends a run. Runs are then 24.3 draws long. Nothing changes withoutXCL_TWO_PASS_BATCH=2. Part of #2688.What is in it
hle/d3d12x/bind.rs:RunItem/Step/CmdStencilRef,Topology,Scissors, queued byqueue_stencil_ref,queue_topology,queue_scissorswhile the list defers, and set among the mesh passes in the title's order (batch_commands,emit_commands); a run with no draws applies them as they came (flush_two_pass).keeps_two_pass_batchkeeps slots 20, 22, 24 and the newer layout's 142.hle/d3d12x/list_x.rs: the console'sIASetPrimitiveTopology,OMSetStencilRefandRSSetScissorRectsgo into the run when it takes them (apply_*for the rest).state_sets_in_a_run_come_between_the_mesh_passes_in_the_titles_order(stencil, scissor, topology and empty scissor sets between draws: the mesh passes and sets in the order and with the state the unbatched path gives them, none among the compute passes).Tested
XCL_DXC_DIR.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4on 6f3ad70 (withCARGO_PROFILE_DEV_DEBUG=0: no debug info, for disk space): 1825 passed, 8 failed, 48 ignored. The same command onnvidia-deva5e2d851: 1822 passed, 10 failed, 48 ignored.a5e2d851as well:async_compute_pso_registers_real_pso_and_not_standin,console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly,hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays,hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels,split_compute_prefers_the_offline_whole_pipeline,two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs.SKIPPED: 8 no wave64; 1 const_mask, wave64: no wave64; 1 f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); 1 f16 arithmetic, wave64: no wave64; 1 f32 arithmetic, wave64: no wave64; 1 f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); 1 f16 packed, wave64: no wave64; 1 f32 compares, wave64: no wave64; 1 mask_ff0_flbit, wave64: no wave64; 1 f64, wave64: no wave64; 1 integer arithmetic, wave64: no wave64; 1 f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); 1 f32 conversions, wave64: no wave64; 1 integer carries, wave64: no wave64; 1 f32 rounding, wave64: no wave64; 1 f32 transcendentals, wave64: no wave64; 1 f32 three-source, wave64: no wave64; 1 no heap windows (opt-in: XCL_HEAP_WINDOWS=1); 1 no heap windows.75d9b05e, which has it; without: the same build plus two local switches set to restore the old run ends; same env:XCL_TWO_PASS_BATCH=2,XCL_TWO_PASS_SHARED=1,XCL_UMA_UPLOAD_PRIORITY=1,XCL_VRAM_HOT_PRIORITY=1,XCL_DECLARED_LDS=1,XCL_PER_LANE=1, andXCL_TWO_PASS_INDIRECT_MB=4, a knob of our branch that is not in this PR): 10.2-10.3 fps with the runs ended as before, 11.1-11.2 fps with this change, steady to 526 s, no errors, no device removal. A repeat of both: 10.1 and 10.6 fps. So +0.5 to +0.9 fps over two pairs (run-to-run spread about 0.5 fps). Two-pass compute passes per frame 317 before, 168 with it.75d9b05ewith the same env,XCL_TWO_PASS_BATCH=1ran 6.6-6.7 fps. So mode 2 withnvidia-dev's run ends (on our build, with a 4 MiB indirect reservation wherenvidia-devreserves 32 MiB) was worth about +3.6 fps against mode 1 on this card and title. The default is mode 0 (off).Build and test (Windows, no GPU)is red onnvidia-devitself and on every PR into it, this one included: the lib test process ends with0x887a0020in a sparse test on the runner's software adapter, with no test reported failed. Tests: sparse tests take CI's Basic Render Driver for a software device #2837 fixes that test; nothing here touches it.Regression run
150 s runs, same title, same env (
XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL=all XCL_DIRECT_SPLIT_INSTRUCTIONS=0 XCL_PSO_JOURNAL=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=120000, DXC 1.9); the head withXCL_TWO_PASS_BATCH=2as well (the mode this change acts in). Themainrun from a hard-link copy of our team branch's DXIL cache; the base and head runs from hard-link copies of one cache warmed onnvidia-deva5e2d851(on this branch the title starts after about 75-90 s of startup shader preparation, so 60 s would end inside it).A commit of
main(b49be183, the last one before the shader preparation screen of #2555):The base,
nvidia-deva5e2d851:This PR's head:
Not tested
AI use
nvidia-dev, wrote the new test, ran the suite and the smoke on the hardware above and wrote this description. The timed runs and the picture comparison were run by teammate agents (strange: Claude Code; batman: Codex).🤖 Generated with Claude Code