World frame rate: texture sync still reads unchanged textures whole (~410 MiB/s); about 1.7 fps now #179
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?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T23:14:54Z.
On main, a world frame takes about 1.6–1.7 s of CPU (about 0.5 fps on an M5 Pro, 48 GB). A call profile and stack samples of the world (warm run, 60 s window) put almost all of it in the queue's
ExecuteCommandLists: 53.4 s of 60 s.Inside it,
Title::sync_dirty→sync_keysruns on the submit thread, under the host's global lock. For each texture that's unloaded or changed, one by one, it:mach_vm_read_overwrite, ~42 %);textures::upload, ~50 %).World streaming feeds it all the time. The other title threads queue behind the lock:
ResetXand placed-view calls show 100 s and 63 s of waiting per 60 s. Metal encoding didn't show up in any sample, and creating a view plus a heap entry costs about 2 µs, so neither of those is the cost.Being fixed in two parts:
An off-by-default
VICTORY_TRACE_TEXTURE_SYNC=1(textures and MiB per second, unchanged or blank counts, ms per step) will land with it.Related: #47 (where a world frame goes on the Wine route).
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T23:53:40Z.
A data point for part 2 of this, since we tried the same idea locally. It is not conclusive, so take it as a caution, not a result.
Apple M5 Pro, 48 GB, Series S, windowed, warm cache.
49b5521bplus diagnostics only):submitholds the title lock 3.65 s per 5 s window;kIOGPUCommandBufferCallbackErrorTimeoutand "held for a wait", and the title watchdog at +186 s.userspace_watchdog_timeout). Other builds were running at the same time, so that run is unreliable.What I'd watch, as guesses: the worker threads competing with the title's own threads under Rosetta, and the memory held by large detiled batches. Part 1 of your plan (skip unchanged or blank textures before reading them whole) may matter more than moving the work off the lock. I'm not pursuing this further; it's yours.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T01:03:30Z.
Landed
2d4cd0a1: a submission's textures are read, hashed and detiled off the host lock, gathered without a list search each, and a render target remade under a released key starts over in the scanner. Warm runs, world frames a second over 30-150 s after the world starts: 0.38 before, 1.17 with reads off the lock, 1.73 with the full change (one run reached 2.57 over its last 75 s). Measured before the last two main merges. Still open: unchanged textures are still read whole (about 410 MiB a second), and nearly half the textures read are not readable at once and go page by page.VICTORY_TRACE_TEXTURE_SYNC=1shows the numbers.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T10:59:45Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T10:59:56Z.
Claimed by @Sheffy007. Open a draft pull request with
Refs #179in its description within 24 hours, or the claim expires.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T17:11:38Z.
/release
#326 (reverse-mip chain probe sampling + coalesced contiguous pool reads) is now merged on
main(061ba4da). Releasing the claim so anyone with a warm world setup can measure or take the next slice.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T22:32:11Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T22:32:23Z.
@derz92 this is already claimed by @Sheffy007. Pick another issue, or ask them here.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T22:34:00Z.
@Sheffy007, your
/releaseabove (17:11) doesn't seem to have cleared the claim: the bot still lists you. Are you OK with me taking the next slice of this? It's small and measured:PROBE_BUDGET, 2 ms a round) get one budget per presented frame instead of one per submission. It's opt-in,VICTORY_PROBE_PER_FRAME=1.hold_sync).hold_syncgoing from 71 to 23–49 ms. That's about 13% faster.If you'd rather keep it, no problem; I'll drop it.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-28T03:02:08Z.
/release
@derz92 released via the bot now — all yours, nice measurement on VICTORY_PROBE_PER_FRAME!
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T03:02:17Z.
Released. This issue is free to claim.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T10:53:36Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T10:53:45Z.
Claimed by @AnastasisKon. Open a draft pull request with
Refs #179in its description within 24 hours, or the claim expires.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T12:30:01Z.
Perf batch in flight from my fork, all
Refs #179, CI green on each unless noted:Game folder on the external SSD is still downloading (no PE exe yet), so no in-game run numbers from my side yet.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by 4TheDoctor on 2026-11-28T20:24:43Z.
Numbers from an M3 Max (48 GB, macOS 27.2.1, Series X) on main
26817285, withVICTORY_TRACE_TEXTURE_SYNC=1. They cover loading and world entry only: the run crashed about 4 minutes in, an unhandled 0xc0000005 at image+0x55e56f8. Medians of 153 one-second lines with at least 300 textures:Detiling is the smallest part here. Most of the time goes to finding out what changed (reading whole and hashing), and to textures retried while their pages aren't readable yet.
@AnastasisKon your rayon batch makes those reads and hashes faster. I'd like to take the complementary part, if that doesn't step on your claim: a per-page change test, so a texture nobody wrote since its last sync is skipped without being read or hashed.
victory-platform::watchalready has the signal-safe mechanism for the descriptor trace (pages made read-only, the write fault reopens the page and records it, the next interval closes them again). The plan is to generalize it to a dirty-page bitmap over the pool pages that sampled textures live on. Then a texture is read only when one of its pages is dirty, and a partly unreadable texture is retried only once its pages are mapped.Two things I'd handle first:
It would land behind an off-by-default switch with the trace numbers above, as a separate PR with
Refs #179. Is that OK with you and @LakshanSivakumar, or is someone already on it?Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T20:32:37Z.
Unclaiming this one — I am not working on it and nobody should hold it blocked on me. cc @4thedoctor (notified per request).
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by 4TheDoctor on 2026-11-28T20:35:44Z.
Correction to my plan above, after reading the code. Page protection is the wrong first step on the native host:
docs/macos.md("Masked stores into protected pages hang Rosetta"): an AVX masked store, or avcvtps2ph/vextract*128store, that starts writable and ends in a protected page hangs the process.masked::patchis#[cfg(windows)](victory-loader/src/masked.rs:389), so the native host has no cover for that.xmem_physical.rs:11-13,PageWindow/write_physical;report_writtenis a no-op on macOS). GPU Copy/Fill/UAV writes don't fault either, and a remap resets the protection.ReadFile,freadand uncompressed DirectStorage readspreadstraight into title memory, and they'd get EFAULT.So the revised plan is to know who writes instead of catching every write:
PoolTable::signature/generation()instead of being retried every scanner round and every job. On my run that's 43 % of what is synced each second.None of this overlaps the rayon batch. I'd start with 1 and 2, behind off-by-default switches,
Refs #179, unless you'd rather I open a separate issue for them.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T20:44:15Z.
Yes to both: take 1 (the writer trace) and 2 (partly-unreadable textures waiting on PoolTable::signature/generation), behind off-by-default switches, Refs #179, as your own PR. No overlap with the rayon batch.
Two notes from our fork: the native host's write-trap instrumentation is being rebuilt right now (AnastasisKon/Native-Victory-macOS #75, #78) so it logs its arming and first hits — that should give you the per-writer evidence for item 1 before you add new switches. And your Rosetta masked-store caution is exactly why: a trap that fails silently reads as a negative result, which cost us a wrong conclusion on the boot blocker.
On your crash 4 minutes in at image+0x55e56f8: that is the title's own crash reporter dereferencing a null list, documented in our docs/native-host.md — downstream of whatever faulted first, not a new blocker.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by 4TheDoctor on 2026-11-28T20:44:53Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T20:45:01Z.
@4TheDoctor this is already claimed by @AnastasisKon. Pick another issue, or ask them here.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by 4TheDoctor on 2026-11-28T20:45:42Z.
Thanks @AnastasisKon, that settles it, and thanks for the pointer on the crash. The claim bot still has you on this one, so could you comment
/release? Then I'll claim it and open the draft PR for 1 and 2 withRefs #179within the 24 hours. I'll look at your fork's write-trap work (#75, #78) before adding switches for item 1.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T21:03:57Z.
/release
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T21:04:07Z.
Released. This issue is free to claim.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by 4TheDoctor on 2026-11-28T21:37:46Z.
For the record: #578 says nothing new lands in this repository, so item 1 went to AnastasisKon's fork as a draft: AnastasisKon/Native-Victory-macOS#80. It adds
VICTORY_TRACE_TEXTURE_WRITERS=1. Each time a texture is read again, the trace says what changed its memory since the last read: DirectStorage, a mapping change, both, or neither.The short version, from two 300 s runs on an M3 Max (Series X, into the prologue world). The storm of re-read textures this issue was about is not on that fork's
main. Comparing it with this repository'smain26817285, per second:TITLElock: 213 → 14–21 msThe few re-reads left all fall under "neither". DirectStorage does report its writes (about 90 MiB/s), but none of them land in a texture the sync already holds. So item 2 (partly unreadable textures waiting on the mapping) has nothing left to win there, and I am not doing it. The tables are in the PR.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-29T14:27:55Z.
Measured on the now-complete data folder (209 GB; the archives stopped changing on 28 Nov), one 120 s headless Series X run on an M3 Pro / 36 GB. This does not fix the issue; it narrows what costs the frame, and it contradicts one of the two suspects in ROADMAP.md.
Texture sync is not what costs the frame outside the world. The roadmap's leading suspect was the scanner re-hashing every watched texture each round ("not measured on a world run yet"). Over the whole boot-to-prologue run,
VICTORY_TRACE_TEXTURE_SYNC=1gives 46,554 textures in 1,604 batches, 17.2 GiB, while the menus held 30 fps:TITLElock was held 5.9 s for uploads and 2.2 s for blank probes (7.8% in all).VICTORY_PREWARM_WORKERS=10moved the median 30.0 to 29.5 fps.The slow seconds in that same run are the DirectStorage poll. Frames ~1024 and ~2300 on drop from 30 to 17-20 fps, and those seconds are the ones full of
dstorage: a status entry is still pending(one line per 5,000 polls). The counter reached 4,970,000 in 118 s: ~42,000 polls a second across the run, ~650,000 a second inside a dip, with the lane holding 12 running 64 KiB reads ofG:\shaders.rpfand up to ~470 more queued. The boot-phase figure already in native-host.md is 20,000 polls in 20 s (1,000 a second), so the world load polls 40 times denser, and what it waits on is the shader archive rather than thettpfdata.Shader translation is absorbed, so it is not the wait either. The cold run made 422 cache-miss translations worth 450 s of work (121 past 0.5 s, the longest 16.3 s) and still held 30 fps in the menus, because the prewarm pool takes it off the title's thread; first binds fall from 2,147 on a cold cache to 37 once warm.
So the next thing to attack for world frame rate is the poll loop and the read latency behind it, not the scanner. Per-second figures and command lines are in the pull request.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-29T14:58:56Z.
Second measurement on this, and it corrects my first comment: the slow seconds are not the DirectStorage polls, and the GPU is not the bottleneck either.
VICTORY_TRACE_COMMITS=1over one 120 s headless Series X run: 9,080 command buffers, 11.8 s of GPU time in 94.8 s of wall time — the GPU is 12% busy, and 1-16% busy in the exact seconds where fps falls from 30 to 17-20. Per-command-buffergpu_mshas a median of 0.0 and a single 169 ms outlier.VICTORY_DSTORAGE_LOG=1in a second run: the read pool peaks at 3.9 of 12 workers withstaging_waits=0and up to 246 MB/s. The title submits in bursts, the pool drains each in milliseconds and then waits. Not our read path.samplereportsCode Type: X86-64 (translated)and puts 11,067 of ~12,000 samples at one address in the Rosetta runtime with no symbols — and our own Rust frames are translated the same way, so they do not symbolize either. The host's own counters are the only CPU attribution this port has.For calibrating what is achievable: the reference Windows host shipped next to this data reports, on an RX 7900 XTX, 30 fps in menus, 13-20 fps in the prologue and 6-10 fps in a street chase. Our port reaches the world load at 15-23 fps on an M3 Pro under Rosetta, so world frame rate here is already at parity with the host people play on, and the lever for more is the arm64 recompilation rather than more Metal or texture-sync work.
Detailed in the pull request.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by a-sheff on 2026-11-29T15:13:49Z.
Hello @AnastasisKon, the work from this repo has moved to a private repo. If you'd like to contribute, please join the discord here: https://discord.gg/taabYVrVa and we will get you an invite to the private repo.