Skip to content

Integration branch measured on an RTX 3080 Ti: copy compare, ray tracing off, GPU timing of our own passes - #465

Closed
LeonardoS11 wants to merge 22 commits into
fxceless:mainfrom
LeonardoS11:port/xcl
Closed

LeonardoS11 wants to merge 22 commits into
fxceless:mainfrom
LeonardoS11:port/xcl

Conversation

@LeonardoS11

@LeonardoS11 LeonardoS11 commented Nov 25, 2026 •

Copy link
Copy Markdown

Integration branch measured on an NVIDIA card, opened as a draft for discussion: it bundles other contributors' open PRs with new changes, so it is not meant to be merged as one piece. The new parts can be split into small PRs (list at the end).

What is in it

Other people's open PRs, cherry-picked unchanged with their authors (nothing to review here, only measured together): #191, #154, #175, #177, #186, #158, #194, #169.

New in this branch:

  • VICTORY_COPY_COMPARE=1 (shadow.rs, host.rs): a refresh reads the written range and puts in / sends up only the 4 KiB pieces whose bytes changed.
  • VICTORY_RT_OFF (apps/victory/src/rt_off.rs, pipeline.rs): the ray-tracing passes' pipelines (1,052 shaders found by name in the title's shader archive) are not built and their draws/dispatches do not run. On by default in this branch; for upstream it should be opt-in.
  • VICTORY_GPU_TIMING keeps command notes without DRED (it logged commands=0) and times the layer's own passes as ours: indirect / prelude-* / card.
  • Host::card_back fetches the pieces of all flights settled together with one wait (VICTORY_CARD_BATCH=0: as before).
  • VICTORY_RELAY_COPY_QUEUE=1: the relay's fetches on a copy queue of its own (off by default; no measured gain, see below).
  • R11G11B10_FLOAT stands in for R9G9B9E5 targets the host refuses (Series S profile on NVIDIA).
  • Diagnostics-only counters (list preludes, indirect executions, refreshes) and shader-info --verbose printing the runtime's hash.

Tested

  • Windows 11, NVIDIA RTX 3080 Ti 12 GB (32-lane waves), 64 GB RAM, title and cache on NVMe, diag profile with diagnostics.
  • cargo test --workspace -j 10 at 0d86f22 (everything but the last commit): 516 passed, 0 failed, 9 ignored. The last commit (e220136, the R9G9B9E5 stand-in) was built and run in the title but not through the GPU tests.
  • Method: one checkpoint in the prologue, the scene standing still (about 4,950 draws a frame), average of the last 8 per-frame log lines of a 250 s run. Two runs of the same configuration differed by up to 13 % (283 and 320 ms), so only larger differences are claimed.
Configuration (all Series X) ms/frame "on the GPU"
main 2119b0e, defaults, same save (not the still scene) 470–1200 250–410
+ #191 #154 #175 #177 #186 #158 #194, VICTORY_RELAY=2 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024 285–328 179
+ VICTORY_COPY_COMPARE=1, ray tracing off 253–272 153–169
same without the relay (synchronous) 332 194

Per change:

  • Copy compare: the title "writes" 117–122 MB a frame in the still scene, 104–109 MB of it the same bytes as before. Sent up per frame 82–87 MB → 7.5–12 MB; "on the GPU" 177 → 147 ms; frame 320 → 292 ms (same configuration otherwise). Costs about 15 ms of CPU in "copies" (58 → 75 ms).
  • Ray tracing off: "on the GPU" 163 → 133 ms, frame 283 → 238 ms. The name rule and the hash list (VICTORY_SKIP_PIPELINES) gave the same result (269 vs 267 ms, same draw count).
  • Card buffer limits 1 / 1024: shader writes looked for on the CPU 349 → 21.5 MB a frame.
  • Scope title memory mapping locks to affected ranges #175 on this card: "waiting for title memory to hold still" in texture refreshes 170–230 ms → 0.0 ms a frame.
  • card_back in one fetch: waits for the card to fetch changed pieces 94.4 → 11.5 ms a frame (the two runs fetched different amounts: 25 MB and 2.2 MB).
  • Relay copy queue: "copying back" 162 → 84 ms on the relay thread, frame unchanged within noise; left off.
  • GPU time by command (timing run, still scene): 172 ms a frame, of it ours: 61–68 ms (indirect clamp 31–35 ms in 1,930–4,475 commands, preludes 11–26 ms, card compare 13 ms), the title's indirect draws 66–68 ms in about 4,500, its dispatches 30–34 ms. With VICTORY_INDIRECT_WINDOW=1 the clamps fall from 4,475 to 1,930 a frame and their time stays at 35 ms.
  • Counters: 0 of about 5,100 indirect executions a frame follow another with the same state (no multi-draw to be had); they come in 33 stretches between dispatches; 705 have no dispatch before them in their list.
  • a803c87 (textures looked at again after upload) confirmed by eye on this card: characters' models and textures load.

Known defects / not tested

  • Series S profile: with the R9G9B9E5 stand-in the device is no longer removed and the world is reached (201–260 ms a frame, 1280×720), but the picture is black (it fades out over about 6 frames on entering the world). Not fixed here.
  • VICTORY_INDIRECT_CLAMP=0 (Refuse VICTORY_INDIRECT_CLAMP=0: it kills the run, and hoisting is the answer to the cost #169) crashes the title while loading on this card (write to null); the clamp is needed here.
  • Lighting in shadow is missing as on main, and more so with the ray-tracing passes off.
  • The opening video plays back and forth (frames out of order) on this card; cause not looked into.
  • AMD and Intel cards, Windows 10, anything past the prologue checkpoint.
  • With the 12 GB card the log still says "textures picked by index: the card has no room for more; they wait".

AI use

Claude Code (Claude Fable 5.2 and Claude Opus 5.5): wrote the new changes, ran the measurements and wrote this description. Run in the title by the author on the hardware above.

Proposed split

  1. VICTORY_COPY_COMPARE alone on main (68 lines).
  2. VICTORY_GPU_TIMING fix + ours: timing.
  3. card_back in one fetch.
  4. VICTORY_RT_OFF, opt-in.
  5. Default card buffer limits, with the numbers above.
  6. R9G9B9E5 stand-in, once the Series S picture is right.

gdawid9407 and others added 22 commits November 24, 2026 19:33
…alone logged commands=0; the core of upstream #1735)
…th one wait (VICTORY_CARD_BATCH=0: one each, as before)
…atch, list preludes and the card compare (ours: ...)
…es changed (written-but-same pages are not sent up)
…elines, found by name in shaders.rpf, in every build

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… clamping

THE BUG.
Every ExecuteIndirect call (even when batched via VICTORY_INDIRECT_WINDOW=1) runs a clamp compute shader between two global UAV barriers and state transitions and invalidates cached host compute pipeline/root-signature state.

WHY NOT HYPOTHETICAL.
In gameplay, thousands of indirect mesh draws per frame pay compute/graphics mode switches, scratch-buffer copies, barrier stalls, and state rebinds even when the title argument buffers are already valid.

THE FIX.
Add VICTORY_INDIRECT_CLAMP (enabled by default; 0/false/no/off disables clamping). When disabled, draw::State::indirect validates record alignment/stride via indirect::validate_layout, refreshes the argument/count shadow ranges, emits a single UAV barrier (indirect::wait_direct), and executes ExecuteIndirect directly from the title argument buffer without running the clamp shader, scratch copy, state transitions, or pipeline invalidation.

SCOPE.
Only the indirect argument clamping path in indirect.rs and draw.rs. Default behavior (clamping enabled) is unchanged.
…n copies by size) and of indirect executions with the same state back to back; timing names preludes by what they do

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ut VICTORY_LATE; prelude timing names that survive the command key

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in their list, and stretches of indirect draws between dispatches

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inct 64 KiB pages, 4 KiB pages per written 64 KiB page, pages flagged after our own copy-backs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	crates/victory-gpu/src/resource.rs
#	crates/victory-gpu/src/shadow.rs
…ws the host refuses (Series S); diagnostics count why indirect calls miss the clamp window

Co-Authored-By: Claude Opus 5.5 <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.

9 participants