Skip to content

Renderer port 1 takes effect: both halves ask one switch, unset on AMD cards only (RX 7900 XTX: 45 to 37 ms a frame) - #3859

Open
duckey-dev wants to merge 4 commits into
trustno1-coder:mainfrom
duckey-dev:constants-port-amd
Open

duckey-dev wants to merge 4 commits into
trustno1-coder:mainfrom
duckey-dev:constants-port-amd

Conversation

@duckey-dev

Copy link
Copy Markdown
Contributor

The problem

Renderer port 1 (VICTORY_PORT_CONSTANTS, crates/victory-gpu/src/port.rs) keeps the title's 185 MB 32-bit graphics heap, with its 174 MB constants buffer, in place on the card rather than as a host copy. It has two halves, and they read the switch on their own:

No launcher sets the switch. So in a default run the GPU half asked for a heap that was never laid out for it. It logged "not one stretch of a section: Scattered", left the heap a copy and placed nothing. The port did nothing in any default run, and only one warning line showed it.

The F1 menu row CONSTANTS HEAP IN PLACE had the same kind of fault. Its OFF stored an empty value, which is the same as unset, which is on. So OFF did not turn the port off.

What it changes

  1. One answer. port::on() decides once, from the switch and the host device's card, and logs what it decided: the value it was asked, the card and its vendor. victory_gpu::constants_port_on() passes that answer to other crates.
  2. xmem follows it. arrange runs when VICTORY_XMEM_ADDRESS_ORDER says so (1 always, 0 never). When that is unset it follows constants_port_on(). The switch is read once, at the title's first mapping into a 32-bit graphics reservation. When it is off, the mapping calls do not even look for a reservation, as before. arrange first checks with the page table only read. If every page is already in its place, or no slice is fresh, it returns without taking the write lock. DirectStorage's workers read that table on every request. A new test lays out the heap as the game maps it (two small placeholders, then pieces A, B and C, mapped B first and A last) at a sixteenth of its size. It checks that the views end up as one stretch of the section and that nothing moves once all of it is mapped.
  3. Unset is on for AMD cards only. With both halves asking one answer, an unset switch would have turned the port on for real on every card but an RTX 30. It was measured faster only on AMD, and slower on NVIDIA (see the overlap section). So the default is now on when the host device's card is AMD's (PCI vendor 0x1002) and off on every other card. On those cards nothing changes from what default runs did before, since nothing was placed there. 1 and 0 still force it on or off. The Ampere name list is removed: off is now the default for every card that is not AMD's.
  4. F1 menu. CONSTANTS HEAP IN PLACE has AUTO (unset: on for AMD cards), ON (1) and OFF (0). OFF now really turns the port off.

How it was tested

  • GPU and profile: RX 7900 XTX, Ryzen 7 7800X3D, Windows 11, Series X, no DLSS/FSR, no frame generation, ray tracing off, one fixed indoor scene with the camera still. The runs had VICTORY_PORT_CONSTANTS=1 set, which turned both halves on with the old code. That is what an unset switch now does on an AMD card.
Before: port not in effect (default) After: port in effect
regions in place 0 ("Scattered") 1, 185 MB
frame time 45 ms 36.7 and 37.6 ms (two runs)
card idle per frame about 10 ms 1.8 ms

There were no device losses, and the captured frames looked right. With the port on, the CPU still reads about 9,500 fills a frame out of the in-place memory. These numbers come from one machine and one scene with the camera still. They are not a measurement of play in motion or of other places in the world.

  • cargo test passed for the crates it touches: no failure that main does not have on this machine (victory-gpu's suite was run five times on main and on this branch; main's a_read_by_range_waits_only_for_a_remapping_that_meets_it fails here with or without this change). Both of CI's clippy runs add no warning over main.

Not tested

  • In the game on this exact branch. It is the measured commits on current main plus the AMD-only default (step 3), which is new here and was built and unit-tested but not run in the game. The default path, with the switch unset on an AMD card, should show "renderer port 1 ... on=true" and "1 regions ... in place" in the log.
  • NVIDIA: not run. With this change the default there is off, as default runs were before. VICTORY_PORT_CONSTANTS=1 now turns both halves on, where before it was the only way to do so.
  • Intel: not run. The default there is off.
  • Other AMD generations: only RDNA 3 (RX 7900 XTX) was measured. RDNA 2 and RDNA 4 get the default too.
  • Linux/Wine: not run (see Under Wine: title pages shown with the host's mmap, and renderer port 1's heap opened in place (VICTORY_WINE_MAP, VICTORY_PORT_HOME) #2455).

Checked for overlap

🤖 Generated with Claude Code

duckey-dev and others added 4 commits November 30, 2026 10:22
…ts_port_on)

port::on() decides it once, says so in the log (asked, card, on), and is
what other crates ask through constants_port_on(), so that xmem's half
follows it. The module's docs said "off by default" since trustno1-coder#1223 made it
on unless the card is an Ampere one; they say so now, why the heap was
never one stretch of a section (the title maps the pieces out of address
order and xmem's half was off when the variable was unset), and what a
run with it laid out measured: one region of 185 MB, a frame 45 -> 36.7
and 37.6 ms, the card idle 1.8 ms of a frame instead of 10 (prison,
Series X, RT off, RX 7900 XTX).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t 1 is on (VICTORY_XMEM_ADDRESS_ORDER)

arrange followed VICTORY_PORT_CONSTANTS=1 alone, while the GPU side's port
is on with the variable unset too (trustno1-coder#1223): in a run without it the port
asked for the 185 MB heap, which was three views of its section in a
scattered order, and placed nothing. VICTORY_XMEM_ADDRESS_ORDER: 0 never,
1 always, unset as victory_gpu::constants_port_on() says, asked at the
title's first mapping into a 32-bit graphics reservation and said in the
log. With it 0 the mapping calls look for no reservation, as before.

arrange first looks with the page table only read: when every page has
its place already or no slice of the section is fresh, nothing could
move, and the table is neither locked for writing nor gone through.

A test lays out the heap as the game maps it, at a sixteenth of its size:
two small placeholders, then the buffer's pieces A, B and C, one array of
pages mapped from its start B first and A last. Arranged, every page is at
its address's offset in the reservation, the five views follow one another
in memory and in the section alike, and once all of it is mapped nothing
moves again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Its OFF stored an empty value, which leaves VICTORY_PORT_CONSTANTS unset,
and unset is on unless the card is an RTX 30 one (trustno1-coder#1223): OFF did not turn
the port off. AUTO is that unset, ON "1", OFF "0".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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>
@github-actions github-actions Bot added AMD pr-fix Pull request: fixes a bug labels Nov 30, 2026
@github-actions github-actions Bot changed the title [pr-fix] [AMD] Renderer port 1 takes effect: both halves ask one switch, unset on AMD cards only (RX 7900 XTX: 45 to 37 ms a frame) Renderer port 1 takes effect: both halves ask one switch, unset on AMD cards only (RX 7900 XTX: 45 to 37 ms a frame) Nov 30, 2026
@ColorC

ColorC commented Nov 30, 2026

Copy link
Copy Markdown

AI Testing & Posting Disclosure: This cross-validation benchmark was executed, analyzed, and posted by an automated AI agent on local desktop hardware. No game screenshots or title assets are included.

Independent Desktop Blackwell Cross-Validation (RTX 5070 Ti 16 GB + Ryzen 7 9800X3D)

Tested VICTORY_PORT_CONSTANTS=1 vs default off on the same standing ~10k-draw Series X 1440p DLSS Quality + 3× MFG + VICTORY_HW_RT=1 scene (Windows 11 26200, NVIDIA Blackwell driver 621.1.0, PCIe 5.0 x16, ReBAR ON):

Metric Default (PORT_CONSTANTS=0) Forced VICTORY_PORT_CONSTANTS=1 Delta
10k-draw Avg FPS 26.38 fps 4.10 fps -84.5%
Card meter (title lists) ~30.8 ms 224.8 ms +194 ms (7.3× slower on GPU)
Card meter (sync / compare lists) 1.6 ms / 0.2 ms �.8 ms / 0.1 ms -0.9 ms
Submitting thread
efreshes 8.9 ms 4.3 ms -4.6 ms CPU
Submitting thread lists' steps 15.9 ms 9.9 ms -6.0 ms CPU
Submitting thread card copies 2.2 ms �.5 ms -1.7 ms CPU

Takeaway confirming #3859's vendor-gated default:

  1. Confirms the exact same Blackwell behavior noted in port.rs (desktop RTX 5070 Ti hits 224.8 ms GPU time when placing the 185 MB heap in system RAM via OpenExistingHeapFromAddress1), validating that defaulting VICTORY_PORT_CONSTANTS off on NVIDIA / on for AMD only is essential.
  2. Also highlights a useful future architectural clue for NVIDIA + ReBAR GPUs: taking that 185 MB heap off shadow-refresh saved -4.6 ms CPU refreshes / -6.0 ms lists' steps / -1.7 ms card copies — so a future VRAM-backed (D3D12_HEAP_TYPE_GPU_UPLOAD / ReBAR) path could potentially capture that ~6–8 ms CPU win without paying the PCIe GPU read penalty.

PranThow added a commit to PranThow/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…es ask one switch, unset on AMD cards only (RX 7900 XTX: 45 to 37 ms a frame)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AMD pr-fix Pull request: fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants