Repository navigation
Performance improvements tested with Path of Exile 2: TSO metadata fix, memcpy/memmove and leaf-call inlining, invalidation skips, alias redirect - #40
Open
Dragooon wants to merge 18 commits into
Conversation
GenerateIR set BlockInForceTSOValidRange only for blocks that contain an instruction listed in the volatile metadata. A block inside a valid range with no listed access (nearly all code) kept full TSO, so neither the image's own MSVC volatile metadata nor a module-wide FEX_EXTENDEDVOLATILEMETADATA entry relaxed it. When the range held no listed instruction at or after the block, the old test also dereferenced ForceTSOInstructions.end(). Now any block inside a valid range drops TSO for every access the metadata does not list; listed accesses keep their ordering as before. Seen with Path of Exile 2 on iOS: with the exe in FEX_EXTENDEDVOLATILEMETADATA its hottest JIT block (a byte-copy loop at exe+0x102a480) still compiled to ldapurb/stlurb per byte. With this change it compiles to ldrb/strb. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shitiz Garg <mail@shitiz.me>
…ns it off) MSVC emits byte-at-a-time copy loops for copies whose size it cannot see (movzx load, byte store, two pointer steps, sub count 1, jne back). FEX translates them one guest instruction at a time, about eight host instructions per byte; in Path of Exile 2 the function holding such a loop (exe+0x1029bb0) was 8.7% of all process CPU. When a decoded block is exactly that loop, OpDispatchBuilder:: MatchByteCopyLoop recognises it and EmitByteCopyLoop emits one forward MemCpy (REP MOVSB semantics, ascending bytes, so overlapping copies match the loop), then leaves the registers and flags the loop would: Src/Dst advanced by n, count 0, the byte register holding the last byte copied, and the flags of SUB 1,1. It applies only where TSO is off for the whole block, not under full SMC checks, hot SMC blocks or extended debug info. On by default; set MADEIRA_FEX_BYTELOOP=0 to turn it off. The first 16 matches log [byteloop]. With it on, the same function fell to 2.1% of process CPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shitiz Garg <mail@shitiz.me>
…ecutable InvalidateContainingSection took the exclusive code-invalidation lock, walked every thread's lookup cache and logged an [iOS-xrem] line for every freed section view. Path of Exile 2 streams assets through file views and unmaps about 60 a second (around 23,000 such lines in a 6-minute session), all of them data. Nothing is compiled from memory outside XIntervals: code is only translated from executable memory, and taking a range out of XIntervals invalidates it first. So a freed section that does not intersect XIntervals is returned without the invalidation; the log line becomes [iOS-xrem] via=section-data, printed for the first 8 and then every 1024th. Executable sections take the full path as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shitiz Garg <mail@shitiz.me>
Guest PE images sit inside [g_JitLow, g_JitHigh), so the bounds test let every address in the game's own exe through, and each one walked all ~160 alias entries to answer "not an alias". CompileBlock, QueryGuestExecutableRange, IsHotSMCCodePage and LookupExecutableFileSection all ask; in a Path of Exile 2 profile the walk was 7.5% of process CPU and 16% of the main thread. A 4096-slot cache keyed by 64 KB chunk now holds the answer (entry index or "no entry touches this chunk") in one 64-bit word per slot, tagged with the table generation. BTCpu64IosAddAliasMapping brackets its table changes with a sequence count, so answers from an older table never match and a lookup racing a change takes the walk. Hits are re-checked against their entry every time. A page key thrashed past ~4000 pages; the chunk key fits the game's 49 MB of code. A host test of 12M lookups against the walk gave 0 mismatches, 44 ns -> 2.2 ns per lookup; on device the function left the profile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shitiz Garg <mail@shitiz.me>
…IRA_JITCODE) A CPU sampler sees host PCs; inside JIT code they say nothing about the guest until they are mapped back to the block compiled there. With MADEIRA_JITMAP=<executable-name substring>, that process writes one 32-byte record per block placed in the code buffer (host begin, guest RIP, host size, guest size, ms, seq) to %LOCALAPPDATA%\fex-jitmap-<pid>.bin; guest RIP 0 marks a code cache clear. MADEIRA_JITCODE=<rip|module+0xrva>[,...] additionally dumps the host code of blocks compiled at those entries to fex-jitcode-<pid>.bin. The hook (FEXCore::Core::MadeiraJitMapHook) is null unless enabled and runs under the code buffer write lock, after the block's bytes are copied to their final address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shitiz Garg <mail@shitiz.me>
With L2 off (the iOS default) every L1 miss that L3 answers runs CacheBlockMapping, whose fextl::map descent was 1.25% of all CPU in a capped PoE2 profile, and CompileBlock ran its reports, RIP checks and shared telemetry counters before the lookup. CachedCodePages becomes a robin_map (InvalidateCacheRange walks the shorter of the range's pages or the map), and on FEX_IOS_HOST a hit returns before that code. MADEIRA_FEX_CB_FAST=0 turns the fast path off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shitiz Garg <mail@shitiz.me>
…ock counters Three changes for the capped-CPU stalls in dig2 (C1, C2 and its section 3 counter), each behind a madeira.cfg env toggle: - MADEIRA_FEX_FREE_SKIP (default 1): InvalidateAlignedInterval returns before the exclusive invalidation when a freed range overlaps no X interval and no sub-floor image window, logging a sampled "via=free-data" line. The rule is the one the section-unmap path already uses. InvalidateCacheRange also returns early when the range lies outside the thread's lowest..highest cached page. - MADEIRA_FEX_L1_HASH (default 1): the L1 index becomes (rip ^ rip >> 17) & mask at every site: FindBlock, InvalidateCache (all sizes), CacheBlockMapping, the BranchOps indirect lookup and the three Dispatcher sequences. Read once, shared by codegen and C++. - [fexlock-stats] every ~30 s for CodeInvalidationMutex: exclusive acquisitions/s, hold ms/s and max hold, reader-blocked ms/s and writer-wait ms/s; [l1-miss-t] per-thread L1 miss rate every ~30 s. MADEIRA_FEX_CB_FAST from the previous commit is unchanged. For the Madeira fork only; not meant for FEX-Emu. Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as-redir] stats A pool-copy alias never gets a block, so CompileBlock's fast path could only miss for one under CodeInvalidationMutex and the lookup read lock before ml315 redirected it to the PE VA. Path of Exile 2 reaches x64 code in hybrid DLLs (madeira_d3d12's list-journal methods and trampolines, ntdll's syscall entry) through alias addresses about 450K times a second per frame thread; the locks, FindBlock and the block-map probe were 27% of those threads' CPU. Check the lock-free reverse translation first and return to the dispatcher with the PE VA, as ml315 does. MADEIRA_FEX_ALIAS_FIRST=0 turns it off. Each thread logs its redirect rate and heaviest PE targets every 30 s ([alias-redir]). Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Was 16. A profile's hottest functions can then be dumped in one run for a review of the code the JIT emits for them. Measurement only. Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…FEX_MEMMOVE=0 turns it off) MSVC's memcpy and memmove are one routine. It picks its path through a jump table per size up to 15 bytes, and through compares, a 128-byte loop and a second jump table above that, so a small copy translates to two or three guest indirect branches (each a lookup of the next block) around a handful of loads and stores. In Path of Exile 2 the routine was 5.8% of all process CPU in a fight, with the loads and stores themselves about 15% of that. When a decoded block is the routine's entry (matched by its first 46 bytes), a new IR op, MadeiraSmallMove, goes in front of it: an inline copy for 0..256 bytes between ranges that do not overlap. It writes only the JIT temporaries, so the guest registers and flags are untouched. If it copied, the block sets RAX to the destination and returns. If not (more than 256 bytes, or overlapping ranges) nothing was written and the routine's own instructions run as before. Overlapping copies stay with the routine because a fault inside the inline copy is reported at the routine's first instruction; a guest handler that resumes there repeats the copy, which is only right while the source is untouched. It applies only where TSO is off for the routine, and not under full SMC checks, hot SMC blocks or extended debug info. On by default; set MADEIRA_FEX_MEMMOVE=0 to turn it off. The first 8 matches log [memmove-fast]. The emitted sequence was run under qemu-aarch64 against a reference memmove: 120,400 cases over every length 0..300 and every kind of overlap, checking the bytes, the result, and that the inputs and a declined destination stay untouched. Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two tests under unittests/ASM/Madeira, run through the real ARM64 code generator by the x86-64 host build with the VIXL simulator: - crt_memmove_fast.asm: a routine that starts like MSVC's memcpy/memmove, called for every length 0..300 at sixteen source/destination distances (overlapping both ways included), each result compared byte for byte with a REP MOVSB copy, bytes around the copy included. - byte_copy_loop.asm: MSVC's byte-at-a-time copy loop for lengths 1..40 at seven distances, memory, registers and flags compared with the same loop in a shape the idiom does not match. The idioms are compiled only into the iOS ARM64EC module, so the test build defines FEX_MADEIRA_IDIOM_TESTS to compile them in as well. Nothing changes for any other build. With the fast path compiled in, 3,228 of the 4,816 memmove calls reach the routine's own code (the long and the overlapping ones), which is the number the fast path's conditions predict; without it all 4,816 do. Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…A_FEX_LEAF_INLINE=0 turns it off) Path of Exile 2 spends about 4% of its CPU in functions of one to a few instructions (`mov rax, rcx; ret` alone is 1.3% of a fight, run-1125a), nearly all of it the call and the return: a block entry each, and for the return an L1 lookup and an indirect branch, 31 to 35 host instructions around a callee of one. Most of them are reached by direct CALLs (2,506 sites for that one function). Decoder: when a block ends in a direct CALL, the callee is decoded beside the blocks. If it is at most 12 instructions and 64 bytes of plain straight-line code ending in RET (an allow-list by encoding: moves, ALU, shifts, LEA, CMOV/SETcc, PUSH/POP, SSE moves and arithmetic; no branches, calls, string or system instructions, LOCK, VEX, x87, MMX), it is recorded in BlockInfo.InlineLeaves and its pages join the function's code pages, so a write to the callee invalidates the caller. Not for EC code, pool-copy aliases, writable mappings, or while a code cache is being generated. Dispatcher: at such a CALL, GenerateIR emits the push of the return address, the callee's instructions through their ordinary handlers (with the callee's own TSO policy and guest-address markers), then the RET as a compare of [RSP] with the address just pushed. Equal: RSP moves past it and the block continues after the CALL. Not equal (the callee replaced its return address): an ordinary RET. The guest stack, registers and flags go through the same states as with the call made, so a callee that reads its stack arguments or faults behaves as before. A handler that reports a failure ends the block at that instruction, which then compiles on its own as it always did. GuestOpcode's offset operand becomes 64 bits: an inlined callee can sit below the function entry, and the RIP tables already store signed deltas. Not used with full SMC checks, hot SMC pages, forced SMC detection, extended debug info, single-instruction blocks or 32-bit guests. Custom IR entry points are never inlined. Tests: unittests/ASM/Madeira/leaf_inline.asm (13 cases: results, flags in both directions, stack arguments, the pushed word, PUSH/POP in the callee, a callee that rewrites its return address, `rep ret`, callees below and above the caller, the 12-instruction limit, a callee with a branch). The x86-64 host build with the VIXL simulator runs the 64-bit ASM suite with the inline active: 6,366 pass, the same three failures as before the change (Secondary/07_XX_04). Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The 64..256 byte class looped over single 16-byte vectors: 4 to 15 rounds of four instructions. In Path of Exile 2 that loop held about a sixth of the routine's time (run-1125b). It now moves a pair of vectors per round, (length - 1) / 32 rounds, then the last 32 bytes: the rounds cover all but at most the last 32 bytes and never pass the end. unittests/ASM/Madeira/crt_memmove_fast.asm sweeps every length 0..300 at sixteen distances and compares the bytes around each copy as well. Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… (MADEIRA_FEX_MEMMOVE_SITES=0 turns it off) The entry fast path is one piece of host code shared by every caller: its size checks see every caller's lengths in turn, and each call still pays the call, the routine's block entry and the return lookup. In Path of Exile 2 the routine was 8.2% of process CPU in a map (run-1125b; 10% of the main thread and 14% of the two job threads), about 40% of it at the instructions right after the size branches and 10% in the return. The game calls it from 5,350 direct CALL sites; only 4% of them pass a constant length. Decoder: the callee decode of the leaf inline stops at a branch after three instructions for this routine; when OpDispatchBuilder::MatchCRTMemmove accepts those plus the JA and the bytes after it, the call is recorded in BlockInfo.InlineLeaves with no instructions (InlineLeaf::IsCRTMemmove) and the routine's matched bytes join the function's code pages. Dispatcher (OpDispatchBuilder::InlineCRTMemmoveCall): the CALL's push, then MadeiraSmallMove. Copied: RAX = the destination and the RET of the leaf inline (compare [RSP] with the address pushed, move RSP past it, carry on after the CALL). Not copied (more than 256 bytes, or overlapping ranges): nothing was written and the routine is entered through the same linked call exit a CALL uses, its return address already on the stack. A fault inside the copy is reported at the routine's first instruction with the return address pushed, as with the entry fast path. Applied under the entry fast path's rule (TSO off for the whole routine) and the leaf inline's (not under full SMC checks, extended debug info, a custom IR handler on the callee, EC code, pool-copy aliases, writable mappings, or while a code cache is generated). MADEIRA_FEX_MEMMOVE=0 turns both memmove paths off; MADEIRA_FEX_LEAF_INLINE=0 no longer affects this one. The [leaf-stats] line counts these calls as "memmove", and the first eight sites are logged as [memmove-site]. Tests: crt_memmove_fast.asm now runs its sweep twice, through a direct CALL (the call-site copy) and through a CALL of a register (the entry copy), and checks the stack pointer. crt_memmove_site.asm covers fixed lengths with the word under the stack pointer, the callee-saved registers, a copy that lands on its own return address, calls back to back, an overlapping call and a call at the end of a function. Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…er new call-return stacks and L1 tables ZeroScrub verifies by reading that a fresh range is zero. On Linux that maps the shared zero page; on Darwin every read fault hands the task a private zero-filled page, so the pass makes the whole range resident: 8 MiB of call-return stack and 2 MiB of L1 table for every thread, about 640 page faults a thread and ~350 MiB of footprint with 35 threads alive (Path of Exile 2 on the iPhone, [phys-map]). The pass found no stale byte in 15,182 thread creations over 121 sessions. It stays on by default; the switch turns it off, and both log lines say so. Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…REE=0 keeps the chain) The inline copy tested the length one power of two at a time: three to five tests before a copy of 4 to 256 bytes. Path of Exile 2 fills its constant buffers with one memcpy per value, lengths from 4 to 256 bytes with no pattern from one call to the next. In a map that loop (exe+0x129cce0) was 8% of the main thread and 11% of a job thread, and 83% of its samples were on the instructions after those tests. The default form now takes two tests: 1..16 or 17..256, then 1..3 or 4..16, or 17..64 or 65..256. Each range from 4 up is moved as four pieces of one width (4, 16 or 64 bytes) that may lie on top of one another, so nothing inside a range depends on the length. The ranges still must not overlap and more than 256 bytes still goes to the routine's own code. 80 instructions (73 before). Tests: tools/fex-smallmove-test (every length 0..300, 400 placements each, both forms: 120,400 cases, 0 failures, same declines); the Madeira ASM tests; the 64-bit suite has the same three failures as before. Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…both forms in one run
MADEIRA_FEX_MOVE_NOPUSH (default 0 = no change):
1 the inline copy at a direct CALL to CRT memmove runs with the CALL not started. Copied:
RAX = destination and the block carries on; no return address is pushed, read back,
compared or popped (11 host instructions, a store and a load per copy). Not copied: the
whole CALL runs. The eight bytes below RSP keep their old content, a copy that would
have overwritten its own return address carries on after the CALL, and a fault inside
the copy is reported at the CALL instruction.
2 both forms are compiled and each thread runs one of them
(CpuStateFrame::MadeiraMoveForm, alternating as threads start; MADEIRA_FEX_MOVE_FORM=0/1
gives every thread the same one). Two threads doing the same work then compare the forms
in one run, whatever the content.
MADEIRA_FEX_MOVE_CENSUS=1: the emitted copy adds itself and its length to per-thread
counters (six instructions a copy, no flags), by slot: at the routine's entry, call site
with the push, call site without. Each thread logs its totals about every 10 s as [move-t].
With the census off the emitted copy is byte for byte what it was.
Why: in run-1125d the two-test copy did not change the cost of Path of Exile 2's
constant-buffer loop (exe+0x129cce0, 9-16% of each frame thread), and shares between
different maps cannot show a change of a few percent. The census gives copies per thread, so
the cost per copy can be compared between threads and between runs.
JIT: a call exit in the last block of a function left its return landing without a branch
to the return block (the branch is emitted when the next block starts). The form without
the push ends functions that way; the landing now gets its branch after the last block.
Tests: unittests/ASM/Madeira/crt_memmove_site*.asm and crt_memmove_fast*.asm share their
bodies (unittests/ASM/Includes/madeira_crt_memmove_*.inc) and run each mode; the test
runner puts a test's MADEIRA_* "Env" entries into the environment. 30 of 30 pass in the
x86-64 simulator build; the 64-bit suite has the same three failures as before.
tools/fex-smallmove-test runs the emitter with the census off and on (120,400 cases each).
Signed-off-by: Shitiz Garg <mail@shitiz.me>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… inline (default 12) run-1127g: a quarter of the direct calls the leaf inliner looked at stopped at the 12-instruction limit. Above 12 the byte limit is 6 bytes an instruction. Test: unittests/ASM/Madeira/leaf_inline_long.asm (a 20- and a 26-instruction callee), passes with the variable unset and at 24. Signed-off-by: Shitiz Garg <mail@shitiz.me> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dragooon
marked this pull request as ready for review
November 28, 2026 07:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ios-port-2607(1dc6ed4, the commit Madeira'scodex/d3d12-consolidationpins) ←Dragooon:duo-all(18 commits, e948dd1; 34 files changed, 3,473 insertions, 104 deletions)These changes were developed on an iPhone Duo (A20 Pro, 12 GB) while tuning Path of Exile 2 under Madeira between 4 and 28 Nov 2026, and every one of them ran there with the game. None of them is tied to that phone: they are in FEX's core, its JIT and its iOS ARM64EC module, and they help any game whose code looks like MSVC-built Path of Exile 2 (byte-copy loops, the CRT memcpy/memmove, tiny leaf functions, pool-copy aliases). Most are on by default with a switch to turn them off; Defaults lists them.
In short
Impact
No run compared this branch with an unmodified FEX at matched content, so this PR claims no overall figure. Measured on the Duo with Path of Exile 2, per change:
MADEIRA_FEX_LEAF_MAX) added only 0.6 points to the inlined share.[alias-redir]line was logged, so most of that gain belongs to the Madeira change. This one covers aliases from any other hybrid DLL.ForceTSOInstructions.end(). The frame-time effect was not isolated.Commits
91c5df971Core: drop TSO in every block inside a volatile-metadata range. GenerateIR only relaxed blocks that contained a listed instruction. Now any block inside a valid range drops TSO for every access the metadata does not list. Listed accesses keep their ordering.999d366dfCore: byte-copy-loop idiom (on by default, MADEIRA_FEX_BYTELOOP=0 turns it off). A block that is exactly MSVC's byte-at-a-time copy loop becomes one forward MemCpy with REP MOVSB semantics, leaving registers and flags as the loop would. Only where TSO is off for the whole block, not under full SMC checks, hot SMC blocks or extended debug info.71d788095Windows: skip code invalidation when an unmapped section was never executable.24557ed7cARM64EC iOS: cache IosJitReverseTranslate answers per 64 KB chunk. A 4096-slot cache tagged with the table generation; a lookup racing a table change takes the walk.85dfcd3a2ARM64EC iOS: opt-in JIT block map and code dump (MADEIRA_JITMAP, MADEIRA_JITCODE).5aa515f35Core: hash-map CachedCodePages and a cache-hit fast path in CompileBlock.MADEIRA_FEX_CB_FAST=0turns the fast path off.e6906d843Core, Windows: skip invalidation for freed data, hash the L1 index, lock counters.MADEIRA_FEX_FREE_SKIP(default 1),MADEIRA_FEX_L1_HASH(default 1, at every L1 site including the dispatcher sequences),[fexlock-stats]and[l1-miss-t]lines.380fdf1d1Core: redirect pool-copy aliases before the cache-hit fast path, [alias-redir] stats. The lock-free reverse translation is checked first and the dispatcher re-enters at the PE address, as the existing redirect does.MADEIRA_FEX_ALIAS_FIRST=0turns it off. Each thread logs its redirect rate and heaviest targets every 30 s.3b70cde73ARM64EC: MADEIRA_JITCODE takes up to 128 entries.0404a418dCore: inline small-copy path at MSVC's memcpy/memmove entry (MADEIRA_FEX_MEMMOVE=0 turns it off). A block that is the routine's entry (its first 46 bytes) gets a new IR op, MadeiraSmallMove, in front: an inline copy for 0..256 bytes between ranges that do not overlap, writing only JIT temporaries; anything else falls through to the routine.3347f3d25unittests: ASM tests for the byte-copy-loop and memmove idioms, run through the real ARM64 code generator by the x86-64 host build with the VIXL simulator: every length 0..300 at sixteen distances against REP MOVSB, and the byte loop at lengths 1..40.52fd63256Core: compile tiny leaf functions inline at direct call sites (MADEIRA_FEX_LEAF_INLINE=0 turns it off). A direct CALL's callee of at most 12 instructions and 64 bytes of allow-listed straight-line code ending in RET is compiled into the caller's block, with the return address pushed and popped as the CALL and RET would.3562a1523JIT: MadeiraSmallMove copies 64 to 256 bytes 32 at a time.c4980fb6dCore: inline small copy at direct call sites of MSVC's memcpy/memmove (MADEIRA_FEX_MEMMOVE_SITES=0 turns it off). The leaf inliner's callee decode recognises the routine; the call site does the CALL's push, then the inline copy and the RET's check. A copy it declines (over 256 bytes, overlapping) enters the routine with the return address already pushed.c64e462a4Allocator: MADEIRA_FEX_ZERO_SCRUB=0 skips the read-and-verify pass over new call-return stacks and L1 tables. On by default.3772a418aJIT: MadeiraSmallMove takes two length tests (MADEIRA_FEX_SMALLMOVE_TREE=0 keeps the chain). Each range from 4 bytes up moves as four possibly overlapping pieces of one width.f90d93c3aCall-site memmove without the CALL's push, a per-thread copy census, both forms in one run.MADEIRA_FEX_MOVE_NOPUSH1 = the copy runs with the CALL not started; 2 = both forms compiled, alternating by thread;MADEIRA_FEX_MOVE_CENSUS = 1counts copies per thread. Default 0 (no change).e948dd11aFrontend: MADEIRA_FEX_LEAF_MAX takes callees of up to 32 instructions inline (default 12). Test: unittests/ASM/Madeira/leaf_inline_long.asm (20- and 26-instruction callees).Defaults
Left out
MADEIRA_FEX_L1_BIG): the main thread got a million entries and still missed 350-590K times a second, because the misses were aliases, not capacity.Other branches
codex/fex-runtime-consolidation(the FEX thatcodex/dxmt-upstream-build-portpins) and into every other active branch on 22 Nov; not repeated for the nine new commits.Testing
380fdf1d1was rebuilt without the big-L1 commit it sat on in the device tree; it only shares a thread-id helper with it.🤖 Generated with Claude Code