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
github-bot wants to merge 1 commit from github-bot/gh-3399 into main AGit
Owner

@⁠Revono on GitHub · 2026-11-29 22:47 UTC · original
Revono:fix/renderer-port-on-in-both-halves → main · +62 −14 · 4 files · 1 commits · closed without merging

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 e4860ebc (#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

  • I searched the open pull requests for the same issue and for the files this touches. Related: #2455 (the port's heap under Wine, VICTORY_PORT_HOME) and #3109 (15 lines in port.rs for the submit steps) touch the port without changing which half is on; #3396 is the other port (VICTORY_PORT_CBV). No open pull request names VICTORY_PORT_CONSTANTS or arrange.
**@⁠Revono** on GitHub · 2026-11-29 22:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3399) `Revono:fix/renderer-port-on-in-both-halves` → `main` · +62 −14 · 4 files · 1 commits · closed without merging 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 e4860ebc (#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 - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #2455 (the port's heap under Wine, `VICTORY_PORT_HOME`) and #3109 (15 lines in `port.rs` for the submit steps) touch the port without changing which half is on; #3396 is the other port (`VICTORY_PORT_CBV`). No open pull request names `VICTORY_PORT_CONSTANTS` or `arrange`.
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 e4860ebc (#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-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 22:52:13 +00:00
github-bot closed this pull request 2026-11-29 23:04:17 +00:00
Author
Owner

@⁠Revono on GitHub · 2026-11-29 23:01 UTC · original

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:

  • In a default run (switch unset) on a card that is not Ampere, the GPU half of the port is on and xmem's half is off, so arrange never runs, the heap is found Scattered and stays a copy. The port does not take by default, whatever the default was meant to be since #1223.
  • On this PC that accident is the fast path. Making the two halves agree by turning xmem's half on, as this did, would turn the port on for every such card.

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** on GitHub · 2026-11-29 23:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3399#issuecomment-7264129974) 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: - In a default run (switch unset) on a card that is not Ampere, the GPU half of the port is on and `xmem`'s half is off, so `arrange` never runs, the heap is found `Scattered` and stays a copy. The port does not take by default, whatever the default was meant to be since #1223. - On this PC that accident is the fast path. Making the two halves agree by turning `xmem`'s half on, as this did, would turn the port on for every such card. 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.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3399
No description provided.