Repository navigation
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
Open
duckey-dev wants to merge 4 commits into
duckey-dev wants to merge 4 commits into
Conversation
…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>
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 Renderer port #1 (VICTORY_PORT_CONSTANTS=1) on Ampere: the submitting thread saves ~9 ms, but the card waits ~25 ms a frame on the in-place heap #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.
port: keep VICTORY_PORT_CONSTANTS off by default across GPU generations #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 port: keep VICTORY_PORT_CONSTANTS off by default across GPU generations #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 port: keep VICTORY_PORT_CONSTANTS off by default across GPU generations #2923 lands first, this PR's step 3 only needs to add the AMD case back.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 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 Renderer port 1: on in both halves by default (the 174 MB heap was "Scattered" and stayed a copy in every default run) #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.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 (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.Synchronisation core: commit leak fix, exact refresh runs, list summaries, heap hooks on, and a night of NVIDIA/Ampere work #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.Add Fluent runtime localization #3617, Localize the F1 menu and fix Chinese text layout #1977 (open): localize the F1 menu's labels, including this row. The conflict is one line on the CONSTANTS HEAP IN PLACE item.
World start: no 1.6 s stall (heap buffer views made while the title loads), plus DirectStorage, detiler and pipeline-crash ports #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