native: find the title's descriptor store sites (VICTORY_TRACE_DESCRIPTORS=sites) #127
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/127"
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 Olima34 on 2026-11-26T17:47:11Z.
Second step for #43, on top of #119 (this branch contains #119's commit; review only the last commit,
native: find the title's descriptor store sites). #119 measures how many records the title rewrites with plain stores; this finds where: which title instructions store into the descriptor heaps, which is what decides how many patch sites there are.How (
VICTORY_TRACE_DESCRIPTORS=sites, off by default).victory_platform::watch(macOS only). At each submission,glue::submitmakes the pages of the title's shader-visible heaps read-only (its own CPU view only, never the GPU's).watch::on_write_faultfirst, before the title/host check, whoever wrote. A fault in a watched page makes that page writable again and returns, so the store runs again.rip - image base) only when the RIP is in the title image and the address is inside a heap's record range. Host writes (the device's view calls) and title stores that only share the page go on unseen, and are never fatal.descriptor store sitesline: distinct sites, overflow, and the top 64 by count asimage+0x...Signal safety and races.
mprotectdirectly.watch()writes the table not in use, publishes it, protects the new pages, and only then reopens the pages neither table covers.watch()and the start of the next. By then its page is already open.Limits (in docs/native-host.md).
read()into it) would get EFAULT rather than a fault.Tests.
sites_count_and_overflow,only_title_stores_into_a_range_count,a_store_into_the_old_tables_page_during_an_update_is_the_watchs(the pure rule, old plus new tables), anda_table_being_written_is_not_read(the seqlock).a_store_into_a_watched_page_lands_and_reopens_it: a store lands, its page reopens, and it is counted once; a store outside the range is not counted.stores_during_updates_never_escape_the_watch: 20,000watch()updates race stores into the shared pages. It dies with SIGBUS against the first version and passes with this one.victory-platform and victory-gpu (arm64), victory-loader, victory-hle and victory-platform (x86_64-apple-darwin), Windows clippy and
cargo xtask policypass. Not run in game: whether Rosetta resumes every store form the title uses there (the probe covers a plainmov), and how much sites mode slows a frame.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T18:09:59Z.
Merged, thanks. Next is a world-load run with
VICTORY_TRACE_DESCRIPTORS=sites, to choose between patching and remirroring (#43).