Skip to content

Renderer port 1: on in both halves by default (the 174 MB heap was "Scattered" and stayed a copy in every default run) - #3399

Closed
Revono wants to merge 1 commit into
trustno1-coder:mainfrom
Revono:fix/renderer-port-on-in-both-halves
Closed

Revono wants to merge 1 commit into
trustno1-coder:mainfrom
Revono:fix/renderer-port-on-in-both-halves

Conversation

@Revono

@Revono Revono commented Nov 29, 2026

Copy link
Copy Markdown

No issue filed for this; found while asking why the submitting thread still refreshed the title's 174 MB buffer 17 times a frame.

What it changes

Renderer port 1 has two halves. victory-gpu's port opens the title's 32-bit graphics heap as a host heap and uses it in place. victory-hle's xmem::arrange first gives that heap's pages their section's slices in address order, because the title maps its five pieces in another order than their addresses and a heap can only be opened on one stretch of a section.

Since e4860eb (#1223) the GPU half is on by default except on Ampere cards. xmem went on reading the switch itself and was on only for VICTORY_PORT_CONSTANTS=1, which no launcher sets. So in a default run on any card but an RTX 30 the pages stayed as the title maps them, the GPU half found the heap not one native-import-eligible stretch of a section: Scattered and left it a copy, with one warning and nothing else to show for it.

  • victory_gpu::title_graphics_heap_in_place(): the port's one answer, public.
  • xmem::port_on asks it, and its own parsing of the switch is gone, so the two halves cannot differ. VICTORY_PORT_CONSTANTS=0 and =1 and the Ampere default behave as the GPU half already had them.
  • The refusal's line also says how the views lie (inplace::scatter): 3 views of 1 sections in 2 runs, the longest 150528 KiB: [0x10e20000+0x1b00000 section 0x13c4@0x9e00000, 0x12920000+0x9300000 section 0x13c4@0x0]. That line is what named the cause.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): RTX 4070 Ti SUPER 16 GB, Series X, 2560x1440, DLSS performance, DLSS frame generation 2x, ray tracing off. The same save, standing in the world by day.
  • Before (default run): renderer port 1: title memory not in place, a copy as before ... Scattered and 0 regions of the title's graphics memory in place (0 MB). Submitting thread 33.8 ms in its submissions, the card idle 10.9 ms behind it (76 % busy), 45 ms a frame. A diagnostics run of the same build shows the buffer copied from 0x165d0000+0xae00000: 17.4x/frame, 3173.91 MB/frame.
  • After (VICTORY_PORT_CONSTANTS=1 set by hand on the same build, which is the state the default now has): the title's 32-bit graphics pages given their section's slices in address order for all five pieces (not_fresh=0), a stretch of the title's graphics memory opened as a host heap through a view of ours ... bytes=193986560, 1 regions ... in place (185 MB). Submitting thread 25.7 ms in its submissions, the card idle 2.7 ms (93 % busy), 43 ms a frame. The card is the limit there now, so the frame gains 2 ms on this PC; a PC whose card has room should gain more.
  • Not run: the default itself after this change in the title (the run above forced the switch), and no Ampere or AMD card.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): no shader change.
  • cargo test passed for the crates it touches: cargo test -p victory-gpu --locked --lib port:: (4 passed) and inplace:: (9 passed). cargo test -p victory-hle --locked --lib xmem: 45 passed, 1 failed, and it is the same one that fails on main without this change when the module's tests run together (a_read_by_range_waits_only_for_a_remapping_that_meets_it; it passes alone). cargo xtask policy --staged: asset policy: 4 files ok.
  • cargo clippy ... -D warnings stops in victory-shader on main as it is; without -D warnings this change adds no warning.

Checked for overlap

…d" and stayed a copy in every default run)

The port has two halves. This side (`victory-gpu`'s `port`) opens the
title's 32-bit graphics heap as a host heap and uses it in place; xmem's
`arrange` gives that heap's pages their section's slices in address order
first, because the title maps its five pieces in another order than their
addresses and a heap can only be opened on one stretch of a section.

Since e4860eb (trustno1-coder#1223) this side is on by default except on Ampere cards.
xmem went on reading the switch itself and was on only for
`VICTORY_PORT_CONSTANTS=1`, which no launcher sets. So in a default run the
pages stayed as the title maps them, this side found the heap "not one
native-import-eligible stretch of a section: Scattered" and left it a
copy, with one warning and nothing else to show for it.

xmem now asks this side (`victory_gpu::title_graphics_heap_in_place`), so
the two cannot differ.

RTX 4070 Ti SUPER, Series X profile, 2560x1440 with DLSS performance and
frame generation 2x, the same save, standing in the world, 2026-11-29:

- before: "0 regions of the title's graphics memory in place"; the
  submitting thread 33.8 ms in its submissions, the card idle 10.9 ms
  behind it (76 % busy), 45 ms a frame
- after (the switch set by hand, which is what the default now does):
  "1 regions ... in place (185 MB)"; 25.7 ms in its submissions, the card
  idle 2.7 ms (93 % busy), 43 ms a frame. The card is the limit there now.

The refusal's line also says how the views lie ("3 views of 1 sections in
2 runs, the longest 150528 KiB: [...]"): that is what named the cause.
@github-actions github-actions Bot added the pr-fix Pull request: fixes a bug label Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix] Renderer port 1: on in both halves by default (the 174 MB heap was "Scattered" and stayed a copy in every default run) Renderer port 1: on in both halves by default (the 174 MB heap was "Scattered" and stayed a copy in every default run) Nov 29, 2026
@Revono
Revono marked this pull request as draft November 29, 2026 22:58
@Revono

Revono commented Nov 29, 2026

Copy link
Copy Markdown
Author

Closing this myself: a controlled comparison shows the change would be a loss on this card, and the gain in the description came from one favourable moment, not from a like-for-like run.

Same build, same save, standing still by day, RTX 4070 Ti SUPER 16 GB, Series X, 2560x1440, DLSS performance, frame generation 2x, 25 one-second windows each:

VICTORY_PORT_CONSTANTS=1 (port really on) VICTORY_PORT_CONSTANTS=0
frame time (median of the windows) about 61 ms about 42 ms
card time in the title's lists about 52 ms about 31 ms
submitting thread, in its submissions about 32 ms about 35 ms

So with the heap in place the submitting thread saves a few ms and the card loses about 20: the heap is the PC's memory then, and the shaders' reads of it cross the bus (what docs/unified-memory-audit.md 3.3 says of discrete cards).

What still stands from the description, and may be worth a look on its own:

If the two halves should agree, the numbers above argue for agreeing on off for discrete cards with their own memory, or for deciding it from a measurement per host, not for this change. The inplace::scatter line that says how the views lie could go in separately if it is wanted.

@Revono Revono closed this Nov 29, 2026
moritz-eckhard-nickel added a commit to moritz-eckhard-nickel/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…lves by default (the 174 MB heap was "Scattered" and stayed a copy in every default run)

trustno1-coder#3399 by Revono, head f922674.
PranThow pushed a commit to PranThow/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
With both halves asking one answer, an unset switch would have turned the
port on in every run on any card but an RTX 30 one, where before nothing
was placed (xmem left the heap scattered). It was measured faster only on
AMD: on an RX 7900 XTX a frame of 45 ms became 37. On NVIDIA it was
measured slower: an RTX 4070 Ti SUPER 61 ms a frame against 42 with it off
(trustno1-coder#3399, closed by its author for that), an RTX 5080 Laptop GPU 136 to 178
ms of card time a frame against 18 to 27 (trustno1-coder#2923). Intel was not measured.

So unset is on where the host device's card is AMD's (vendor 0x1002) and
off on any other, which is what default runs there did; 1 and 0 still say.
The card's vendor is in the line that says whether the port is on. The F1
menu's AUTO says ON AMD CARDS. The Ampere name list goes: off is the
default for every card that is not AMD's.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-fix Pull request: fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant