Skip to content

D3D12.X (nvidia-dev): XCL_TWO_PASS_BATCH=1 makes world frames 8.5 % shorter on an RTX 3090; worth turning on by default? #3117

Done

Description

@afpruivo

On an RTX 3090, XCL_TWO_PASS_BATCH=1 takes the retail title's world frame from 149.6 to 136.9 ms on average (3 runs each, interleaved; every batched run was faster than every default run), with no device removal or crash in 700 s. The frame is bound by the direct queue, and the switch takes about 13 ms off it, all from the two-pass mesh draws. The switch is 5506ab14 (@theaustinayers, in nvidia-dev through an integration merge), opt-in so that "off records exactly what it did before". I haven't found a measurement of it in play, so here is one.

Setup: RTX 3090 24 GB, NVIDIA 621.40, i5-13600K, Windows 11 26300, release. Tree nvidia-dev 54225f58 + #609 + #2551 (+ local profiling hooks: they only read out the stamps XCL_GPU_TIMES already records). XCL_DIRECT_DXIL=1 XCL_UMA_DRIVER=mixed:1536:1792 XCL_TEXTURE_LEVEL_PAGES=1, XCL_PRESS_HOLD=3.5, A every 4 s, 700 s per run, XCL_GPU_TIMES=16,420 (16 frames from 420 s after the first present). Warm caches.

Why the direct queue: from the per-call stamps, over 16 frames the direct queue is busy 141.9 ms of a ~145 ms frame, with 1.6 ms idle between its submits; the compute queue is busy 21.5 ms and overlaps. On the direct queue, the top 40 programs are mesh two-pass draws 44.4 ms, wave32 compute 25.2 ms, split wave64 compute 12.0 ms, plain graphics 3.0 ms. That matches the 5506ab14 message (RTX 5090: two-pass draws ~114 of 195 ms, the cost being the barriers between the passes, not the shaders).

run (in this order) arm frame (wall, mean of 16) direct queue busy frames shown in 700 s
1 default 148.3 ms 141.9 ms 5,880
2 XCL_TWO_PASS_BATCH=1 136.4 ms 126.9 ms 6,223
3 default 150.3 ms 142.9 ms 5,864
4 XCL_TWO_PASS_BATCH=1 131.1 ms 125.6 ms 6,349
5 default 150.2 ms 139.3 ms 5,974
6 XCL_TWO_PASS_BATCH=1 143.2 ms 133.2 ms 6,150
default, mean 149.6 ms 141.4 ms 5,906
batch, mean 136.9 ms 128.6 ms 6,241

In run 2, mesh two-pass time in the direct top 40 went from 44.4 to 33.0 ms. One extra run with XCL_TWO_PASS_BATCH=2 gave 137.5 ms, no better than 1.

Not tested: whether the picture is the same. This tree is black in the world without #2229, so I can't compare frames, and I haven't checked output equality. Also: other GPUs, AMD, lower memory (the batched records take twice the buffer), and the test suite with the switch on. Those are what someone should check before it becomes the default.

AI use: Claude Code (Claude Opus 5.5) ran the runs, read the stamps and drafted this; I checked the numbers against the logs.

Activity

  1. KDenKC commented on Nov 28, 2026

    @KDenKC
    Contributor

    A caution for "on by default" from an RTX 5090: on our setup, batching at the default two-pass cap loses work that the unbatched run draws, so a shorter frame there is partly missing geometry. With the cap raised the losses go away, and so does most of the gain.

    Setup: RTX 5090 32 GB, NVIDIA 621.24, the retail title, release, XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16, mixed UMA, a lit in-world scene, no crash or device removal in any run. One binary for all rows: a local integration line on the former nvidia-dev with #3179 (not a clean branch). One run per row; the two-pass status line at the end of each run:

    XCL_TWO_PASS_BATCH cap buffers "not made past" the cap indirect commands clamped (groups dropped) waits timed out draws per present (median)
    unset default (1,787 MiB) 0 306 (152 k) 0 4,760
    1 default (1,717 MiB) 1,962,837 7,176 (2.52 M) 9,138 4,284
    2 default (1,474 MiB) 3,427,459 9,883 (1.72 M) 11,201 3,895
    2, XCL_TWO_PASS_BATCH_MB=32 default (1,696 MiB) 759,275 3,271 (0.97 M) 3,554 –
    2, XCL_TWO_PASS_MB=4096 4,096 MiB 0 195 (14.7 k) 0 –

    What the counters mean (read from bind.rs, not measured): "not made" counts final refusals of a record or argument-scratch buffer at the cap; a refused immediate draw is skipped. "Clamped" commands still run, without their tail groups. =1 holds twice the record bytes per list (the halves) and =2 adds a 128 MiB batch buffer per deferring list, and all of it competes for the same cap, which by default is a quarter of the local video-memory headroom.

    What we can and can't say

    • With the cap at 4,096 MiB, =2 refuses nothing. Its two-pass time was then 66.4 ms a frame against 66.2 ms unbatched in another run, but those two runs did not cover the same stretch of the scene, so we have no clean frame-time comparison on this card and make no speed claim either way.
    • The counters do not say how many distinct draws were lost or whether it was visible; draws per present fell 10 % and 18 % in the two default-cap rows.
    • 4,096 MiB fits a 32 GB card (peak local video memory 27.4 GB). It is not an answer for 16 GB cards.

    So before a default: a batched run should show 0 not made on the cards it is meant for, or the batch buffers should be counted against the cap before they are taken.

    Not tested: the clean branch; main; more than one run per row; AMD.

    AI use: an agent swarm: Claude Fable 5.2, Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon.

  2. afpruivo commented on Nov 29, 2026

    @afpruivo
    Author

    @KDenKC is right, and it holds on the RTX 3090 too: the gain I reported here comes from work that batching drops at the default cap. With the cap raised so nothing is dropped, XCL_TWO_PASS_BATCH=1 is no faster than the default. I withdraw the "on by default" suggestion.

    Setup: the same tree as my first post: nvidia-dev 54225f58 + #609 + #2551 (+ local profiling hooks), RTX 3090 24 GB, NVIDIA 621.40, the same settings and save, 700 s per run, warm caches. The frame rate is presents per second averaged over 420–700 s, and draws are per present over the same span. The two-pass line is the one each run ends with.

    run XCL_TWO_PASS_BATCH cap fps draws per present "not made past" the cap indirect cmds clamped (groups dropped) waits timed out
    nd1 unset default (1,469 MiB) 6.94 4,682 20,030 401 (229 k) 158
    nb1 1 default (1,270 MiB) 7.72 3,602 4,577,444 19,853 (4.90 M) 17,001
    nd2 unset default (1,396 MiB) 6.90 4,683 47,257 626 (254 k) 371
    nb2 1 default (1,341 MiB) 7.73 3,510 4,308,953 20,365 (10.8 M) 16,778
    nbc 1 XCL_TWO_PASS_MB=3072 6.94 4,656 2,671 280 (73 k) 35
    • At the default cap, batching refuses about 100 to 200 times more buffers and draws about 24 % fewer draws per present. The 11 % higher frame rate goes with that.
    • At 3,072 MiB it refuses less than the unbatched default does, draws the same per present, and runs at the same 6.94 fps.
    • Note that the unbatched default also refuses 20–47 k buffers and drops 230–250 k groups on this card. So a default run isn't loss-free either. That is a separate question from batching.
    • No device removal or crash in any run.

    So, as KDenKC says, the batch buffers would have to count against the cap (or the cap be raised where memory allows) before batching could be on by default, and then there's no measured gain left on this card. I'm leaving the issue open in case a maintainer wants it kept for the cap accounting; otherwise it can be closed.

    Not tested: main (on this card main 7db2f391 doesn't reach the world yet, see #2088); XCL_TWO_PASS_BATCH=2; more than two runs per arm (the default-cap and raised-cap rows are one run each, nbc only one).

    AI use: Claude Code (Claude Opus 5.5) ran the runs and wrote and posted this overnight on my standing go-ahead; I haven't reviewed this text yet.

  3. afpruivo commented on Dec 1, 2026

    @afpruivo
    Author

    Closing: withdrawn, as the 3090 A/B above showed the frame-time gain came from work the batch left out, not from faster work.

    AI use: Claude Code (Claude Opus 5.5) closed this on my request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions