Where the frame goes on a 4060 Ti: compute is 93% of the GPU time, two passes are 73 ms, one list costs 82 ms #10
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@rocobalt1 on GitHub · 2026-11-24 19:41 UTC · original
Where the frame goes on a 4060 Ti, measured with your own
VICTORY_GPU_TIMINGandVICTORY_DISPLAY_MODE. Numbers only; no assets.Setup: RTX 4060 Ti 8 GB, driver 32.0.16.1656, Ryzen 9 5900X, 64 GB, Windows 11; fork
004bf69, diag build (--profile diag --features diagnostics),VICTORY_NO_WATCHDOG=1,VICTORY_SHADER_LOOP_LIMIT=32,VICTORY_DISPLAY_MODE=1920x1080, freshVICTORY_DATA_DIR. Driven withVICTORY_KEYS. Shadows render and the prologue shows characters, sky and lighting.1. Resolution is not the lever
Same save, same scene family, averages over world frames with >800 draws:
Four times fewer pixels moved the GPU by 5 %. So the GPU time is per dispatch, not fill rate. (Good news for the port: you do not need to drop resolution to gain time.)
2. Where the GPU time goes (
VICTORY_GPU_TIMING=1)The complete per-pipeline table, summed per frame over 144 pipelines:
Top of the table:
Three readings that matter for the port:
VICTORY_BVH_BUILDERoff by default may already be the cheap case and worth confirming.3. A CPU outlier worth a look
82 ms to prepare one list of 76 commands, repeated every frame. That is about 1 ms per command, which looks like per-command work (pipeline lookup? root table?) rather than copying -
copiesin the frame line is only 67 ms for 166 MB.4. Two smaller observations
If it helps, I can run a head with
VICTORY_GPU_TIMINGat a lower "slow" threshold (or no threshold) to get the full per-command distribution, which would say whether the 270 ms really is spread evenly over 4-5 k draws or hides another few passes.@rostaddotcc on GitHub · 2026-11-24 21:28 UTC · original
Your table gives the missing comparison for the same four lanes on a different runtime, so here they are from a Linux/Proton host, measured with the same frame line (fork
4e17478, release build, RX 7900 XT/RDNA3, Mesa 26.3.1 RADV, Proton Experimentalexperimental-11.0-20261112, vkd3d-proton 3.2.0, 60-minute continuous run, world-streaming frames with 700–6 300 draws):Two readings of that, and the second is the one I would act on.
The GPU half agrees with you. Resolution and GPU pass cost are not the lever on either platform; on Linux the card is 1–4 % of the frame whatever is on screen, so #10's GPU-side conclusions hold there too.
The copy lanes are 25–45x more expensive under Wine for the same work. Your
copiesis 67 ms; ours is 1 645 ms and up. The bytes do not explain it: a 128 MiB probe in the same prefix does 21.3 GB/s of mapped upload writes, 143–163 GB/s of card copies and 12.6 GB/s of readback, and the layer's own per-buffer stats show its largest single copy at 156 MB in 2.46 ms. What the lane is actually doing per frame, from the diagnostics build's counters:GetWriteWatchcalls over 18 198 refreshes, 97.8 % of what it asks about is unchanged. That asking alone is 1 169 ms of a 3 428 ms lane (34 %).Shadow::updatebuilds a freshVecover|pending|on every one of the 18k refreshes, and failed bulk reads fall back toread_sparse/read_pieceswith aVirtualQueryper region (144–1 371 fallbacks per frame).So the difference against your numbers is most likely in the syscalls Wine emulates —
GetWriteWatchover multi-megabyte ranges,ReadProcessMemoryper piece — not in what the layer asks for. That is a hypothesis I have not isolated; the counters that would settle it exist in the current tree and I have not spent a run on them yet.If you want a comparable experiment on Windows:
VICTORY_ASK_ONCE=0/1(per-asking vs per-buffer asks) andVICTORY_COPY_MODE=none/plainbound the lane on your machine in two 2-minute runs, and would say whether the per-call cost you see is the same shape as ours or genuinely Linux-specific.@rostaddotcc on GitHub · 2026-11-24 21:40 UTC · original
Two things about the switches your run used, both read out of
4e17478, because they change how those numbers should be compared.VICTORY_GPU_TIMINGsilently pins the late-wait stage to 0. Inhost.rs:1678-1680:So a run with
VICTORY_GPU_TIMINGset cannot also haveVICTORY_LATE_WAIT=1/2/3— including the case where relay alone would have given stage 3 (Err(_) if crate::shadow::relay() => 3). If your 656 ms frames were taken with the timing switch on and relay or late-wait otherwise enabled, that run describes a different configuration than a normal one, which is the same class of trap asVICTORY_INDIRECThaving beencfg!(feature = "diagnostics")-gated: the measurement switch changes the thing being measured. Worth either documenting next to the switch or printing the resolved stage in the frame line.VICTORY_ASK_ONCEis already the default, so the A/B direction is=0, not=1(watch.rs:161-166, on since run 81 for 375-450 ms against 573-647 ms a frame). Same forVICTORY_CARD_BUFFERS(on unless=0) andVICTORY_LATE_WAIT(0 unless relay is set). The ones that need switching on areVICTORY_WIDE_REFRESH=1,VICTORY_CARD_REHASH_RUNS=1,VICTORY_TEXTURE_NO_WAIT=1.For reference, the resolved defaults on this tree:
VICTORY_ASK_ONCEVICTORY_WINDOW_KBVICTORY_WIDE_REFRESHVICTORY_COPY_MODEguardedplaincopies without the guard,noneskips themVICTORY_CARD_BUFFERSVICTORY_CARD_REHASH_RUNSVICTORY_TEXTURE_NO_WAITVICTORY_LATE_WAITVICTORY_INPLACENone of these is gated behind a cargo feature at this commit — I checked each one's only read site — so a release build honours them all.
@HenriqueSBueno on GitHub · 2026-11-24 21:44 UTC · original
Your result that resolution barely moves GPU time (−5 % for 4x fewer pixels) fits two things the dossier in Marvisak/VIctory#1317 flags as per-dispatch costs, both still present at
4e17478:list.rs:1356,OCCLUSION => Written::Value(1 << 20)), and GPU timestamps are CPU time taken after the wait. The title's own occlusion culling therefore never removes anything. Every object's culling and indirect work runs, and that cost does not scale with resolution (H-8.1/H-8.2).ExecuteIndirectgets a clamp dispatch plus UAV barriers without a resource, which drain all in-flight work. With ~3,000 meshExecuteIndirectcalls ofmax=1a frame (#107, @ryotdev's count), the drains alone can explain a large share of "compute is 93 %" (H-7.4/H-7.5).A cheap experiment for the second one: a diagnostics switch that skips the clamp for signatures with
max=1and a known-valid count buffer, plus resource-scoped barriers. Then compareVICTORY_GPU_TIMINGtotals. For the first, real query heaps with resolved timestamps would also let the title's dynamic resolution react.AI-assisted (Claude Code)
@rostaddotcc on GitHub · 2026-11-24 21:49 UTC · original
Ran the counters the diagnostics build already has, on the loading/streaming phase here (RX 7900 XT/RDNA3, RADV, Proton Experimental, fork
4e17478, diag build, no new switches —VICTORY_NO_WATCHDOG=1 VICTORY_SHADER_LOOP_LIMIT=256and thed3d12override). Three minutes, frames 5 511–8 157 ms, GPU 87–195 ms, 1 777–5 292 draws. This closes the "what is inside the copy lane" question that my earlier comment left open.Per frame, from
copies per frameandrecording per frame:The counters print per window between two frame lines, so these are the last two windows of the run, not two chosen frames:
copies(frame line)watches)guards)sparse reads)moves)So the lane that was 56–73 % "unattributed" is now attributed: asking + guards + sparse + moves account for essentially all of it, and asking dominates at ~50–85 %, with the single worst asking pinning the frame twice in this run: a 365 ms
GetWriteWatch, and in one earlier frame 748 ms. On a runtime whose mapped reads run at 21 GB/s, a 748 ms asking is not moving bytes — it is waiting for something. The shape is a long tail, not a uniform cost: 326 of 1 897 askings account for 2 269 of 2 317 ms.The texture lane has a different and bigger problem.
texture refreshes per frame, all threads:Nearly the whole texture lane, and in the worst frame 4.1 s of a 7.4 s frame, is the wait for title memory to stop being remapped — not copying, not hashing, not asking. That is also what @peeepy reported from an RTX 3090 ("mostly waiting for title memory to hold still"), so it is not an AMD-only shape. Nothing in the copy path can fix that; it is the title remapping pages under a reader, and the interesting question is whether the layer can read those pages without asking for the mapping to hold still.
Two consequences for the priorities in this issue:
VICTORY_WINDOW_KB/VICTORY_ASK_ONCEfamily targets the right lane, but the tail suggests the win is not smaller windows — it is not asking per range at all, or asking from a thread that can afford to wait 365 ms. A single asking blocking the submitting thread for 0.4–0.75 s sets the frame time.I have the full log if a specific line would help; nothing from the title is in it.
@rocobalt1 on GitHub · 2026-11-24 22:03 UTC · original
The same counters from a Windows host, for the same four lanes, on a normal run (no
VICTORY_GPU_TIMING). It splits your two readings: the asking tail looks Wine-specific here, the hold-still wait does not.Setup: RTX 4060 Ti 8 GB, driver 32.0.16.1656, Ryzen 9 5900X, Windows 11; fork
4e17478, diag build,VICTORY_NO_WATCHDOG=1,VICTORY_SHADER_LOOP_LIMIT=32,--console series-x,VICTORY_DISPLAY_MODE=1920x1080, fresh data dir, ~7 minutes in the world.TdrDelay=60/TdrDdiDelay=60machine-wide. 220texture refreshes per framelines and 81write-watch askingslines in the log.GetWriteWatchbytes asked aboutA representative
copies per frameline from the same run:So the two costs behave differently across the two hosts:
GetWriteWatchhas no counterpart here; ours are 1 ms with a 34.7 ms worst case in a whole run. That fits syscall emulation rather than the layer's asking strategy, which is the hypothesis you could not isolate.texture refreshestotal, 183 ms a frame on average and up to 2 073 ms is also waiting for title memory to hold still. That is not copying, hashing or asking, and it is on the same build you and @peeepy measured, so the item you asked to be filed separately has a second, non-Linux data point.And you are right about the switch. My per-pipeline table (144 pipelines, 381 ms summed) was taken with
VICTORY_GPU_TIMING=1, so that run described wait stage 0 rather than the stage a normal run resolves. The frame-line numbers I quoted in the issue (656 msat 4K,621 msat 1080p,340 - 373 msforseries-s) come from runs without the switch and stand as they are. I have not re-taken the per-pipeline table with the stage printed; that is the honest gap.I am starting the two A/Bs you proposed on this machine now (
VICTORY_ASK_ONCE=0andVICTORY_COPY_MODE=none) and will post what they give.No game data; counts only.
@rostaddotcc on GitHub · 2026-11-24 22:14 UTC · original
Follow-up on the texture lane I flagged above, now measured in three runs: the whole of it is the wait for the mapping lock, and
VICTORY_TEXTURE_NO_WAIT=1takes it to zero (median 20.2 ms -> 0.0 ms, max 4 076 ms -> 0.0 ms over 94 windows), while 0-2 textures a frame are left for the next refresh. I also tested and discarded my own theory that our readers were holding the lock too long - releasing it after the copy changes nothing. Details, numbers and the proposal: #178.@rostaddotcc on GitHub · 2026-11-25 06:37 UTC · original
A negative result on the obvious lever, measured on Linux/Proton (RX 7900 XT, RADV, vkd3d-proton 3.2.0, latest
main8dd30ab, 400-second runs, comparable phases: median frame 2 279 ms against 2 452 ms).Smaller windows do not help: they cut the bytes checked five-fold and double the call count.
VICTORY_WINDOW_KB=64So the bytes were never the cost — the calls are. Halving the range per call buys 5x fewer bytes and pays for it with 2.1x the calls, and the lane ends up slightly worse, with a much worse tail. The same conclusion the texture lane reached: with #175 the wait goes to 0 and what is left is asking (62.9 ms median, 936 ms worst) — per-call overhead again, which is what batching (#177) addresses for the texture path.
What this does suggest is a lever the tree does not have yet: the asking is per range, and on this box one frame asks about 7.3 GB across ~1 750 calls to find 186 MB of changes. A per-buffer ask that covers the buffer once (rather than one ask per submitted range) would cut both counts;
VICTORY_ASK_ONCEalready collapses the submission dimension, but each range inside a submission still gets its own call. If someone wants a target, that is the one I would measure next.Two side notes from the same pair of runs: the texture lane improved with the smaller grid (59 to 20 ms total, wait 44 to 8 ms median) because each texture's own extent then covers fewer pages — so if anything the grid should shrink for textures and stay 4 MiB for buffers, which is not how the switch works today (one setting for both).
@iGoldenNinja on GitHub · 2026-11-25 06:47 UTC · original · edited 2026-11-25 07:04 UTC
I checked the two program hashes in your resolution and ray-traversal question. Both bind and create host pipelines in our prison runs on an RTX 5080 / 617.14, Windows 11 Pro build 26200.9974, NVIDIA fork
310c6eband the tested local7e7bb18diagnostics branch. I matched both guest inputs and disassembled them with8dd30ab.6d7fe7745ab9c6d8is a 32 × 1 × 1 Wave32 group with seven staticimage_bvh64_intersect_rayinstructions among 9,416 decoded rows.cfd83392ec9ae408is an 8 × 4 × 1 Wave32 group with 250 decoded rows, including image and formatted buffer operations, and zero BVH opcodes.These are offline instruction counts. The 5080 per-dispatch timing and resolution scaling remain open. Local test method and counts
OpenAI Codex (GPT-6) performed the matching and wrote the report.
RTX 5080 timing follow-up. I ran the same local
8dd30abdiagnostics binary withVICTORY_GPU_TIMING=1, warmed shader cache, reported mode 3840 × 2160, and the default shader loop limit. The camera responded in the prison.5cf00dc39042edafranked first in all 12 prison timing windows at 12.30–13.91 ms/frame, longest dispatch 15.30 ms. Its matched native program is a checkerboard shadow-mask pass by container metadata and has zero decoded BVH intersection opcodes.cb6adcc6da2613ffwas present in all 12 at 2.02–2.89 ms/frame.The two original hashes bound.
6d7fe7745ab9c6d8logged 0.36 and 0.73 ms/frame in two opening-sequence windows. Neither original hash appeared in the top 40 in the prison windows, so their prison costs remain unresolved. Timestamp method and limits@rostaddotcc on GitHub · 2026-11-25 07:23 UTC · original
A follow-up that is good news for the copy lane, and the first A/B I have done on this ground that survived the phase problem:
a26859fcopies two to almost three times faster than8dd30abat matched draw counts on Linux/Proton (RX 7900 XT, RADV, vkd3d-proton 3.2.0, both runs entering the world with scripted keys, ~7 minutes each).Bucketed by draws in the frame, median over the windows in the bucket:
8dd30abcopiesa26859fcopiesFrame time over the same buckets: 4 684 → 2 367 ms, 3 382 → 2 420 ms, 3 518 → 3 791 ms — so the world frames are not uniformly faster (the heaviest bucket is slightly worse), but the copy lane itself is cheaper everywhere, and it is no longer the thing that eats the second half of the frame at low draw counts.
Worth saying because it is a change nobody labelled as a copy-path change: "views off their copy's elements get their own bytes" and the descriptor records being mirrored are correctness work, and on this ground they came with a substantially cheaper lane. If that was intended, this is the measurement that says so; if it was not, it is worth knowing before someone "optimises" it back.
Two notes on method, since both have bitten me here:
VICTORY_KEYS(diagnostics build) or the title sits at its start screen indefinitely — 30 fps, 13 draws, no error — and a run that never entered the world looks exactly like a loading regression. Details in #179.@rostaddotcc on GitHub · 2026-11-25 08:14 UTC · original
⚠️ Retracting the table above (the "
a26859fcopies two to almost three times faster at matched draws" one, comment 7155815513). I repeated the comparison and it does not survive repetition, so please do not plan anything on it.The run-to-run spread on this ground is larger than the difference I was reporting. Three runs of the same script, all entering the world with scripted keys, same box, same prefix, minutes apart — and two of them are the same binary:
9376fd6run 1a26859f9376fd6run 29376fd6against itself: 3 922 vs 2 003 ms and 601 vs 372 ms of copies in the first bucket, 6 731 vs 1 707 and 1 008 vs 197 in the last — a factor of two to four between identical binaries. That is the whole size of the effect I reported, so the honest reading is no measured difference between the two commits, in either direction. (And the same caveat applies to my earlier note that9376fd6looked twice as slow: that was one run, and it does not reproduce.)Draw count is not a sufficient phase control here: two windows with 2 200 draws can be in different places of the streaming, with different amounts of new content. Nor is it the shader cache — the translation counts are flat across the three runs (2 693, 2 692, 2 743) against a 1.7 GB cache.
What would make a comparison trustworthy on this ground: three or more runs alternating A/B/A/B, taking medians across runs rather than inside one, and bucketing on something that tracks content (bytes copied, new pipelines, MB of textures refreshed) rather than on draws alone. I will bring numbers in that shape or not bring them.
@akimfomin on GitHub · 2026-11-25 08:50 UTC · original · edited 2026-11-25 09:22 UTC
@rostaddotcc I used PortBridge preflight to find this thread and ran a small native Windows 11 control for the range-narrowing question. Across eight alternating pairs with sparse writes, joining eight contiguous 4 MiB ranges cut median paired query time by 39.7%. Joining eight alternating ranges across their gaps raised it by 13.3%.
There is a correctness check worth carrying into a Proton A/B. One enclosing
GetWriteWatchquery with the reset flag returned the 155 requested pages plus 135 dirty gap pages. The call consumed those observations, and a later gap query found zero. The current journal correctly records every returned page. A contiguous-only arm could test both grouping stages while keeping that journal behavior.Reproducer and raw data. These numbers describe the native Windows API on synthetic memory. Proton, game-frame time and GPU behavior need separate measurements.
I added an opt-in arm to the pinned
9376fd6code for a paired follow-up. It uses the original refresh ranges and coalesces only touching pages, while keeping the default grouping and journal behavior. All 14watch::testspassed on Windows, including a native check that the gap page remains visible to the next kernel read. This makes the experiment reproducible for a Proton A/B. The native test keeps a separate journal and all checks passed 48 repeated suites across one and four test threads. The switch only changes submission prefetch. Later fallback queries can still cover wider spans. No frame or GPU performance was measured. Patch and verification.@UwUCammie on GitHub · 2026-11-25 22:40 UTC · original
I checked the viewport sizes under both display settings on an RX 7900 XT (RADV 26.3.1, Wine 11.22). With the Series X profile I changed both the reported mode and the fullscreen setting in a separate settings directory to 1920×1080. The title saw the 1080p mode. It still created a 3840×2160 swapchain.
I sampled one graphics viewport per 257 binds on the same first-room route. The two most frequent sizes were 2560×1440 and 2048×2048 in both runs. The 4K setting gave 655 successful presents in 73.82 s (8.87 FPS, 4,854 draws/frame). The 1080p setting gave 555 in 73.22 s (7.58 FPS, 4,870 draws/frame). Single runs with a sampling build; the room rendered in the captured output.
For anyone comparing fill cost here, changing the display mode alone didn’t give this pair four times fewer scene pixels. Checking the graphics viewports alongside the swapchain makes that distinction visible.
@xilorezer on GitHub · 2026-11-25 23:38 UTC · original
One possible direction worth investigating is a more aggressive optimization of the CPU submission path and GPU workload scheduling.
A few techniques commonly used in modern game engines might be relevant here:
1. CPU-side command preparation
2. GPU-driven execution
3. Compute shader optimization
4. Better workload profiling
I realize that this is a compatibility layer rather than a conventional game engine, so batching and command restructuring must preserve the original Xbox execution semantics.
The goal here would mainly be to reduce the overhead of preparing and executing the existing workload.
Would it be compatible with the current architecture, particularly the host-list preparation bottleneck?
@UwUCammie on GitHub · 2026-11-26 00:47 UTC · original
Tried the alternating gather mode from
006c353on an RX 7900 XT with Wine 11.22 and RADV 26.3.1. In the first room, gathering at copy time gave 698 accepted presents in 104.62 s (6.67 FPS). With it off I counted 701 in 106.06 s (6.61 FPS). Both private checks showed the character and courtyard. The modes switched every 20 s in one run, and I excluded intervals crossing a switch and the first second after each switch. I’d leave the default alone on this evidence. Sampler and build