LATX, opt: Add RIP-relative and complex address caches - #466
Open
y347812075 wants to merge 2 commits into
Open
Conversation
RIP-relative x86_64 memory operands repeatedly materialize nearby absolute addresses even when the same value can be retained within a translation block. Add a separately controlled CODE64 RIP-relative immediate cache with address-size and segment safety checks, cache statistics, and explicit rollback controls. Record the mode in AOT compatibility metadata so mismatched cached code is rejected. Keep RIP-relative caching disabled by default. Add integration coverage for JIT/AOT translation, option precedence, invalidation, signals, fork, SMC, and immediate-register pressure. Signed-off-by: yuerengan <y347812075@163.com>
The complex-address immediate cache was disabled as a single all-or-nothing option and lacked the safety and observability needed for deployment. Add independent base+disp, index*scale+disp, and combined mode bits with strict CODE64, address-size, and segment checks. Track complete register writes, preserve AOT cache compatibility, and report per-mode cache statistics. Enable all three modes by default for x86_64 while retaining environment and command-line rollback controls; keep i386, RIP-relative caching, and precache disabled. Add integration coverage for default enablement, explicit disablement, addressing modes, register invalidation, helpers, signals, fork, SMC, JIT/AOT, and itemp pressure. Tests: - ninja -C build64 latx-x86_64 - ninja -C build32 latx-i386 - tests/integration/test-complex-imm-cache.sh build64/latx-x86_64 tests/integration/complex-imm-cache.S - ninja -C build64-tests - meson test -C build64-tests --suite lat-pr-fast --print-errorlogs - SPEC CPU2000 ref: 176.gcc, 164.gzip, 186.crafty, 254.gap (mask 0 and mask 7) Signed-off-by: yuerengan <y347812075@163.com>
3 tasks
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.
Summary
statistics, AOT compatibility metadata, and an explicit rollback switch
modes, including implicit-register invalidation and precache state tracking
RIP-relative caching, and precache disabled by default
WorkItems: WI-2238, WI-2239
Configuration and rollback
LATX_IMM_COMPLEX=0disables all complex-address modes.LATX_IMM_REG=0000disables the immediate-register cache master switch.LATX_IMM_RIP=0keeps the RIP-relative cache disabled.LATX_IMM_PRECACHE=0keeps precache disabled.Validation
ninja -C build64 latx-x86_64ninja -C build32 latx-i386tests/integration/test-rip-imm-cache.sh build64/latx-x86_64 tests/integration/rip-imm-cache.Stests/integration/test-complex-imm-cache.sh build64/latx-x86_64 tests/integration/complex-imm-cache.Sninja -C build64-testsmeson test -C build64-tests --suite lat-pr-fast --print-errorlogs(24/24 passed)git diff-tree --checkfor both commitsscripts/checkpatch.pl --no-tree --strict(0 errors; one genericMAINTAINERS warning for newly added test files)
An initial single-run SPEC CPU2000 ref screening with the complex cache fully
enabled produced a 0.43% geometric-mean runtime improvement across 176.gcc,
164.gzip, 186.crafty, and 254.gap. This is screening data rather than a stable
performance claim.