Repository navigation
Conversation
|
Source review of current head
These are source-level findings. I did not run a build, GPU test, or title on this PR. AI use: Codex (GPT-6.2 Sol) reviewed the integration and existing tracker; Codex (GPT-6.2 Astra) traced the assembly and concurrency paths. |
A monitorx / mwaitx on a CPU without them (Intel) is rewritten in place at its first fault, but only when it fits in one aligned 8-byte word. GTA 6 has a monitorx at an address ending in 7: its 3 bytes cross two words, rewrite_code refused it, and every poll of that spin loop raised #UD and was emulated. A 10 s WPR trace in the world showed about 2,359 kernel samples on the render thread in that exception path. Such an instruction is now rewritten with one lock cmpxchg16b (the std::arch intrinsic) on its aligned 16-byte block, with the same compare-and-retry and page protection as the 8-byte path. Only one across a 16-byte boundary stays emulated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
29be3d1 to
3c29d4b
Compare
|
Thanks for the review. Head is now 3c29d4b.
Suite on 3c29d4b: 2890 passed, 0 failed, 51 ignored, 28 SKIPPED lines (as before). The smoke blocks in the description are rerun on this head. AI use: Claude Code, Claude Fable 5.2 checked both points against the source, wrote the change and this reply, and ran the tests. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
|
No open or merged PR makes the same change. #2618 (open) adds an older 8-byte-only AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
On a CPU without
monitorx/mwaitx(Intel), the first fault rewrites a console wait in place, but only when the instruction fits in one aligned 8-byte word. GTA 6 has amonitorxat an address ending in 7, so its 3 bytes cross two words:rewrite_coderefused it and every poll of that spin loop raised #UD and was emulated. This change rewrites such an instruction with onelock cmpxchg16b(thestd::archintrinsic) on its aligned 16-byte block. Only an instruction across a 16-byte boundary stays emulated. Part of #505.What is in it
crates/xcl/src/eh.rs:rewrite_codeuses an aligned 8-byte word when the instruction fits and its 16-byte block otherwise (replace_code_block,compare_exchange_16), with the same compare-and-retry and page protection as the 8-byte path.a_rewrite_crossing_an_atomic_word_uses_its_16_byte_block(replacesa_rewrite_crossing_an_atomic_word_stays_emulated): sites at block offsets 6 and 7 are rewritten, one at offset 14 stays emulated, and the bytes around them are untouched. It fails without the change (at block offset 6: false).compare_exchange_16_stores_on_a_match_and_reports_a_mismatch: a matching exchange stores, a failed comparison stores nothing and reports the value found, and the 16-byte blocks on either side keep their bytes.Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on 3c29d4b (on main ff0c364): 2890 passed, 0 failed, 51 ignored.SKIPPEDon this adapter: 28: 22no wave64; 2no heap windows; 2no d3d12SDKLayers.dll; 1no D3D12 debug layer; 1 cannot disable the driver cache (no Developer Mode).monitorx; after, the site is gone from the kernel callers. The frame rate did not change (2–5 presents per 2 s): this saves CPU time, it is not what limits GTA 6 there.Regression run
Each run follows one warm-up run of the same build; the A button is pressed once at 70 s.
Not tested
monitorx/mwaitxnatively and never take this path.CODE_REWRITE(Console CPU emulation: ClzeroLoop decoder/semantics, is_writable guards, and CLWB hot-patch race #278). That is the same onmain, also for the 8-byte path, and is not changed here.AI use
🤖 Generated with Claude Code