arm64 run: the recompiled title boots to its intro; recompiler fixes, main merged in #115
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/115"
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 thebcd69 on 2026-11-26T17:15:14Z.
What this is
The arm64 run (
native/arm64-run,b11a2f2) brought up tomain(3fd73fd) and taken further on an M5 Max: the title's exe and DLLs lifted to C withvictory-recomp lift-split, built for arm64 (no Rosetta) and run withVICTORY_LIFT_DIR. It now boots, reads its packs through DirectStorage, translates its shaders ahead and presents the intro at 30 fps (the first frame drawn by the arm64 build). Each run stopped at a recompiler gap; the fixes are below, each with its own test.Recompiler (
crates/victory-recomp)escapes <pe> [seeds]: direct targets that a linear sweep of each function finds outside every function (a thunk's target, a switch case that tail-calls), to feed back as seeds (lift-split <pe> <dir> 2000 <seeds>). 481 for the title's exe.tablelistcompares two builds: 208 of the exe's 3434 tables changed (f_53bf950 went from 7 to 8 cases, the trap that stopped a run).jmp qword ptr [base + 8*idx], an interpreter's dispatch): one switch per function after its body.f_<rva>that enters the same body at its label.mov eax, [rsp + 0x48]/cmp eax, 8/jne: a waiter spinning on a counter its workers raise through its address) read the slot as a shared access; as a plain stack access clang had made the loopb ..pauselifts toyieldwith a memory clobber.Runtime, HLE, native host
extern "efiapi", method tables go throughfn_addr!, the x86-only dump and write-trap code is gated.Shader translator
ds_bpermute_b32stays inside its 32-lane half (RDNA2 ISA 10.4.4), so it needs no exchange between host waves and is no longer refused in divergent code.main: onev_mad_u32_u16lowering (main's) and ones_pack_*lowering; both branches had added them.Merging
mainConflicts: UCRT
ilogb(main's NaN case, inextern "efiapi"), and anative.rstest (this branch accepts root constants in compute shaders, so type 0 is left out of main's refused-types list).Tests
victory-recomp lib 13/13, victory-shader 235/235, victory-hle 233/235 (the GameInput live-controller and XPackage completed-installation tests fail the same way without these changes).
Building the lift
victory-recomp lift-split <exe> <dir> 2000 [seeds], each unit built withclang -arch arm64 -O2 -ffp-contract=off -mcpu=apple-m1 -mllvm -disable-machine-sink -mllvm -enable-misched=false -DRT_TSOand linked with-dynamiclib -Wl,-undefined,dynamic_lookup; the runtime isrt_host.cwith-DRT_MULTI. Title-specific seeds are not in the tree (escapesproduces them).🤖 Generated with Claude Code
https://claude.ai/code/session_01BotUDcRjHo3zJ1HWdpX4mk
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T18:57:16Z.
Review: CHANGES_REQUESTED
Thanks, getting the intro drawn by the arm64 build is a big step. This branch is now 137 commits behind main and conflicts with it, so I can't test it as it stands. Could you merge main again? While you're at it:
Splitting the recompiler (victory-recomp and its fixtures) from the runtime/HLE/host changes would also help a lot.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-27T09:36:13Z.
Answers to the review: (1) the texture view is created eagerly per typed/structured entry in write_typed_buffer (gfx.rs), but zero-copy — it shares the pool MTLBuffer's pages and is not added to the residency set, so GPU-memory cost is one small MTLTexture object per entry, not per-entry pages; count/time/footprint measurement needs a Mac run, which I'll do before merge. Lazy creation would need the translator to mark format-accessed entries and an entry rewrite before bind — possible follow-up, not done here. (2) A view whose offset is not a multiple of minimumTextureBufferAlignmentForPixelFormat(pf).max(elem_bytes) falls back to a plain buffer entry (no textureViewID); nothing crashes, the store is lost as before. (3) The view's texture_buffer format carries only lane width; SINT→UINT there is deliberate (same 32-bit lanes). The converter takes the integer kind from the DXIL type (the GFX10 format field, buffer_format → Numeric), not from the view. (4) Scanned the diff: no converter listings or application content in the repo or comments; test descriptors are synthetic.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T10:32:07Z.
This comment is on #115, but its text answers my review of #278 (typed and structured buffer views). Please post it on #278, and note that #278 belongs to Sheffy007: if you are not its author, please say that these are your reading and not the author's.
It is also not the measurement I asked for there. "I'll measure before merge" is not a count of the entries that get a texture in a world run, the time to mirror, and the process footprint before and after.
For #115 itself my questions from yesterday are still open: merge main again, split the page-table change into its own pull request, check the victory-hle tests again after the merge, and split the recompiler from the runtime.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Hayyan612 on 2026-11-27T13:47:49Z.
Hi @thebcd69, a note on the review's first point, in case it saves you work: since that review, main fixed the retired-table read itself in
1c6bee8f("a page table lives until the GPU ran the work submitted with it": tables are backend-owned buffers that submissions keep alive). So what's left to split out of this PR is the in-place update from the pool's change journal and the title-lock hold logging, which is the performance part.If it helps with the merge of main (it conflicts in about 30 files now), I'm happy to help; I'd only start if you're OK with that, so we don't collide with your own update.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Hayyan612 on 2026-11-27T20:38:01Z.
@thebcd69, I ran FEX-Emu's x86-64 instruction tests (
unittests/ASM, MIT, checked out outside the repo) throughvictory-recompat4aae3061: each test is assembled, lifted, built for arm64 and its registers compared with the values FEX expects, so no Rosetta is involved. 1,211 of 1,796 eligible tests pass (x87/MMX/3DNow! left out).Fixes it led to, each with a
kat.rstest that fails without it (branch: https://github.com/Hayyan612/Native-Victory-macOS/commits/recomp/fex-fixes, on top of4aae3061):cmpxchgwrote EAX (zero-extending RAX) when the compare succeeded, and a failed register form rewrote its destination; x86 writes the accumulator only on a miss. Rosetta 2 does both writes, which is whydiff_bits/diff_formsagreed with the lifter: they now compare operand-size values, anddiff_formswaivesCmpxchg_rm32_r32with the reason.insertq/extrqkept the destination's high qword; FEX's SSE4a tests (run on AMD hosts) expect it cleared.ldmxcsrwas ignored andstmxcsralways gave0x1f80. Now RC and FTZ/DAZ go to FPCR per thread,cvt*andvround*/vcvtps2phwith immediate bit 2 round through anfrintxasm clang cannot fold (with__builtin_rintit folded constants and turnedrint(-x)into-rint(x)), and a function containingldmxcsrgets#pragma STDC FENV_ACCESS ON(without it clang moved FP work above thert_ldmxcsrcall). Limits are written inrt_host.c.entrieswas missing from theFuncInliterals intests/common/difftest.rsandtests/diff_forms.rs(the tests did not compile), anddiff_forms' NaN canonicalisation computed32 - wfor 64-bit lanes (an overflow panic in debug builds).With these,
diff,diff_bits,diff_legacy,diff_vex,diff_forms(0 mismatches),katandlitmuspass here;e2eneeds the MinGW toolchain I don't have installed.Gaps left (
tools/fex-asm/FINDINGS.md): a locked read-modify-write whose access crosses 16 bytes raises SIGBUS (no fallback), AF is not computed,loope/loopnenever end, 16-bit operand-size stack ops push 8 bytes. The runner istools/fex-asm/run.py(Python, so its own commit: not on the policy allowlist). Also seen at4aae3061, not touched: the Windows clippy gate stops onimage.rs:144,lib.rs:242andanalyze.rs:1335.Happy to open a PR into your branch with any of this.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.