gpu: mark descriptor slots on store-hook writes (#43) #663

Closed
github-bot wants to merge 383 commits from github-bot/gh-659 into main AGit
Owner

@⁠jamal-fv on GitHub · 2026-11-29 23:15 UTC · original
jamal-fv:perf/descriptor-store-sites → main · +75807 −6380 · 398 files · 383 commits · closed without merging

Refs #43

Summary

  • Track descriptor heap slots the title writes (arm lift rt_note_store + HLE memcpy) and remirror only those slots instead of rescanning bound tables.
  • Mechanism is a copied-write hook (VICTORY_STORE_SITES=1), not a PE jump patch — with VICTORY_LIFT_DIR x86 site patches would not execute.
  • Off by default; full-scan fallback every VICTORY_STORE_SITES_EVERY frames (default 8). Empty marks fail toward a full remirror.

Test plan

  • store_sites unit test
  • Steady-world VICTORY_TRACE_DESCRIPTORS=sites (run 2500) — site concentration
  • Quiet A/B: STORE_SITES off vs on — remirror/mirror/execute/wall down, counts unchanged, present pixel-identical
  • Pre-existing mirror_tests::a_description_placed_again_over_other_bytes_is_read_again_at_once not chased

Made with Cursor

**@⁠jamal-fv** on GitHub · 2026-11-29 23:15 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/659) `jamal-fv:perf/descriptor-store-sites` → `main` · +75807 −6380 · 398 files · 383 commits · closed without merging Refs #43 ## Summary - Track descriptor heap slots the title writes (arm lift `rt_note_store` + HLE memcpy) and remirror only those slots instead of rescanning bound tables. - Mechanism is a copied-write hook (`VICTORY_STORE_SITES=1`), not a PE jump patch — with `VICTORY_LIFT_DIR` x86 site patches would not execute. - Off by default; full-scan fallback every `VICTORY_STORE_SITES_EVERY` frames (default 8). Empty marks fail toward a full remirror. ## Test plan - [x] `store_sites` unit test - [ ] Steady-world `VICTORY_TRACE_DESCRIPTORS=sites` (run 2500) — site concentration - [ ] Quiet A/B: `STORE_SITES` off vs on — `remirror`/`mirror`/`execute`/`wall` down, counts unchanged, present pixel-identical - [ ] Pre-existing `mirror_tests::a_description_placed_again_over_other_bytes_is_read_again_at_once` not chased Made with [Cursor](https://cursor.com)
Legacy SSE integer forms reuse the VEX helpers in place. AES and PMULL use the ARM crypto
extensions. Diff tests against Rosetta for what it can run, known-answer tests (FIPS-197,
bitwise clmul, SDM definitions) for VAES/VPCLMULQDQ ymm, insertq/extrq and adcx/adox.
The title now lifts all but 6 functions (decode failures).
rt_host.c: dispatch over a hash built from the generated table, pluggable logged fallback for unresolved
targets, import thunks that marshal win64 arguments out of the Cpu into native calls, rt_call_guest for
host to lifted callbacks, per-thread TEB/stack, Zen 2 CPUID/XGETBV/RDTSC. gs: accesses read Cpu.gs_base.
Shared memory accesses are emitted as sld*/sst* so a build flag can order them.
victory-rt loads the lifted dylib into an arm64 process, maps the PE, binds its import table to Rust
functions and runs exports; tested end to end on a fixture with a real host.dll import table.
MP, SB, SB with mfence, LB and IRIW as lifted plain accesses against x86 under Rosetta.
-DRT_TSO makes shared (not rsp/gs based) loads acquire and stores release; -DRT_TSO_ALL orders
the stack too. Plain lifted code shows MP and SB reorderings; both TSO builds show none.
Input (apps/victory/src/input.rs, on the main thread beside the window's
event loop):
- Keys go to GameInput as Windows virtual keys and set-1 scan codes; key
  events are not passed on to AppKit (no beep) unless Command is held, so
  Command-Q still quits.
- A click in the window captures the mouse (pointer hidden and held): its
  motion turns the right stick, left button the right trigger (fire),
  right button the left trigger (aim), middle the right stick's click. F1
  or losing focus lets it go. VICTORY_MOUSE_SPEED (points a second for a
  full stick, 1500).
- Pads from Apple's Game Controller framework (DualSense, Xbox and others)
  are host pads 0-3: cross/circle/square/triangle as A/B/X/Y, Options as
  Menu, Create and the touchpad's click as View; player lights set.
- The keyboard and mouse also drive the first host pad, so both work at
  once; extra keys where a PC player looks: Space X, left Shift A, R B,
  G Y, left Control the left stick's click, V the right stick's click.
- Key presses are logged (to replay a run's path through the menus).

Window title, once a second: frame rate, frame time, GPU time a frame
(from command buffers' GPU start and end), draws a frame, draws dropped,
frame number. VICTORY_SHOTS=<dir>,<seconds>: the last frame at a quarter
size as PPM, for runs nobody watches.

Tried with Bahadır's keyboard: the start screen, FINISH SETUP and LEGAL
NOTICES pass with Enter and the arrows, into the loading screens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Input: our window input (keys with scan codes, mouse, Game Controller
pads) stays in the loop; upstream's key table is taken (Tab Menu, V View,
Space and Enter A, Esc and Backspace B) with our extras (left Shift A,
R B, G Y, left Control the left stick's click), and its live keys still
reach the pad through the same keys() (its window hook is left unused).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Memory the title reserves first and commits later was committed plainly,
where the GPU backend (which resolves title addresses by pool) cannot see
it. Now the parts no view shows and nothing committed yet get pools of
their own. Not reached yet in Grand Theft Auto VI's runs so far (n10 logs
no such commit); kept for the views that still say "not in a mapped pool".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
- victory-metal: a pass that cannot be encoded no longer drops its command
  buffer (the queue-order wait was already encoded and the next buffer waited
  for its signal for good: the title's fence never moved and its watchdog
  crashed it 30 s later, at the loading screen's end). An indexed draw
  without an index buffer is left out without leaving the encoder open.
- victory-metal: a render pass with no targets (pixel shaders writing only
  UAVs) gets its size from the draws' viewports (else scissors); Metal made
  no encoder for it.
- ExecuteIndirect of dispatches (types 2 and 105, count not in a buffer) runs
  on the native host: Metal reads the group counts from the argument record.
- A buffer view the host cannot make clears its heap entry: the stale entry
  let the GPU write where its previous view pointed.
- Translator: v_permlane16_b32 / v_permlanex16_b32 (inside one 32-lane half,
  so one host wave), v_cvt_pknorm_u16_f32 / v_cvt_pknorm_i16_f32.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
- Image stores and typed buffer stores of some channels (dmask / format
  count) write the enabled channels from their VGPRs and 0 to the rest.
- FSPX compute programs take root constants: a block runs from its record's
  user SGPR to the next parameter's, or to the last user SGPR (RSRC2).
- s_pack_ll/lh/hh_b32_b16, s_absdiff_i32, v_ldexp_f32 (two exact powers of
  two), v_mad_u32_u16 (op_sel halves).
- Crash diagnostics: an access violation logs every register, the bytes at
  those that look like title addresses, and whether a pool holds them and
  which heap buffer views cover them (victory_core::crash, set by the app).
- Logs (first 200 each) of the title's big reservations (VirtualAlloc,
  XMemVirtualAlloc) and of commits that no pool backs, to place the
  addresses of "not in a mapped pool".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
- NativeHost::execute leaves out a command whose arguments cannot be made
  (a root parameter never set, memory no pool holds) instead of refusing
  the whole submission: other queues waited on memory that submission's
  other work writes, and on its fence signals (n14: three queues held for
  30 s, then the title's watchdog).
- Buffer views of memory no pool held when the title wrote them (the
  title writes views before mapping their pages; 750+ per run) are made
  again when the pool table changes.
- FSPX compute root constants of slot 255 (no root parameter) are refused
  again: nothing is known to fill them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Conflicts: our window input (crate::input: keys with scan codes, mouse,
GameController pads, the window figures) stays in the event loop; upstream's
modifier_key helper is kept for its key_event (kept for its test). In
gameinput, the stand-in pad keeps the mouse merged onto the keyboard one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
- Resource heaps reach HEAP_VIEWS entries (when the title's entries and
  the contract's fit) with null views at its last two, and carry a
  view-stride table (a dword per entry: element size, integer-format bits;
  0 for no buffer view), kept by `mirror` and bound as root SRV
  VIEW_STRIDES. Shaders taking buffer views at computed heap indices read
  it; without it their commands were left out ("root parameter 255 was
  never set", 40 a run) and the title's watchdog ended it 30 s later.
- Translator: the thread-group info SGPR (TG_SIZE: wave count, wave index
  over console waves), s_sext_i32_i8/i16.
- VICTORY_DUMP_THREADS=0 also dumps every thread at a write to address 0
  (the title's watchdog crashes that way).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
n17's thread dump at the title's watchdog: the main thread waited on the
render subsystem, which waited on its worker threads, all four inside host
calls: a scene's first frame binds ~1,100 new pipelines, translated and
converted one by one under the host's lock (~10 a second at the end), for
30 s, past the watchdog.

- Pipelines' shaders are translated when the title creates them, on a
  pool of threads (VICTORY_PREFETCH=0 off, =<n> threads), and compute ones
  converted to Metal libraries too.
- Metal Shader Converter conversions are kept by their input (a memo), so
  the pipeline made later finds its library; those made ahead up to 1 GiB.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
On a 32-lane host (Options::wave32_host, the native Metal host) a wave64
compute program runs as two host waves per console wave, and what
reaches across the halves (ballots, lane reads, whole-wave reductions,
LDS shared without a barrier) meets at a group barrier. In a per-lane
branch or loop the two halves may not both arrive, so such a program
was refused.

Such programs, where the group is one console wave, are now made again
with the per-lane branches around the places where the halves are apart
taken by the whole wave, as the console's scalar unit takes them
(structure::structure_wide): the wave goes into an `if` where some
lane's EXEC bit is set, round a loop while some lane is, and EXEC stays
a guard on every vector instruction inside. Each such decision is the
console's: each host wave asks its lanes (WaveActiveAnyTrue, or AllTrue
for execz and vccz) and the halves exchange the answers through the
group-shared `xchg` array (lower/halves.rs, halves_decide), so both go
the same way and are together inside, where the existing exchanges and
LDS barriers then go, in loops too when every branch of the loop is
scalar or taken wave-wide (lower::together_blocks). The branches are
found from the blocks the lowering reports apart (lower::take_needs,
lower::branches_around: the mask branches those blocks depend on,
transitively; those to the program's end last) and added until no
block is apart (emit::widened).

A branch taken wave-wide is an Atom::Wave in the per-lane form, the
lane's own bit kept apart (Structured::lane_when), so that every
analysis that reads a branch as what a lane does sees the wave's
decision instead. EXEC joined at a loop header from a latch only scalar
code reads is now known along the back edge (Lanes::phi_args), which
such loops need once lanes outside EXEC go round. The halves form is
refused where a scalar branch they meet at tests a value the lanes may
hold differently (a join after a per-lane branch, or a first-lane read,
which is each half's own on this host: lower::scalar_parting), so that
no host wave waits at a barrier the other does not reach.

Programs that translated before are made byte for byte as before (the
walk runs only after a refusal). VICTORY_WAVE_WALK=0 on the native host
(Options::no_wave_walk) refuses them as before.

On the Wine route (D3DMetal, the same 32-lane limit), where our tree
runs wave64 programs as halves on a different lowering, the same walk
made 148 of the 153 wave64 programs bound in a recorded frame get a
Metal pipeline (115 before); the frame took 3.7 ms more GPU time with
the extra work drawn, and shadow blocks and missing culling were fixed.

Tests: emit/walk_tests.rs (six programs refused without the walk and
made in 32-lane waves with it; a program whose halves meet unchanged),
structure tests for the wave-wide branch and the loop header's EXEC,
and native/walk_tests.rs in victory-gpu, which runs the walked programs
on the GPU through Apple's converter against the console's results.

After f2f31d5 and 228be7c of our tree, re-applied by hand on the
wave32_host lowering.
Two reductions a branch chooses between that share their end (each arm
saves EXEC and reduces up to the read of lane 32, the join reads lane 0
and restores EXEC: cond ? WaveActiveMax(x) : WaveActiveMin(x)) leave no
block with a whole section, so the wave simulation does not follow them
and v_permlanex16_b32 is refused, or lowered on its own where the
console's section reads every lane. When a program does not translate,
or permutes lanes outside the sections the simulation follows, it is
translated once more with each such section in one block
(ir::whole_sections: the block that starts it takes the join's code and
exit, a copy where other ways lead there too; up to four rounds), and
that translation is taken if it succeeds. The SSA renaming is split out
of ir::build_bounded (ir::rename) so a changed program can be renamed.

On our Wine route, of the 19,106 containers of a frame capture,
a929109552ce1e84 (a compute program refused for v_permlanex16_b32) now
translates; the other refusals are lane-mask joins and lane masks read
as data, which this does not move. A test builds the two-arm program and
checks the sections are found whole after the join. Programs without
such a permute or refusal translate as before.

After darkworldhm/victory-fork-darkworldhm (ir::whole_sections).

(cherry picked from commit fdcc89332cf7af7c4f01a2beb2a57590ff83a000)
n19 died of a Metal "GPU Hang Error" at the scene's start (the other
buffers discarded as victims, their fence signals with them, then the
title's watchdog). Each submission's command buffer is labelled with its
command and draw counts and the compute shaders it runs, and a failed
buffer's report prints the label.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
A small kernel copies each indirect dispatch's three group counts into a
slot of its own and zeroes them when they cannot be a dispatch the title
meant (a count past 65535 or more than 2^22 groups); the dispatch reads the
slot. Counts read from memory that dropped work never wrote are a likely
cause of the GPU hang at the scene's start (n19).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Upstream's v_permlane16/x16 lowering (fi and bound_ctrl followed) replaces
ours; our console-lane marking for v_permlane stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Surface::read_last read the presented texture with 4-byte rows whatever
its format. Once the scene presents a half-float (RGBA16Float) texture,
Metal wrote twice the buffer, over the host heap where the title's own
objects live: their pointers became half-float texels (+-inf, the cleared
HDR target), and the title crashed a second or two after the scene's
start ("AGX: Texture read/write assertion failed: bytes_per_row >=
used_bytes_per_row" just before; n12, n13, n20, likely n18). Only runs that
read frames (VICTORY_SHOTS) were hit. Rows are now the texel's size, and
wider texels are clamped to 8 bits for the caller; unknown formats none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Indices 0 and 1 are the converter's descriptor heaps: a dispatch after the
kernel that reads a heap the host does not bind would have found the
kernel's buffers there. VICTORY_INDIRECT_DISPATCH=0 drops indirect
dispatches as before, for comparisons.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
This reverts commit 250a448739fcb5dd2b58e42dca146b924dc15c60, reversing
changes made to 027a7a6b02766736241a7c4baa9a559852e853a0.
This reverts commit 027a7a6b02766736241a7c4baa9a559852e853a0, reversing
changes made to b8242bf59654e9d6f623dc2f5d14bbd40ff76f8b.
This reverts commit b8242bf59654e9d6f623dc2f5d14bbd40ff76f8b, reversing
changes made to e05ff95bcec141c40c064bc76d9d3c5587cba5fe.
This reverts commit c0b54db942.
The n26 windowed run of d5a3ca0 logged 3,000 buffer-view rejections
across 64 KiB boundaries. It reached a draw counter of 6656 before
the 900-second run limit.

Follow adjacent title mappings when their backing offsets are
consecutive in the same physical pool. Reject gaps, repeated pages
and different pools. The regression test maps three pages separately
and verifies both the resulting span and the rejected cases.

The pool tests, x86-64 macOS release build and asset policy check
pass. The three failures in the wider host tests also reproduce on
d5a3ca0. The game run used the pre-fix build.
The windowed n27 run of 4c255d6 reached prologue prestreaming and
then exited on an access violation. All 16 GPU address descriptions
were unavailable. The locked-title regression test reproduces that
missing information for a mapped address.

Share the crash metadata independently of the title lock. Obtain pool
and mirrored buffer-view information without waiting, and include
whichever table is available in the existing crash report. Remove a
view's metadata when its slot is cleared, replaced with a texture or
its descriptor heap is released.

The five focused tests, x86-64 macOS release build and asset policy
check pass. The wider GPU suite has the two failures reproduced in
the pre-fix n26 comparison. The game was run once on 4c255d6.
n28 reached prologue prestreaming before the title watchdog fired.
Symbolizing its host calls identified reset_x on the render subsystem
and other threads in execute_x and compute_table. Pool information
was unavailable in all 16 crash address lookups.

Check a heap's cached page table generation before copying the mapping
list. Resolve each root view by its one pool address instead of copying
and scanning the entire map. On a remap, rebuild the table from a fresh
snapshot and keep using the same pool-offset contract.

The regression tests reproduce two unnecessary snapshots for two root
lookups and two snapshots across two identical dispatches. They now
verify zero snapshots for the root lookups and one for the two
dispatches, with a rebuild and correct writes after remapping.

Thirteen focused tests, the x86-64 macOS release build and asset policy
check pass. The wider GPU suite still has the two baseline failures.
The effect on the watchdog has not been measured in the game.
Conflicts: PoolTable::resolve keeps ours (bounds-checked, range walk) with upstream's comment and tests;
execute keeps upstream's cut/no-target/unset-root drops and still leaves out any other command that
fails to prepare (not the whole submission); the first-chance dump goes through report_at_fault and
also fires at the watchdog's write to address 0; typed buffer stores take upstream's form.
The unmapped-address test now expects the command to be left out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Our native host work (view strides, indirect dispatch, prefetch, translator ops, crash reports, pool
spans, input) and upstream main since 19a6b59, on the recompiled-title branch. Conflicts take the
newer code with the arm64 ABI: extern "efiapi" for every HLE function (the WASAPI and spatial audio
modules that came with main too), crate::title::call_win64 for calls into the title, and fn_addr! in
their method tables so the methods with floats by value (spatial SetPosition/SetVolume) are called
with their signature. The x86 thread dump, memory watch and write trap stay x86-only; the handle
traces' caller chain is empty on arm64. input and window build on both architectures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
The pool-offset page table of a heap was rebuilt whole whenever the pool table's generation moved:
a snapshot of every mapping under the pool lock (which the title's own map calls wait on, under
xmem's page-table lock), a new buffer, all under the title lock, for each command whose shader reads
memory, as soon as the streaming threads mapped a page in between. And only the last 8 tables were
kept: a superseded table was freed while queued GPU work still looked addresses up in it, so the GPU
could read and write title memory through stale or reused words (n24/n27/n28: frames at 0.8 fps in
the prologue prestream, DirectStorage waiting, the pool table locked at every crash read, f16 and
+-inf in pointer fields).

Now PoolTable keeps a journal of the ranges each change touched (bounded; a table further behind is
built again), and a heap's addr::Table is built whole once and then brought up to date in place:
only the 64 KiB pages that changed are rewritten, each entry in one 64-bit store, a new block before
level 1 points at it. A table that outgrows its buffer is copied into one twice the size and the old
one is kept. A page now shows a pool when all of it shows one run of the pool (mappings of 16 KiB
pieces in pool order included). A "page tables" line every 5 s says what was done; a pool with no
view pair left is warned about once.

The title lock records who holds it: holds and waits of 200 ms or more are logged with the caller.

Tests: the journal (changed pages, a released pool, a table too far behind), a kept table against
one built whole after unmaps, remaps, quarter pages and growth, and the GPU end to end following a
remap in place with no rebuild and no snapshot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Function discovery walks from each start and takes an in-range forward jmp
as internal, stopping at `jmp reg`; so a thunk's target (a1: rva 0x9f6400)
and a switch case that tail-calls (a2: rva 0x5b4c9f0, the case reached
through a jump table in .rdata) were left out, and the lifted image aborted
there ("rt: no fallback installed").

`discover::sweep` decodes each final extent linearly and keeps its direct
call / jcc / jmp targets and executable `lea rip` targets;
`escaping_targets` returns those that land in no function (to feed back as
seeds) and those that land in the middle of one (reported only).
`victory-recomp escapes <pe> [seeds]` prints the first to stdout, the
second to stderr. On game_scarlett_master: 481 seeds, 61 targets into the
middle of .pdata functions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
- ds_bpermute_b32 in a wave of 64 permutes lanes 0..31 and 32..63 apart
  (RDNA 2 ISA 10.4.4): the lane read is the address modulo 32 in the
  reading lane's own half. It was lowered as a read across the whole
  console wave plus a 64-lane ballot, both exchange sites on a 32-lane
  host, so in divergent code it was refused ("cross-lane operation between
  host waves in divergent code", 34 programs in n28 with the others of
  that reason), and where the address wrapped past 31 it read the other
  half. It is now the host wave's own read and ballot. After
  VIctory-macOS 0665a0e8 (QB) and ka1qux f9a5034 (its test checked all 64
  lanes against RDNA 2 hardware). Tests: the permute lowers with no
  barrier and no exchange, also under an EXEC branch.
- An immediate sampler used with a comparison sample clears the reduction
  bits (0x180) before setting the comparison one (0x80): a minimum sampler
  (0x100) became a maximum one (0x180). After ka1qux 93b9b2f, port of
  Marvisak/VIctory #2983 (RVZO6).
- SDWA destination WORD_0 with dst_unused 1 (sext) copies bit 15 upward:
  a 16-bit -1 came out as 0x0000ffff. After fxceless 58de9bf (upstream
  VIctory #3124).
- BC7: the 2-bit rotation field exists in modes 4 and 5 only; in the other
  modes those bits are other fields, and reading them swapped a channel
  with alpha (wrong colours, a shift past the width in modes 0, 1, 3).
  After ka1qux 765d9fa (upstream VIctory pull request #3111). Test.

The shader translator changed: its cache keys move with the build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
a3 trapped 25 s in ("jump table index out of range", f_53bf950): the table
at rva 0x67694f4 has 8 cases, and the size came from `cmp r8d, 7` / `jae`,
after which the index is `add r8d, 2` and a branch target joins. The size
was taken from the last compare-and-ja within 40 instructions on any
register a move connected to the index, whatever happened in between.

Now `index_bound` reads forward to the table load with value numbers: a
plain copy (`mov eax, r13d`, `movzx r10d, dl`, `movsxd rax, ecx`,
`mov r8d, r8d`, `cdqe`) passes a value on, any other write (and a call, for
the registers the Windows x64 convention gives the callee) makes a new one,
a compare followed by ja/jae bounds the value it tests (the least of its
checks), and a branch target forgets everything before it. The load's
index is bounded by its value's check, or, for MSVC's two-level switch
(`movzx eax, byte [base+idx+bytes]`, then `mov ecx, [base+4*rax+table]`),
by the largest of the byte table's checked entries plus one. A table also
ends where the function's next table starts (tables sit side by side in
.rdata, MSVC's byte table right after its offsets); up to there an entry
in other code is a tail-call case, as with a check.

Over the exe's 3434 tables (`victory-recomp tablelist <pe> [seeds]`
prints them, to compare builds): 208 change. 167 unchecked tables no
longer run on into the next table's entries (21 -> 5 cases and the like);
10 MSVC switches go from 3-56 cases to their 2-47 real ones (the rest were
bytes of the byte table read as offsets, one as rva 0x10100); 28 checks of
another or a changed value no longer bound (2 of them had read one entry
of the next table; f_53bf950's two tables go from 7 to 8 cases); 3 tables
are newly bounded by the check of a copy made ahead of it (as at 0x22e39e3,
where the looser outer check would give 41 cases running into other
functions). Tests for each case.

Functions entered in the middle: a direct jump, call or executable
`lea rip` from one lifted function into the middle of another one (not its
own chained parts) went to the dispatcher, which has no function there.
Each such address that is an instruction of a function without landing
pads is now an entry of its own, `f_<rva>`: the same body after the
prologue, `goto` its label (`FuncIn::entries`, `inner_entries`); one that
is no instruction start gets a function that traps, so the table always
links. The exe has one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
a4 got past a3's trap, showed the intro (the first frame drawn by the
arm64 build), presented black frames from then on and read nothing more
from disk: title-main sat in 762 of 762 samples on one instruction of
f_9dcac0, `b .`. The guest code there (rva 0x9dd0d7):

    lock inc dword ptr [rax]          ; one more job handed out
  spin:
    mov eax, dword ptr [rsp + 0x48]   ; the counter the workers raise
    cmp eax, 8
    jne spin

The counter lives on the waiter's stack and the workers write it through
the address it handed them. Stack accesses are lifted as thread-local
(plain), so clang took the read as loop-invariant, the loop as endless,
and emitted a branch to itself.

`spin_reads`: in a polling loop (a backward branch over at most 16
instructions that only load, compare, test and branch: no call, no store,
no register arithmetic, so nothing of its own changes between turns) the
reads of fixed stack slots are emitted as shared accesses (acquire under
RT_TSO), which clang must repeat and which order what follows the exit.
In the exe: 50 such reads in 27 units. And `pause`, a spin-wait hint, is
lifted as ARM's `yield` with a memory clobber, so a waiting loop with it
reads memory again on every turn whatever it reads (182 units have one).
Tests: the spin above, a loop that writes its slot, one that calls, a
search loop that counts, `pause`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Upstream main since af380ca: #84 (s_pack_*_b32_b16, s_bfm_b64,
s_bitreplicate_b64_b32, v_mad_u32_u16), #86 and #93 (SCC of
s_lshl<n>_add_u32 and of s_add/s_sub/s_addk_i32), #92 (sample and gather
variants with offsets and comparisons), #83 (root signature blobs read
without a host d3d12.dll), #85 (FSPX root types refused by name), and the
UCRT fixes #70 #71 #72 #73 #96 #97 (vsprintf buffer rules, printf hex
precision, strtod hex scale and underflow, memmove_s, ilogb of a NaN).

Conflicts: ucrt/math.rs `ilogb` takes main's NaN case in the arm64
branch's `extern "efiapi"`. native.rs: this branch takes root constants in
compute shaders too (the block runs to the next parameter's first SGPR),
so main's new test of refused root types leaves type 0 out and keeps this
branch's check that root constants are a root parameter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
The arm64 run and main (#84) each added both; the run's arms came first,
so main's v_mad_u32_u16 (which refuses op_sel on the 32-bit addend and
integer modifiers, as its test expects) was never reached. Main's
v_mad_u32_u16 stays, and the run's s_pack lowering (the same as main's).
victory-shader: 235 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
a5 (the spin fix in) read on from disk past a4's stop and then aborted:
`rt: unresolved guest target 0x143de57f7 (inside an image, not a lifted
function start)`. f_3de2550 is a bytecode interpreter: `lea r12, [rip +
0x6553900]` once at its top, then `imul eax, edi, 0x3315` / `movzx ebx, ax`
/ `jmp qword ptr [r12 + 8*rbx]`, through 530 absolute addresses of its
handlers (relocated with the image). A jump through memory went to the
dispatcher, which has no function at a handler.

`find_jump_tables_ext` now takes `jmp qword ptr [base + 8*idx]` whose base
is an `lea base, [rip + table]` of the function (the last one before the
jump, else the first after it: the interpreter sets r12 once) as a table of
64-bit addresses (`Entry::Abs64`, beside `Rel32` and `Rva32`), sized as the
others without a check: up to the function's next table, else while the
entries land in the function. The lifter sends such a jump to one switch per
function after its body (`jt = <address>; goto JT;`, `jt` declared with the
prologue), whose default goes to the dispatcher as before; a function with
none keeps its old text byte for byte (so a relift rebuilds only the units
that changed). In the exe: three such jumps (the interpreter's two, and
0x5141259), 545 and 42 cases, every one in the function an instruction
start. Tests: the recovery, and the switch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
a6 trapped ("jump table index out of range", f_1ffa540): the function's
switch is `movsxd rax, [r8 + 4*rax]` / `add rax, r8` / `jmp rax`, and one of
its cases is a virtual call in tail position, `mov rax, [rcx]` /
`mov rax, [rax + 0x78]` / `jmp rax`. The table finder took any `jmp reg`
with a scaled load and an add of the base into the jump's register within
40 instructions before it for a switch, so the virtual call got the
switch's five cases, and its real target trapped.

`feeds_jump`: the load writes the offset, an `add off, base` (the jump
takes off) or `add base, off` (the jump takes the base) follows, and on the
way from the load to the jump nothing else writes the offset and the base
(before the add) or the target (after it), no unconditional jump, indirect
jump, return or interrupt breaks the flow, and no branch target (the jump
included) joins another path. In the exe this takes the table from eight
jumps, all virtual calls in tail position behind a switch (0x11e405d,
0x11e4096, 0x11e40ae, 0x11e40d4 behind the one at 0x11e4047, 0x1ffa572,
0x4c497d, 0x2e800c9, 0x43833c1), which now go to the dispatcher; no real
switch loses its table. Test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
a7 aborted in bink2scarlett.dll: `rt: unresolved guest target ... rva
0x1751f`, a case of the switch at 0x1751d that the last change had taken
the table from. Bink (MSVC) loads the offset over its base register and
sets the base again in another one for the add:

    movzx ecx, byte ptr [rdx + rcx + 0x17a74]
    mov   edx, dword ptr [rdx + 4*rcx + 0x17a5c]   ; offset over the base
    lea   rcx, [rip - 0x1751a]                    ; __ImageBase again
    add   rdx, rcx
    jmp   rdx

`feeds_jump` now keeps the registers that hold the base: the load's base
register (unless the load overwrites it) and any one an `lea` of the same
address sets on the way; a write to one takes it out. The add must take one
of them. Over the 17 images, against the table recovery before
`feeds_jump`, only the eight virtual calls in tail position in the exe lose
their tables; Bink's switch is back (6 cases). Test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
a8 got through the loading screens and aborted at rva 0x51413db, a handler
of the interpreter at 0x5141100. It has two opcode tables, 0x6681790 (set
just before the dispatch) and 0x6681640 (set at 0x51415f8, which jumps to
the dispatch past the first `lea`), and one `jmp qword ptr [rdx + 8*rax]`.
The dispatch took only the `lea` before it.

Every rip-relative `lea` of the base register in the function now names a
table the jump may take; each is sized as before (the first ends where the
second starts), and `tables_for` gives the jump the cases of all of them.
A case can never misroute (the switch compares the address the jump read),
so a table of an unrelated `lea` costs only labels. In the exe the
dispatch at 0x5141259 goes from 42 to 84 cases, and 0x301360f gets one (16
cases) where it had none. Test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Bring Metal residency, mesh/f16, pool/CB, and boot survival fixes onto the arm64 tip.

Co-authored-by: Cursor <[email protected]>
Bring in remote Metal off-frame compiles, shader skip-edge joins, and HLE fixes while keeping the arm64 prove branch tip current.

Co-authored-by: Cursor <[email protected]>
The branch's committed HEAD (93f40598, a merge of origin/main) does not
compile: it added `PassSubmission::label` but none of the 13 call sites
set it, and nothing reads it. The working tree had drifted back to the
pre-merge arm64 state (98 files, 64 of them byte-identical to HEAD^1) plus
34 local edits, and only built because one of those edits deletes the
dead `label` field.

Commit that working tree so the branch compiles again and workers have a
base to verify against. Content is unchanged: this is the tree every
prove from 285 to 303 built and ran. `pr-115-arm64-recompile` still
points at 93f40598, untouched.

Also in this tree, from this session:
- apps/victory: the on-disk shader cache was gated to Windows by a local
  cfg(windows); restored, so macOS stops re-translating every shader
  (measured 542 CPU-seconds a run).
- crates/victory-gpu/src/native/perf.rs: VICTORY_TRACE_PERF=<n>, a
  per-frame record/present/translate/GPU split.
- runs/one-prove.sh: it used rg (absent on the wrapper PATH) and parsed
  ANSI-coloured logs, so every score recorded frame=0.
Co-authored-by: Cursor <[email protected]>
MTLSharedEvent ignores signals at or below signaledValue; D3D12 allows rewinds and repeats, so start a fresh shared-event epoch when a fence value does not advance.

Co-authored-by: Cursor <[email protected]>
Record what differed from main, what was ported, verify output, and falsifiers.

Co-authored-by: Cursor <[email protected]>
Without these, DXGI depth-plane shader views fall through format() as None and mirror the raw depth texture instead of a float plane view (#439 cause 1).

Co-authored-by: Cursor <[email protected]>
Depth twins sync through a staging buffer; this tree's BlitOp was buffer-only after the arm64 prove snapshot. Adds CopyTextureToBuffer / CopyBufferToTexture and Metal encode with DepthFromDepthStencil.

Co-authored-by: Cursor <[email protected]>
Metal cannot shader-write depth textures. Port #258+#439 behaviour: colour twin at first depth-plane UAV (object or placed), full mip/array routes, immediate remirror of stale heap entries, and Depth/Twin/Both sync so render passes that sample see fresh depth.

Co-authored-by: Cursor <[email protected]>
Record which of the four causes this tree had, what was ported, verify output, and falsifiers.

Co-authored-by: Cursor <[email protected]>
World sample put BLAKE3 texture hashing at ~39% of samples because each
scanner round hashed every watched texture; resume at the next key.

Co-authored-by: Cursor <[email protected]>
Already present (2 ms / 32); world streaming needs the deadline stop after
the minimum so thousands of blank textures never stall a submission.

Co-authored-by: Cursor <[email protected]>
sync_keys hashed serially on the submitting thread; world dirty batches
pay BLAKE3 on one core. prepare() now shares the read across 6 threads.

Co-authored-by: Cursor <[email protected]>
Orchestrator needs batches/textures/MiB and lock vs off-lock times per
second to measure whether SCAN_BUDGET cut the ~39% BLAKE3 samples.

Co-authored-by: Cursor <[email protected]>
Documents what the arm64 tree lacked vs main, the four commits, and the
cargo test -p victory-gpu result including the known streams flake.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
All of the native macOS host work behind #380 as one commit on a6a58361:
mesh pipelines, described stream pipelines, buffer views over pool runs,
view address and stride tables, console-flow lowering, rectangle lists with
stage-in attributes, depth twins, residency sets reconciled at commit,
cheaper descriptor mirroring, attachment-less passes for target-less draws,
R9G9B9E5 aliasing, mesh output fitting, GPU copies into texture levels the
host left out (the texture is made again with every level), GPU lifetime
rules for retired heap objects, span buffers and title pools, and
diagnostics. See the pull request text for measurements.
Load TRACE peak ~1044 ms/s off-lock hash with ~96 unchanged/s: each upload was hashed again because seen lived only on the scanner thread.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
SetPipelineState, viewport, scissor, blend, stencil, index/vertex buffers,
root constants/views, buffer copy and value write only touch the list.
with_list_at runs those under the list lock alone so recording threads stop
queuing on the host mutex for work that never needs it.

Co-authored-by: Cursor <[email protected]>
create_placed_srv/create_srv used to realize a host texture for every view.
Most are never bound; leave them pending and realize from take_wanted at
sync. remirror_tables skips unchanged pending entries until the pool table
or resources_epoch moves, so failed mirrors are not retried every draw.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Repeated Create*View of the same descriptor under the title lock was
rebuilding the backend entry every time; leave it alone while the stamp
matches.

Co-authored-by: Cursor <[email protected]>
An unrelated registration bumped the global epoch and would force every
table entry through mirror again; revalidate stamps whose named key is
unchanged instead.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Take main's victory-gpu/metal/shader/backend host; keep the lift
(recomp/rt) and re-apply arm64 HLE adaptations (xmem exports, call_win64
host callbacks, may_map on macOS, LIVE_PAD fallback, method_sigs/hud).

Co-authored-by: Cursor <[email protected]>
Conflict resolutions favour union: covering+resolve_prefix, Binding heap+heap_access,
SKIP_PIPELINES+skip_builder, sized index buffers, resolve_or_alias+spans, attach_refund
on pr437real's dense/frame_time metal backend.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Main's MTLSharedEvent epoch path must drive submit waits/signals. Also align
mirror/Draw/Prep test callers with the merged Binding and alias tuple shapes.

Co-authored-by: Cursor <[email protected]>
Keep host/union host; retain arm64 lift adaptations (OWN_SCALE_FLOOR, aarch64
lift caveat, unconditional SEH dispatch, x86-only step_over).

Co-authored-by: Cursor <[email protected]>
Add mesh_fit/bvh_no_hit to the leftover gfx_refusal_tests Parts init (matches main), and record the two-merge union resolutions and acceptance proofs.

Co-authored-by: Cursor <[email protected]>
Port main's encoder-scoped heap residency onto the dense Heap, and
full mip×slice depth twins into twin.rs. Retarget wrap-walk asserts
to main's generation-tagged title_alias SIGNATURES counts.

Co-authored-by: Cursor <[email protected]>
Consecutive compatible records share one GATE kernel and one Metal-tracked buffer;
VICTORY_GATE_BATCH=0 restores one gate per record. Same clamps as before.
64 compute records: 64 gates off, 1 on; same for draws, mesh, and rectangle lists.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
World frames spend ~200 ms on whole-texture sync and remirror ~82k records because work scales with what is bound, not what changed (~532k entries checked).

Co-authored-by: Cursor <[email protected]>
Change-proportional remirror needs faulted page bases, not only store sites; ~532k entries are checked a frame today because dirtiness was invisible.

Co-authored-by: Cursor <[email protected]>
Offline model: 532k bound checks → ~40k on dirty pages; texture pools stay unarmed under Rosetta (issue #1).

Co-authored-by: Cursor <[email protected]>
bind_root no longer takes a named list; the cherry-pick left a Vec::new
that failed type inference at release build.
Document per-test residue verdicts and cherry-pick resolutions. Add
heap_access to gate-batch Dispatch constructors so victory-metal tests
compile against the #382 field.
Extends change-proportional.md: write watch is legal on arm64 for textures;
lifter store hook is a separate deliverable. Correctness, mapping, and
fail-toward-full-read fallback spelled out before code.

Co-authored-by: Cursor <[email protected]>
Key-level dirty oracle, textures_ok gate (flag + fault_tracking), arm()
range packing, and 16 KiB page measurements for the arm64 change signal.

Co-authored-by: Cursor <[email protected]>
On arm64 (fault_tracking) the submit watch covers texture ranges after
heaps; sync drops already-uploaded armed keys with no dirty page.

Co-authored-by: Cursor <[email protected]>
Point at reports/arm-change-signal.md; Rosetta still heaps-only.

Co-authored-by: Cursor <[email protected]>
Native macOS has no victory_gpu::watch; aarch64 is the stand-in for
faults that resume. Align design and docs with the compile-safe gate.

Co-authored-by: Cursor <[email protected]>
Inventory of per-frame host work, what is independent vs serial, and the
VICTORY_PARALLEL_HOST locking discipline that preserves second/third-pass
semantics. Offline model expectations included; no game run.

Co-authored-by: Cursor <[email protected]>
Flag-gated std-thread fan-out, heap remirror classify, and a modelled
frame that proves wall time falls as workers are added with identical
results. Default off.

Co-authored-by: Cursor <[email protected]>
Texture prepare worker sizing and probe reads fan out when the flag is
on; remirror classifies distinct heaps in parallel then mirrors
serially. Residency commit and encode stay serial. Document the switch.

Co-authored-by: Cursor <[email protected]>
Apple Silicon has no timestamp counter set, so the switch forces one
pass per command buffer and uses GPUStartTime/GPUEndTime to rank kinds
and top passes at present.

Co-authored-by: Cursor <[email protected]>
Top compute entries now name the pipeline hash, thread-group size, and group
counts so a warm pass trace can point at specific shaders instead of kind alone.

Co-authored-by: Cursor <[email protected]>
Run 348 could not name groups= for the fat 22-pipe compute CB because mixed
labels only printed hash×cmds; top-three pipes now carry shape counts.

Co-authored-by: Cursor <[email protected]>
Port the separable fat-CB attribution dump from 98c9f97a without the ICB
per-command bind change, so multi-pipe compute passes list every hash.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Break down NativeHost::execute under VICTORY_TRACE_FRAME_TIME without
changing behaviour yet: follow, group (pass build), resident, and
prep_reuse (count) sit beside prep/backend/enc_*.

Co-authored-by: Cursor <[email protected]>
When a kept draw/dispatch shares PSO, binding, roots, heaps and threads
with the previous kept command (VICTORY_PREP_REUSE, default on), skip
remirror and translated_args and replay Prep. Move RootArgs into
Dispatch/Draw instead of cloning. Wire follow/group/resident timers.

Co-authored-by: Cursor <[email protected]>
World-frame parts from runs 348/351, new counters, prep-reuse cut, and
the ms prediction a coordinator run should confirm.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Off by default; filter by pipeline hash. Logs sizes and u32 values only
(no addresses) so a warm run can show whether fat-CB trip counts are zero
while dropped_unset_root stays 0.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Shared sst* (and mask/atomic/string notes) call rt_note_store when
VICTORY_CHANGE_PROPORTIONAL arms the lift; open-once dirty via the host
callback. Offline litmus + ns/store bench included.

Co-authored-by: Cursor <[email protected]>
When the runtime bridge is registered, arm publishes ranges without
mprotect and feeds the same DIRTY table; Rosetta and sites keep write-watch.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
A first upload left dirty set (insert into empty seen), so the next prepare
re-hashed unchanged textures during load.

Co-authored-by: Cursor <[email protected]>
within used to wait on archive add under the lock the serialize held;
return the PSO after compile and let the archive thread add and write.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Scalar word-at-a-time mixing was ~5x slower than BLAKE3 in the host
bench; stripe with independent multiply-shift lanes so release stays
memory-bound. Cache keys keep BLAKE3.

Co-authored-by: Cursor <[email protected]>
Before/after MiB/s (debug + release), 110 MiB ms, and the effect on
the load hash share. Offline only.

Co-authored-by: Cursor <[email protected]>
Keep host heap entries across submissions; when the store-hook/write-watch
signal is armed and pool/resource/span deps still match, visit dirty pages
only and fail toward a full scan on overflow or a never-armed watch.

Co-authored-by: Cursor <[email protected]>
Document VICTORY_PERSISTENT_DESC (console-vs-mac L3): signal, correctness,
relift prerequisite, prep/remirror prediction, and offline index ceilings.

Co-authored-by: Cursor <[email protected]>
A ring heap rewrites far more descriptor indices than it keeps live. Clearing
a slot left its 256-entry page allocated (empty Option<T> slots), so MALLOC
grew with every index the ring ever touched. Paged::take now frees an empty
page; Entries::remove and the D3D12 host keep path use it. VICTORY_TRACE_MEMORY
buffer lines also report title-asked vs Metal HEAP_VIEWS heap sizes and live
dense entry pages. Refs #639.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Stitch left one anonymous VM region per 64 KiB pool piece; world streams
grew ~87k untagged regions. Prefer wrap_title_memory when the title VA is
already mapped; keep Stitch for unmapped VAs and gaps. TRACE_MEMORY reports
stitch piece counts; unit tests cover the wrap preference and region split.

Co-authored-by: Cursor <[email protected]>
Document the 0xc000001d at image+0x55ff714 that stops headless
remeasure before the world on this tip (same RVA as prior attempt).

Co-authored-by: Cursor <[email protected]>
Add guest/guest_host timers around lifted call_win64 (TITLE holds pause
the pure-guest clock), per-callsite lock wait ranking on each present,
and a frame account line so wall minus guest+lock_held is visible.

Co-authored-by: Cursor <[email protected]>
Stuck fence lines report the producing title queue/action and whether
the signal is still held or already submitted, plus the Metal CB serial
when encoded; held queues name their head kind.

Co-authored-by: Cursor <[email protected]>
Document guest/guest_host, per-present lock-wait ranking, fence producer
lines, and why present/drawable read zero; report the traced run table.

Co-authored-by: Cursor <[email protected]>
World arena views refuse PoolTable::resolve (non-adjacent pool
mappings) and used to mach_vm_remap once per 64 KiB title page.
Coalesce covering entries into one Stitch piece per same-pool
contiguous run, and log resolve_refusal / wrap_skip on span make
so TRACE_MEMORY shows why the wrap path was not taken.

Co-authored-by: Cursor <[email protected]>
Record resolve_refusal (pool mappings not adjacent), per-run Stitch
coalesce, unit proof, and that headless world footprint is still
blocked on 0xc000001d before span TRACE.

Co-authored-by: Cursor <[email protected]>
Port open PR #466 (issue #434 class): restored_mask, no_mask_lane_through_joins,
and wave32 region-data-as-no-mask. Kept HEAD's fill_numeric_masks drain loop
alongside the new idom cache for dominates_join.

Co-authored-by: Cursor <[email protected]>
When a new range continues the preceding view in title address, pool offset
and READ_WRITE protection, remap the combined run once instead of adding a
Mach region per page. Unmap/protect/decommit of part of a coalesced run still
splits it. Alias and fresh scatter map whole contiguous runs the same way.

Co-authored-by: Cursor <[email protected]>
Join mapped() entries that are contiguous in title address and the same pool
so the TRACE_MEMORY mapping count scales with runs, not pages. Unmap still
cuts a coalesced run into the kept edges (split-on-unmap).

Co-authored-by: Cursor <[email protected]>
Port open PR #448 (issue #444 class). Kept #466's restored_mask helpers and
merged host_uniform_join / host_number into the same pending_masks drain.

Co-authored-by: Cursor <[email protected]>
Pass dumps used to print "indirect" whenever a pipe lacked one groups=
value, including long same-pipeline runs whose grids only differed.
Print "mixed" for that case so bulk hash×N is not mistaken for EI.

Co-authored-by: Cursor <[email protected]>
Port open PR #387 (buffer dword classes). Kept HEAD's texture-key guard in
address_words; classify()'s quick-mirror path now writes buffer_words too.
Mirror tests updated for the new dword 2/3 layout.

Co-authored-by: Cursor <[email protected]>
Armed repeat stores to the same page were paying store_open_add's
atomic table every time; cache the last added page per generation so
the hot path is a TLS compare (armed_hit drops to a few ns).

Co-authored-by: Cursor <[email protected]>
Pass dumps put ~89% on compute: fat cmds are memory volume, bulk is
per-command. ICB removes ~50 ms; 7 µs/draw is not reachable while fat
stays ~58 ms.

Co-authored-by: Cursor <[email protected]>
Corpus sweeps (refused-299): 70 newly translated, 0 regressions. World draw
recovery assumed at 92 of 355; #574 blocked behind image dword 5-7.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Snapshot dirty pages and armed keys once per submission (empty dirty
skips without a page walk). Probe/scanner content hits stay in the sync
set even when the store-hook table looks clean, so a missed signal
cannot leave a written texture stale.

Co-authored-by: Cursor <[email protected]>
Armed repeat stores to the same page were paying store_open_add's
atomic table every time; cache the last added page per generation so
the hot path is a TLS compare (armed_hit drops to a few ns).

Co-authored-by: Cursor <[email protected]>
Snapshot dirty pages and armed keys once per submission (empty dirty
skips without a page walk). Probe/scanner content hits stay in the sync
set even when the store-hook table looks clean, so a missed signal
cannot leave a written texture stale.

Co-authored-by: Cursor <[email protected]>
Rank TITLE acquire sites by wait on each present (`frame lock waits:`) and
add guest/guest_host accounting so contention is visible without TITLE_LOCK.

Co-authored-by: Cursor <[email protected]>
Queue singular mirrors and list root_table/dispatch ops and drain them under
one TITLE take (VICTORY_LOCK_BATCH, default on) so frame wait is contention
from acquire rate, not per-call work.

Co-authored-by: Cursor <[email protected]>
Flushing deferred root_table/dispatch from every with_list paid a separate
acquire per short run when recording interleaved with draws. Apply that
list's pending ops inside the same with_list take instead.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
View creation still soft-flushes outside TITLE; 1024 cuts those takes
further. Assert with_list applies that list's pending root_table ops in
the same acquisition.

Co-authored-by: Cursor <[email protected]>
Across-texture std workers only; harvested within-texture rayon stays
unmerged after the nested PoolTable map-lock blow-up (~80× sync_prepare).
Size PARALLEL_HOST workers as cores−2 (clamp 2..=16).

Co-authored-by: Cursor <[email protected]>
Stop opportunistic mirror drains on every TITLE take (they starved the
GPU). Finish each list on Close and flush submitted lists plus mirrors
immediately before Execute/commit, keeping one-take-per-list batching.

Co-authored-by: Cursor <[email protected]>
Flushing all mirrors on every Close was too heavy. Close drains that
list's deferred ops; mirrors drain at soft limit (256) and immediately
before submit/commit so the GPU is not waiting on a backlog.

Co-authored-by: Cursor <[email protected]>
Pending list/mirror queues added a second global lock, partitioned the whole
vec per take, and deferred apply — reordering work and leaving the GPU idle.
Hold TITLE for a consecutive run instead and apply each op immediately.

Co-authored-by: Cursor <[email protected]>
Holding TITLE between singular mirror/root_table/dispatch calls blocked the
timer and submit through the game's inter-call gaps (gpu ~171→770). Keep
immediate apply and explicit with_held_run batching only inside one call stack.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Lock-batch: never park TITLE across COM returns; batch only inside an
explicit call-stack run. Resolve frame_time guest_host_leave (keep
reentrancy + site attribution) and native-host TRACE_FRAME_TIME (keep
guest/account lines + LOCK_BATCH write-up).

Co-authored-by: Cursor <[email protected]>
ICB: VICTORY_INDIRECT_COMMANDS coalesces same-pipeline direct computes
with per-command binds. Resolve native-host TRACE_FRAME_TIME by keeping
guest/account attribution and adding icb_runs/icb_cmds.

Co-authored-by: Cursor <[email protected]>
Wall-clock dumps land on different presents when frame time changes;
f<N>,path waits for frames_presented >= N so comparisons match.

Co-authored-by: Cursor <[email protected]>
Polling frames_presented took TITLE every 20 ms and would skew lock A/Bs.

Co-authored-by: Cursor <[email protected]>
Offline probe can paste TRACE_ROOT_VALUES hex into --cbv-fill words:…
and fill table scratch with --buf-fill u32:N so hanger ready-flag
spins can be separated from body cost.

Co-authored-by: Cursor <[email protected]>
One present's dispatches/draws/blits plus capped root-view contents and
frame_time timings, written outside the repo for offline replay.

Co-authored-by: Cursor <[email protected]>
Rebuilds heap=false compute dispatches from captured root-view blobs and
RootArgs, timing them on the same encode path as the live host.

Co-authored-by: Cursor <[email protected]>
Table SRV/UAV scalar (and table vector) wide loads were one DXIL
rawBufferLoad per dword; hangers issue hundreds of dwordx16 SMEM ops.
Chunk like format_load so x16 is four float4 loads.

Co-authored-by: Cursor <[email protected]>
This reverts commit 22f6a487fb.
When live reach (or console-flow constant EXEC) stays in the named lane's
host half, WaveReadLaneAt alone is enough; keep the existing exchange shape
when both halves can reach the site so synchronized hoisting still matches.

Co-authored-by: Cursor <[email protected]>
Extend the single-frame trace into a present window with shared
consumed blobs, dirty page ranges, pass markers, host/lock timings,
and optional present BGRA dumps for offline parallel replay.

Co-authored-by: Cursor <[email protected]>
Replay a run trace offline: host remap timing, submit_passes GPU
path, consumed-blob reload, present-hash check, and blob-buffer
reuse so workers can A/B without a game run.

Co-authored-by: Cursor <[email protected]>
Record the run-trace format, fidelity bar, capture-once offline
loop, and the blob-reuse host_ms A/B that proves the loop moves.

Co-authored-by: Cursor <[email protected]>
One-wave console flow was allocating a 64-dword xchg array and re-balloting
at every SCC/EXEC branch. Use half-slot banks (2×8) with batch_exchanges and
any_mask so host TGSM on the fat hangers drops 256→64 B.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Replay now groups consecutive compute dispatches into passes and issues one
submit_passes + fence per capture execute, measuring Metal GPUStart/End like
the host. Warmup round keeps first-use PSO compile out of gpu_ms.

Co-authored-by: Cursor <[email protected]>
MSC lowers Dot4AddI8Packed to ~40 scalar AIR ops per call with no
CSE across shared packs. Emit shl+ashr extracts + mul/add instead
(~16 ops/dot on the fat hangers) so repeated operands CSE in-block.
Programs that read MAX_MIP / ARRAY_PITCH as data were refused as
"an image's dwords 5 to 7". Dword 5 is rebuilt like the size fields;
metadata dwords 6–7 stay refused. Refs #641.

Co-authored-by: Cursor <[email protected]>
The host has no compression metadata; Mesa leaves WORD6/WORD7 as 0
before filling a DCC address. Rebuild them as 0 like dword 5 from
getDimensions. Programs that need a real metadata pointer still cannot
be served on Metal. Refs #540.

Co-authored-by: Cursor <[email protected]>
mask_number follows a spill restore and joins all-mask phis as numbers
so inactive-lane bits a ballot would drop stay. Refusal wording names
a spill-join or a bare join instead of "a program input".

Co-authored-by: Cursor <[email protected]>
Nested ACCC in 2a9c/53ec/6962 match amd_fidelityfx_upscaler_xbox.dll
byte-for-byte; fat CB prize quoted from run 441.

Co-authored-by: Cursor <[email protected]>
Use MTLDevice.newLibraryWithData on an owned DispatchData buffer
instead of writing a temporary metallib file. Avoids temp-dir I/O on
every library load.

Co-authored-by: Cursor <[email protected]>
The Mac has no title GPU VA for image descriptors. Fill view-address dword 0
(and dword 1 bits 0-15) from the pool buffer's gpuAddress, and serve that from
descriptor_data so bindless computes that rebuild the base address translate.
Loads through the address still see the console's tiled layout.

Co-authored-by: Cursor <[email protected]>
Always injecting dword 0 / address-high into every image descriptor_data
path forced view-addresses on size-only queries and regressed 7 computes
into lane-mask refusals. Gate the table load on the load covering dword 0 or 1.

Co-authored-by: Cursor <[email protected]>
Expose the walk's (tiled, linear, len) runs so a compute detile can copy
from a wrapped pool buffer without the CPU staging texels. Report records
dword-0 host gpuAddress proof (298→0) and that GPU detile wiring remains.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Add Pass/Cmd::Upscale and system MetalFX (objc2-metal-fx) so a recorded
upscale encodes into the submission command buffer instead of AMD FSR compute.

Co-authored-by: Cursor <[email protected]>
Intercept amd_fidelityfx_loader_xbox.dll so ffxDispatch records a MetalFX
upscale instead of running the lifted AMD compute PSOs (~60 ms prize).

Co-authored-by: Cursor <[email protected]>
Lets offline replay skip several compute pipes in one shot so a
predicted GPU delta can be matched against VICTORY_SKIP_PIPELINES.

Co-authored-by: Cursor <[email protected]>
Document execute-batched GPU timing, host-model limits, absolute-vs-relative
envelope, and the offline −24.5 ms / game −20.4 ms four-pipe skip match.

Co-authored-by: Cursor <[email protected]>
Document the intercept, input mapping, run 910 numbers (hanger PSOs gone),
and the open warm present-PPM check.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
This reverts commit 0c0c88120d, reversing
changes made to 65db242a82.
MSC lowers Dot4AddI8Packed to ~40 scalar AIR ops per call with no
CSE across shared packs. Emit shl+ashr extracts + mul/add instead
(~16 ops/dot on the fat hangers) so repeated operands CSE in-block.

(cherry picked from commit bc01d1b852)
Co-authored-by: Cursor <[email protected]>
Sampled textures that resolve to one pool run upload via Layout::runs
instead of CPU linear staging. DXGI 115 and sparse maps stay on the CPU.
Encode all GPU detile blits into one command buffer and wait once per
sync_apply so hold_sync does not regress to a wait-per-texture.

Co-authored-by: Cursor <[email protected]>
Long-lived rt_call_guest left pure guest in a per-thread clock until TITLE
or leave, so world frames read guest=0.0 with residual ≈ wall. Flush open
clocks at present so the account sees real guest ms.

Co-authored-by: Cursor <[email protected]>
hold_timer is almost all TimerPump (deferred host.execute); fences are noise.
Stop waiting on TITLE when the title holds it, and stretch the sleep to 8 ms
when a refresh moves nothing so blocked GPU work is not polled every 1 ms.

Co-authored-by: Cursor <[email protected]>
Let pump clear CPU-held fence and memory waits once a producer is in flight, without dropping the waiting segment.

Co-authored-by: Cursor <[email protected]>
Depth 2/3 turn committed fence waits and matching in-flight value-write memory waits into GPU event waits so host prep can overlap the producer frame.

Co-authored-by: Cursor <[email protected]>
Summed guest across ~50 title threads exceeds wall; guest_max is the hottest
thread's pure guest in the interval and is what the wall residual tracks.

Co-authored-by: Cursor <[email protected]>
Sample of the title under the lift showed rt_dispatch beside the hottest
f_* frames; cache the last target so repeated indirect calls skip the hash.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
GTA's compute queues wait GE on the graphics bottom-of-pipe frame word; EQUAL-only matching left mem_wait_promote at 0.

Co-authored-by: Cursor <[email protected]>
Record baseline 441 host split, Layout::runs / GPU detile byte identity,
batched blit, offline IN_BAND, and game measure blocked on lock contention.

Co-authored-by: Cursor <[email protected]>
Fatpipes are lit×VGPR dots; emit i32 constants for lit bytes (no
shl/ashr) and skip zero products so MSC sees fewer scalar ops.

Co-authored-by: Cursor <[email protected]>
Hot float/tex AIR≈1.07× native (no v_dot4c expander); pass ms is
dispatch×texture. Profile + prediction; no translator change.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Bookkeep under the lock, replaceRegion after release with BLOCK_TITLE_PUMP
so the timer cannot encode work that samples a texture mid-upload.

Co-authored-by: Cursor <[email protected]>
Take DREW and arm watches outside TITLE, reuse keep_named segment
snapshots at submit, and plan mirror_ranges descriptor work before the hold.

Co-authored-by: Cursor <[email protected]>
Singular with_run_title acquires were invisible in the wait-ranked
frame lock waits line; emit frame lock takes so per-command sites show up.

Co-authored-by: Cursor <[email protected]>
Set*RootDescriptorTable stores PendingTable under the list mutex only;
heap_of runs when the next with_list/draw/dispatch/submit already holds
TITLE. Index buffer setters use plain_list. No TITLE park across COM.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Location::caller inside HELD_RUN.with lost #[track_caller], so every
singular take was labelled glue.rs:383. Capture at the tracked fn entry.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Run each console wave as one host simdgroup: host thread n holds console
lanes n and n+32 (host_threads = lanes/2). Extends #527's paired form from
multi-wave lockstep-only to one-wave lockstep and console-flow as well, so
the 1.62× host/console wave tax can fall toward 1.0. Synchronized and
communicating multi-wave paths keep the halves model. VICTORY_NO_PAIRED_WAVES=1
restores split-half.

Half-slot console-flow (227c1b32/e598d1ff) is not used: it kept 64 host
threads and broke split_wave (poison 0xEEEEEEEE) by skipping cross-half
exchanges when EXEC was one-sided under wave-uniform CF.

Co-authored-by: Cursor <[email protected]>
tile_wave's EXEC-narrowing switch + LDS gather is wrong under twin-lane
fences (poison / wrong lane values). Lockstep and LDS-free console flow
(the fat hangers) still take the paired form so the wave tax can fall.

Co-authored-by: Cursor <[email protected]>
This reverts commit 6acc54506a, reversing
changes made to 584dde6ba5.
Without this, a twin lane could reuse the other half's descriptor handle
and refuse first-binds shapes as descriptor-as-data.

Co-authored-by: Cursor <[email protected]>
Twin-lane lowering still gaps on a few first-binds descriptor shapes.
Retry once with paired off so the corpus stays at zero regressions while
lockstep and LDS-free console-flow keep the 2-lanes-per-thread model.

Co-authored-by: Cursor <[email protected]>
Create*View mirrors plan offlock and flush in batches of 64 (or on the next
list/submit take) so ~19k per-view acquires become ~300 batches, without
parking TITLE across COM returns. root_table uses a heap already on the list
when it can, otherwise the pending-handle path; with_list still resolves
under one take. lock_batch_tests assert those counts on the merged model.

Co-authored-by: Cursor <[email protected]>
keep_named (and pending-root resolve) is one HoldSync take; probe_jobs /
sync_jobs is the next, so waiters can run between them. Texture uploads
stay offlock with BLOCK_TITLE_PUMP. host.execute / pump still mutate
NativeHost under TITLE.

Co-authored-by: Cursor <[email protected]>
Record half-slot failure cause, Twin+fallback correctness gates, run 942
spot tpg checks, and why LDS-free no-console_cf pipes stay at 2.00×.

Co-authored-by: Cursor <[email protected]>
TLS queues were invisible to other recording threads, so a view created on
one thread could miss the next list/submit take. Queue (handle, placement)
under a mutex and flush on any TITLE acquire or batch of 64.

Co-authored-by: Cursor <[email protected]>
Full SPILL of r0..r15 and x0..x15 kept 32 C locals live at every call, so clang filled hot frames with ldr/str even when the x86 used five GPRs and no vectors. Unused Cpu fields stay as the last writer left them.

Co-authored-by: Cursor <[email protected]>
hold_timer is TimerPump/host.execute under TITLE. Fence guest copies no
longer force the 1 ms poll once held FIFOs are empty, and pump is not
entered without held work.

Co-authored-by: Cursor <[email protected]>
Snapshot lists under HoldSync, resources_named (safe_read + view table)
outside like apply_probes, then realize/stamp under a short hold. Cuts the
names_wanted share of hold_sync without parking TITLE across COM.

Co-authored-by: Cursor <[email protected]>
When keep_named already snapped segments, roots were resolved in that
HoldSync take — do not resolve again before submit_synced/host.execute.

Co-authored-by: Cursor <[email protected]>
Hold split for timer/sync/submit, run 600 quote, measure pending as run 940.

Co-authored-by: Cursor <[email protected]>
Extend paired enablement past console_cf/lockstep for the froxel shape
(one console wave, 1-D group, no cross-lane ops, no mask-as-lane-data).
Broader LDS-free pairing broke split_wave mask joins, flattened 3-D
groups, and halved multi-wave atomics. 983e/9708 host tpg 64→32.

Co-authored-by: Cursor <[email protected]>
Call sites from FUNC_PROLOGUE_Y still emit SPILLY when no xh local exists, and VEX xmm writes zero the ymm high half.

Co-authored-by: Cursor <[email protected]>
World draws never reached 1000 in a quarantined 400s arm64 run; boot/UI
host/wait/takes and f250 identity vs the lock dump are quoted against run 600.

Co-authored-by: Cursor <[email protected]>
Drop the 1-D-only froxel gate so 2-D/3-D one-wave LDS-free pipes
(host tpg halves; thread ids from console flat) pair like 983e.
Mask joins, LDS, and multi-wave stay off this clause.

Co-authored-by: Cursor <[email protected]>
Long-lived rt_call_guest left open clocks running through HLE waits, so
charge_open echoed the present interval. Pause on import boundaries;
charge_open skips paused slots. Test covers an open entry and the pause.

Co-authored-by: Cursor <[email protected]>
Enabling one-wave pairing through v_cndmask of a lane-mask SGPR
failed three split_wave mask-join tests; keep mask_lane_data off
the one-wave-ALU clause and record the op.

Co-authored-by: Cursor <[email protected]>
Extend the ALU-free paired clause past one console wave for groups
with no cross-lane ops, no v_cndmask-of-mask, and no buffer/LDS
atomics (9b74 256→128). Atomics stay unpaired — append counts
halve when those pipes pair.

Co-authored-by: Cursor <[email protected]>
Consecutive segments were one host.execute, so all prep ran before any
Metal commit. Depth callers can now submit one segment per piece and
cap pieces per pump so TITLE can be released between submits.

Co-authored-by: Cursor <[email protected]>
hold_segments pushes without pumping; pump_budget caps pieces so the
submit path can drop TITLE between commits while the GPU runs ahead.

Co-authored-by: Cursor <[email protected]>
Submit drains one piece per acquire; the timer skips sleep while another
piece is ready so deferred host.execute no longer batches behind the GPU.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
ALU-free pairing flattens console [4,4,4] to host [32,1,1];
dimensional ids still rebuild from console flat — fill asserts hold.

Co-authored-by: Cursor <[email protected]>
Map/unmap/release coalesce into DirtyRanges (or Full on flood).
pool_created alone leaves dirty empty. take_dirty / dirty feed
FOLLOW_CHANGED and encode-replay.

Co-authored-by: Cursor <[email protected]>
Walk only views over pool dirty ranges (default on). When the pool
is clean and a direct command stream matches the previous execute,
remirror then reuse the cached Prep set (VICTORY_ENCODE_REPLAY).
Fence-only executes do not take_dirty.

Co-authored-by: Cursor <[email protected]>
Skip redundant set*PipelineState in one encoder when
VICTORY_ENCODE_REPLAY is on. Add follow_check/skip and encode_replay
TRACE_FRAME_TIME fields.

Co-authored-by: Cursor <[email protected]>
Document VICTORY_FOLLOW_CHANGED and VICTORY_ENCODE_REPLAY; record
what is replayed vs still re-done and the quoted baselines.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Offline frame-3807 ratio 1.62→1.34 after multi-D and multi-wave
ALU-free pairing; name v_cndmask and multi-wave atomics as floors.

Co-authored-by: Cursor <[email protected]>
Record offline 1.62→1.34, run-982 paired tpg counts, and that
quiet-box gpu was not reached (bind ramp / prewarm abort).

Co-authored-by: Cursor <[email protected]>
guest_max no longer echoes wall (import pause); world guest_max med 1.7 ms
so the guest is not the floor. Live-spill dylib relink noted with sizes.

Co-authored-by: Cursor <[email protected]>
A discriminant-only blit fingerprint could reuse the wrong Prep and leave
memory waits unmet so a held Signal never submitted (run 960). Require
empty waits/signals before prep replay, and hash every prep-facing field.

Co-authored-by: Cursor <[email protected]>
Document the skipped-signal side effect, fingerprint/gate fix, offline
tests, and the queued world prove behind game.lock.

Co-authored-by: Cursor <[email protected]>
Long-lived rt_call_guest left open clocks running through HLE waits, so
charge_open echoed the present interval. Pause on import boundaries;
charge_open skips paused slots. Test covers an open entry and the pause.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Outermost import wall clocks (open spans charged across presents) feed
import/import_max/import_wait and a frame imports: top-8 by ms so the
residual stops being an unnamed gap. Name lookup via rt_current_import.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
No incomplete-fence through frame 10688; f250 matches 940; world
host/wall still blocked (draws stayed at 11).

Co-authored-by: Cursor <[email protected]>
Keep v_dot4c fold test; take coverage froxel multi-D / cndmask / multi-wave cases.

Co-authored-by: Cursor <[email protected]>
World frames burn ~18k Sleep calls; std:🧵:sleep(0) may return
without yielding. Match Win32 and yield the time slice. Test covers
cheap Sleep(0)×10k.

Co-authored-by: Cursor <[email protected]>
Keep frame-overlap-3 FRAME_DEPTH docs; guest-real import-paused TRACE_FRAME_TIME.

Co-authored-by: Cursor <[email protected]>
Fast-path alu_free pairing through v_cndmask of a lane-mask SGPR fails
three split_wave mask-joins (upper-half bits). Console flow already pairs
those pipes; prefer it for eligible LDS-free one-wave programs so the
wave tax falls. Ballot-as-number (s_bcnt) stays on halves.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Sum CB-to-CB gaps after merging overlaps into gpu_idle / gpu_idle_gaps
so frame time can prove the feed-rate model (wall ≈ gpu_span from idle).

Co-authored-by: Cursor <[email protected]>
Feed-ahead needs one segment per host.execute so a promoted GPU wait
can sit between commits, plus max_pieces so Title can re-promote.

Co-authored-by: Cursor <[email protected]>
With FRAME_DEPTH≥2, drain one segment per execute and re-promote
without yielding TITLE so the waiter CB is queued while the producer
GPU still runs (deep command-buffer pipeline).

Co-authored-by: Cursor <[email protected]>
Keep FRAME_DEPTH docs; take residual import attribution + Sleep(0) yield.

Co-authored-by: Cursor <[email protected]>
This reverts commit 76c56d1081, reversing
changes made to de4a331e0a.
Keep feed-ahead under TITLE by default; FEED_AHEAD=0 restores overlap-3 TITLE yield.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Short feed-ahead segments collide stream fingerprints more often; cloning
a Fill prep onto a Copy panicked (blit len 1, need 2). Fall back to prep.

Co-authored-by: Cursor <[email protected]>
gpu_idle proves wall≈gpu_span; feed-ahead promote fires but idle stays
~80% — prep still sits in front of each CB commit.

Co-authored-by: Cursor <[email protected]>
Sampled textures that resolve to one pool run upload via Layout::runs
from a wrap of title pages (VICTORY_GPU_DETILE). Probe reads skip ranges
outside PoolTable dirty (and write-watch clean when armed). DXGI 115 and
unresolved maps stay on the CPU. Tests: byte-identical runs, dirty overlap.

Co-authored-by: Cursor <[email protected]>
Sum CB-to-CB gaps after merging overlaps into gpu_idle / gpu_idle_gaps
so frame time can prove the feed-rate model (wall ≈ gpu_span from idle).

Co-authored-by: Cursor <[email protected]>
Offline victory-metal --efficiency measures burst+gap vs continuous GPU
timestamps (DVFS tax) and maxTotalThreadsPerThreadgroup for ACCC compute.

Co-authored-by: Cursor <[email protected]>
Short ~0.5 ms CBs with host gaps pay a DVFS tax on busy gpu. Default off
VICTORY_FEED_FLUSH_SEGMENTS; feed-ahead still re-promotes between pieces.

Co-authored-by: Cursor <[email protected]>
Names the ~1.7x post-wave residual as DVFS under title-like CB gaps;
occupancy falsified on top pipes.

Co-authored-by: Cursor <[email protected]>
Record run 1013: probe_reads 61440→4, sync_probe 237.9→0.1, offline
present 320/320, byte_diffs 0; sync_prepare/hold_sync/gpu_idle residual named.

Co-authored-by: Cursor <[email protected]>
cbs 57, gpu 101.7, idle_frac last 0.65 vs quoted 994 flush-on.

Co-authored-by: Cursor <[email protected]>
Dirty/pool or write-watch (or scanner seen) already detect texture
changes; prepare no longer CPU-reads+hashes those for GPU wraps.
Clean ranges stay untouched. Floor: DXGI 115, no pool resolve, CPU
detile, residual in-place writes without a write oracle.

Co-authored-by: Cursor <[email protected]>
flush_texture_uploads commits the detile CB and signals a shared
event without CPU waitUntilCompleted; the next title CB GPU-waits
that signal. Tests and sync_apply still finish on the CPU.

Co-authored-by: Cursor <[email protected]>
CondBr follows only the lower twin, so divergent mask joins took the wrong
edge for the upper lane. Linearise those programs and select joins per twin
from edge predicates; split_wave mask-join tests pass with pairing on.

Co-authored-by: Cursor <[email protected]>
Wave-level append/consume must add the console lane count (paired_ballot)
and run once per host thread, not twice. Multi-wave buffer CAS append
loops stay unpaired: they take the synchronized path, and divergent
CondBr cannot drive both twins' retries.

Co-authored-by: Cursor <[email protected]>
Document the three ops: cndmask joins paired, multi-wave atomics and
EXEC-narrow LDS stay floors; offline host_sg 1.34→1.27. Unit test locks
the LDS floor.

Co-authored-by: Cursor <[email protected]>
Encode every ready piece under TITLE with Metal commits deferred, then
flush them back-to-back (VICTORY_PREP_AHEAD). Adds feed_gap / dep_stall
meters so remaining gpu_idle can be named as host prep vs title waits.

Co-authored-by: Cursor <[email protected]>
Document the sync_prepare/hold_sync split, dirty⇒upload / clean⇒untouched
hash skip, blit wait fold, and quiet-box before/after vs 1013 with present 320/320.

Co-authored-by: Cursor <[email protected]>
Burst encode must not keep producers uncommitted while a waiter needs a
CPU-polled bottom-of-pipe write; flush, re-promote, and continue.

Co-authored-by: Cursor <[email protected]>
Defer-all (1031) left the GPU idle for the whole prep window and raised
idle_frac; lead CB commits now, tail flushes back-to-back.

Co-authored-by: Cursor <[email protected]>
Drop the 1-D-only froxel gate so 2-D/3-D one-wave LDS-free pipes
(host tpg halves; thread ids from console flat) pair like 983e.
Mask joins, LDS, and multi-wave stay off this clause.

Co-authored-by: Cursor <[email protected]>
Enabling one-wave pairing through v_cndmask of a lane-mask SGPR
failed three split_wave mask-join tests; keep mask_lane_data off
the one-wave-ALU clause and record the op.

Co-authored-by: Cursor <[email protected]>
Extend the ALU-free paired clause past one console wave for groups
with no cross-lane ops, no v_cndmask-of-mask, and no buffer/LDS
atomics (9b74 256→128). Atomics stay unpaired — append counts
halve when those pipes pair.

Co-authored-by: Cursor <[email protected]>
ALU-free pairing flattens console [4,4,4] to host [32,1,1];
dimensional ids still rebuild from console flat — fill asserts hold.

Co-authored-by: Cursor <[email protected]>
CondBr follows only the lower twin, so divergent mask joins took the wrong
edge for the upper lane. Linearise those programs and select joins per twin
from edge predicates; split_wave mask-join tests pass with pairing on.

Co-authored-by: Cursor <[email protected]>
Wave-level append/consume must add the console lane count (paired_ballot)
and run once per host thread, not twice. Multi-wave buffer CAS append
loops stay unpaired: they take the synchronized path, and divergent
CondBr cannot drive both twins' retries.

Co-authored-by: Cursor <[email protected]>
Twin fences cannot schedule the gather (tile_wave); keep tpg=64 so the
wave floor stays named after the acyclic cndmask join cut.

Co-authored-by: Cursor <[email protected]>
hold_submit's follow term was O(title_views) even with FOLLOW_CHANGED
when dirty pages hit no followed buffer view (run 994: follow_skip
~678k, follow_check=0, follow ~55 ms). Track covered 4 KiB pages and
bulk-skip when dirty misses that cover.

Co-authored-by: Cursor <[email protected]>
Metal cannot recommit an MTLCommandBuffer; retained ICBs are the
reuse form. Take from a free-list, hold until the CB finishes, then
reclaim — avoids newIndirectCommandBuffer on every coalesce run.

Co-authored-by: Cursor <[email protected]>
Independent passes encode into separate command buffers concurrently; commit
stays in title order. Off by default; needs residency sets. Cuts encode wall
under TITLE toward max(piece)/workers (#461).

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Name top TITLE holds (submit/sync/mirror), show follow+prep dominate
hold_submit (not CB encode), and document follow early-out + ICB pool.

Co-authored-by: Cursor <[email protected]>
Paired wave64 halves console tpg; comparing maxTotal to console lanes
falsely warned and under-counted slots at the new wave ratio.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Record arm64 sha, aborted 1200, queued 1202, and residual terms that
remain after follow early-out + ICB pool.

Co-authored-by: Cursor <[email protected]>
hold_submit 125.1→72.2, backend 19.6→12.9 on 12 workers; wall did not fall.
Drop additive par_enc_workers counter (pieces only).

Co-authored-by: Cursor <[email protected]>
Probe tax 2.95× warm → no-idle ≈33 ms at wave 1.27; LDS EXEC-narrow
names the remaining wave floor; present 320/320; live quiet-box blocked.

Co-authored-by: Cursor <[email protected]>
This reverts commit 9a03ac03af, reversing
changes made to 6ac32141e9.
Apple's converter dies in SimplifyCFG on some paired DXIL (bd7e11bf).
Run uncached converts in a --victory-msc-worker subprocess and remember
crashes by DXIL so the process stays up and later runs refuse at once.

Co-authored-by: Cursor <[email protected]>
Probe the paired compute DXIL through the isolated converter; on SIGSEGV
re-translate with paired_waves off so that shader runs as two simdgroups
while the rest keep the 1.27 paired ratio.

Co-authored-by: Cursor <[email protected]>
45 of 251 paired first-binds SIGSEGV/SIGBUS MSC; isolate + halves keeps
the process alive (run 1300 past bd7e11bf to frame 8832).

Co-authored-by: Cursor <[email protected]>
Instead of remirroring whole bound tables, VICTORY_STORE_SITES notes every
lifted store (and HLE memcpy) into the adopted view heap and remirrors only
those slots. PE jump patches are skipped on aarch64+lift where they would
not execute; a rebuilt librt with rt_store_hook_install_slot is required.

Co-authored-by: Cursor <[email protected]>
An empty take must not skip the bound span — that would miss writers the
hook has not told yet. Only a non-empty mark set uses the told-slot visit.

Co-authored-by: Cursor <[email protected]>
Clearing the whole heap on the first table dropped marks for slots not yet
bound; take_span keeps those for a later remirror.

Co-authored-by: Cursor <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 23:20:01 +00:00
github-bot closed this pull request 2026-11-30 00:39:39 +00:00
Author
Owner

@⁠jamal-fv on GitHub · 2026-11-30 00:35 UTC · original

Closing: opened without the owner's approval. The owner is asleep; no public action was authorised.

**@⁠jamal-fv** on GitHub · 2026-11-30 00:35 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/659#issuecomment-7265406908) Closing: opened without the owner's approval. The owner is asleep; no public action was authorised.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.