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
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3859"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by duckey-dev on 2026-11-30T09:32:00Z.
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:port::on) has been on with the switch unset since #1223, on every card but an RTX 30 one;arrangeincrates/victory-hle/src/modules/xmem.rs) was on only forVICTORY_PORT_CONSTANTS=1. It gives the heap's pages their section's slices in address order. The title maps the heap's five pieces in a different order from their addresses, so withoutarrangethe buffer is three views of its section in a scattered order.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
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.arrangeruns whenVICTORY_XMEM_ADDRESS_ORDERsays so (1always,0never). When that is unset it followsconstants_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.arrangefirst 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.1and0still force it on or off. The Ampere name list is removed: off is now the default for every card that is not AMD's.1) and OFF (0). OFF now really turns the port off.How it was tested
VICTORY_PORT_CONSTANTS=1set, which turned both halves on with the old code. That is what an unset switch now does on an AMD card.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 testpassed 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'sa_read_by_range_waits_only_for_a_remapping_that_meets_itfails here with or without this change). Both of CI's clippy runs add no warning over main.Not tested
VICTORY_PORT_CONSTANTS=1now turns both halves on, where before it was the only way to do so.Checked for overlap
I searched the open pull requests for the same issue and for the files this touches.
#2923 (open): "keep VICTORY_PORT_CONSTANTS off by default across GPU generations". It makes the GPU half off when unset on every card, so the two halves agree by both being off. It measured the port slower on an RTX 5080 Laptop GPU (136 to 178 ms of card time a frame against 18 to 27 with the host copy). It overlaps this PR's step 3 in
port.rs(resolve_port_mode, the Ampere list, its test). Assessment: for NVIDIA its data is the better guide, and this PR follows it: off by default on every card that is not AMD's. But #2923 leaves both halves reading the switch on their own. That keeps the trap this PR removes, where a change to one default silently breaks the port. It also turns the port off on AMD, where it was measured faster. The two cannot merge as they are. If #2923 lands first, this PR's step 3 only needs to add the AMD case back.#3399 (closed by its author, unmerged): "on in both halves by default". It made xmem ask the GPU half (
victory_gpu::title_graphics_heap_in_place), which is the same idea as this PR's steps 1 and 2. It also added ascatterdescription to the "Scattered" refusal line, which this PR does not have and which is worth bringing over. Its author closed it after a controlled comparison on an RTX 4070 Ti SUPER (DLSS performance, frame generation 2x): about 61 ms a frame with the port really on against about 42 ms with it off. That result is the reason this PR does not turn the port on by default on NVIDIA. This PR also differs from #3399 in a few ways: xmem's half can be switched on its own (VICTORY_XMEM_ADDRESS_ORDER), it is not even asked for mappings outside a 32-bit graphics reservation,arrangechecks read-only before taking the lock, there is a test of the game's mapping order, and the menu's OFF is fixed.#2455 (open): under Wine,
VICTORY_WINE_MAPandVICTORY_PORT_HOME. It builds on the xmem half (home_on()calls xmem'sport_on(), which this PR replaces withaddress_order()). Whichever merges second has to change one line. Otherwise it does not overlap; it does the Wine side, which this PR does not touch.#3650 (open, large): reworks
port.rs(constants(),sections(), a new per-frame log line). It keeps both halves reading the switch on their own, so it still has the mismatch this PR fixes. The changes conflict as text inport.rsand do not do the same thing.#3617, #1977 (open): localize the F1 menu's labels, including this row. The conflict is one line on the CONSTANTS HEAP IN PLACE item.
#3138 (open, ours): world start and DirectStorage. It touches
xmem.rs(places_of) in a different place and shares no commits with this PR.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ColorC on 2026-11-30T10:16:04Z.
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):
Takeaway confirming #3859's vendor-gated default:
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by RustyTheDalek on 2026-11-30T17:29:26Z.
Tested in the game on RDNA 4, with the switch unset: Radeon RX 9070 XT 16 GB (Smart Access Memory on), Ryzen 9 5900X, 32 GB RAM, Windows 11, Series S, PC FidelityFX upscaling (FSR 4), no frame generation, ray tracing off. Built from main
c71899d9with this branch's changes applied, plus #3717 (which changes nothing on this card: the light loops translate as native 64-lane programs here) and my own #4189, #4190 and #4191, none of which touches these paths. 34 minutes of play after the prologue: driving in the city, missions, interiors.1 regions of the title's graphics memory in place (185 MB) ... per frame on the CPU: 281 fills read out of them (113.8 KB). In earlier runs on41adb551the same card logged0 regions ... in place.41adb551without it: 19.4 / 9.6 fps and 39.2 ms, and 17.7 / 11.7 fps and 40.5 ms. Main moved by about 490 commits between those builds, so not all of that is this change, but nothing went the wrong way.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by duckey-dev on 2026-11-30T18:35:53Z.
@RustyTheDalek Thank you, that is the test this PR was missing: a second AMD card, another generation (RDNA 4 where mine is RDNA 3), the switch unset, and real play where I had one still scene. The three lines you quote are the path working as meant (asked unset, on for the AMD card, the pages given in address order, one region of 185 MB in place), and 281 fills read out of the region per frame is far fewer than I see on the 7900 XTX, so the CPU's reads of it cost you less.
@ColorC's numbers on the RTX 5070 Ti above (26.4 to 4.1 fps with it forced on) and the maintainer's
ffe92c57on main since (off unless set, 3 fps read over the bus) are the other half of the same picture: the port is a loss on NVIDIA and a gain on the two AMD cards measured. That is the default this PR proposes, on for AMD when unset and off for every other card, so main's off-unless-set stays exactly as it is for non-AMD cards.ffe92c57makes this branch conflict inxmem.rs; I'm rebasing it onto current main now and will say here when it is pushed.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by duckey-dev on 2026-11-30T19:10:38Z.
Rebased onto current main (
e1251c31) and pushed; no conflicts now. Both of CI's clippy runs add no warning over main here, andcargo test --workspacehas no failure that main does not have on this machine.How it sits on main's
ffe92c57("port constants off unless set"), which landed after this PR was opened:ffe92c57. Off unlessVICTORY_PORT_CONSTANTSis set, and now in both halves (on main the GPU half still read "on unless RTX 30" by itself). The commits are reordered so that none of them, taken alone, turns the port on for a non-AMD card.ffe92c57. The evidence for it is the two AMD runs in this thread: the RX 7900 XTX in the description (45 to 37 ms a frame) and @RustyTheDalek's RX 9070 XT (34 minutes of play, the region in place, nothing wrong).1and0decide as before;VICTORY_XMEM_ADDRESS_ORDERstill overrides xmem's half alone.victory_gpu::port_constants_on()(edb22cfd) where it had a function of its own, and keeps main's port log lines.@trustno1-coder one question the commit message of
ffe92c57leaves open: which card was the 3 fps run on? If it was an NVIDIA card, it agrees with @ColorC's RTX 5070 Ti numbers above and with this PR's default. If it was an AMD card, it contradicts the default proposed here and I would rather know before this goes further.The description above still names the old function and the old commit order; I'll correct it.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by saltdam36 on 2026-11-30T20:43:47Z.
A third AMD card: RX 7800 XT 16 GB (RDNA 3), Ryzen 7 7800X3D, 32 GB, Series S, AMD FSR upscaler 720p→1080p, no frame generation. Main at
e1251c31with #1236, #2764, #3681 and this PR at964bfd72. Before it, every start logged "not one native-import-eligible stretch of a section: Scattered" and placed nothing; with it, "1 regions of the title's graphics memory in place (185 MB)".Switch unset against
VICTORY_PORT_CONSTANTS=0, alternating launches from the same open-world save, standing still, 120 s each, medians of the log's per-second lines:=0, launch 2=0, launch 4About 12 % less frame time (26 → 30–31 fps), and with the port on the card becomes the limit in this scene. No device loss and nothing wrong in the picture, but these are five-minute runs at one spot; I have not played a long session on it yet.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by duckey-dev on 2026-11-30T21:17:05Z.
@saltdam36 Thank you. Alternating launches from one save is the cleanest comparison in this thread. That makes three AMD cards (RX 7900 XTX, RX 9070 XT, RX 7800 XT) where the port is a gain with the switch unset, and "the card becomes the limit" is what I see here too. A longer session on it would still be welcome.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.