Console CPU instructions: leave CLWB intact while single stepping #566

Merged
Prime1997 merged 1 commit from upstream-pr/571 into main 2026-11-30 03:22:30 +00:00
Prime1997 commented 2026-11-24 01:56:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-24T01:56:38Z.


When a debugger single-steps a title on a CPU without CLWB, the exception handler currently replaces the original instruction with several one-byte NOPs. A later visit to the same address sees different instruction boundaries. Keep the instruction bytes while the x86 trap flag is set.

What is in it

  • Check the saved trap flag before patching a CLWB site. The handler still advances the instruction pointer.
  • Exercise 4-, 5- and 6-byte encodings on an executable, read-only page. The test revisits each site while stepping, then clears the trap flag and checks the ordinary patching path.
  • This touches the same handler arm as #321. That PR addresses concurrent code patching. This change covers stepping and can be retained if the patch mechanism changes.

Tested

  • ff37edccb1dabb9e39985b51ecf33a5e352c699a, Windows 11 Pro build 26200, Intel Core i5-10400, NVIDIA GeForce RTX 3060 Ti, driver 32.0.16.1714, Rust 1.100.0 MSVC.
  • The new test failed on main 508a0c7 with the original four-byte CLWB replaced by four NOPs. The release exception-handler tests passed after the change (7 passed, 0 failed, 0 ignored).
  • The full cargo test --workspace run with locked dependencies, four test threads and --no-fail-fast completed with 681 passed, 0 failed, 41 ignored. Two GPU tests reported a wave64 hardware skip. Both the debug workspace and release CLI builds passed.

Regression run

Both runs used the same retail title, RTX 3060 Ti, 60-second limit, offline mode, first-use compute setting and two DXC workers.

Main

xcl-smoke v1
commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 556 (PresentX 556)
presents per 2 s (last 3): 4 5 4
device removals: 0
crashes: 0
peak commit: 14899 MB

PR head

xcl-smoke v1
commit: ff37edccb1dabb9e39985b51ecf33a5e352c699a
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1229 (PresentX 1229)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14469 MB

Not tested

The focused test exercises the real exception handler with a saved Windows context. An interactive debugger session and CPUs that execute CLWB natively were outside this test. Optional retail sample tests had no external input.

AI use

OpenAI Codex (GPT-6) assisted with reproducing the behavior, implementing the guard and tests, checking overlap and preparing this report.

I use a temporary Discord to coordinate my work. Anyone helping test XCL or compare results is welcome. Test coordination on Discord

<!-- greyfinch-sync:ivall/xcl:issue:5464607151 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/571). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-24T01:56:38Z. --- When a debugger single-steps a title on a CPU without CLWB, the exception handler currently replaces the original instruction with several one-byte NOPs. A later visit to the same address sees different instruction boundaries. Keep the instruction bytes while the x86 trap flag is set. **What is in it** - Check the saved trap flag before patching a CLWB site. The handler still advances the instruction pointer. - Exercise 4-, 5- and 6-byte encodings on an executable, read-only page. The test revisits each site while stepping, then clears the trap flag and checks the ordinary patching path. - This touches the same handler arm as #321. That PR addresses concurrent code patching. This change covers stepping and can be retained if the patch mechanism changes. **Tested** - `ff37edccb1dabb9e39985b51ecf33a5e352c699a`, Windows 11 Pro build 26200, Intel Core i5-10400, NVIDIA GeForce RTX 3060 Ti, driver 32.0.16.1714, Rust 1.100.0 MSVC. - The new test failed on main `508a0c7` with the original four-byte CLWB replaced by four NOPs. The release exception-handler tests passed after the change (7 passed, 0 failed, 0 ignored). - The full `cargo test --workspace` run with locked dependencies, four test threads and `--no-fail-fast` completed with 681 passed, 0 failed, 41 ignored. Two GPU tests reported a wave64 hardware skip. Both the debug workspace and release CLI builds passed. **Regression run** Both runs used the same retail title, RTX 3060 Ti, 60-second limit, offline mode, first-use compute setting and two DXC workers. Main ``` xcl-smoke v1 commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 556 (PresentX 556) presents per 2 s (last 3): 4 5 4 device removals: 0 crashes: 0 peak commit: 14899 MB ``` PR head ``` xcl-smoke v1 commit: ff37edccb1dabb9e39985b51ecf33a5e352c699a gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 1229 (PresentX 1229) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14469 MB ``` **Not tested** The focused test exercises the real exception handler with a saved Windows context. An interactive debugger session and CPUs that execute CLWB natively were outside this test. Optional retail sample tests had no external input. **AI use** OpenAI Codex (GPT-6) assisted with reproducing the behavior, implementing the guard and tests, checking overlap and preparing this report. I use a temporary Discord to coordinate my work. Anyone helping test XCL or compare results is welcome. [Test coordination on Discord](https://discord.gg/gK3y7WRRY)
MesshM commented 2026-11-24 07:05:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T03:12:03Z.


Test run of ff37edccb1dabb9e39985b51ecf33a5e352c699a on AMD RDNA4. I merged it onto current main dd2ae9a locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 691 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 651 passed, 0 failed, 21 ignored
  • 0 SKIPPED; clwb_single_step_keeps_code_and_normal_faults_still_patch passes.

Review: With the trap flag (EFlags & 0x100) set the handler leaves the bytes alone and only advances RIP; without it it patches as before, and the test covers the 4-, 5- and 6-byte encodings both ways. I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

<!-- greyfinch-sync:ivall/xcl:comment:7120866319 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/571#issuecomment-7120866319). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T03:12:03Z. --- Test run of `ff37edccb1dabb9e39985b51ecf33a5e352c699a` on AMD RDNA4. I merged it onto current `main` `dd2ae9a` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **691 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 651 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `clwb_single_step_keeps_code_and_normal_faults_still_patch` passes. **Review:** With the trap flag (`EFlags & 0x100`) set the handler leaves the bytes alone and only advances RIP; without it it patches as before, and the test covers the 4-, 5- and 6-byte encodings both ways. I found nothing to change. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
upipibi commented 2026-11-24 07:06:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T04:05:18Z.


On the overlap with #321 that the description mentions: I checked it at heads ff37edccb1 (this PR) and dfa332a5a4 (#321). The two conflict in crates/xcl/src/eh.rs in either order against main f4ce27ceb6, and #321 changes the premise of this one.

  • This PR guards the code.fill(0x90) path. Several one-byte NOPs move the instruction boundaries a stepping debugger sees on its next visit.
  • #321 removes that path. hot_patch_clwb writes a single 2-byte jmp short over the whole CLWB, atomically under the CLWB_PATCHES lock. After that patch, a later visit sees one instruction at rip that ends at rip + len, so the boundary problem this PR fixes no longer occurs.

So if #321 lands first, this PR's change mostly becomes unnecessary. The TF check would only matter if the code should stay untouched while a debugger steps at all, in which case it would go at #321's call site (if hot_patch_clwb(rip, ...) == ClwbPatch::Patched, line 428 at its head) and return the Stepped behaviour. Your test cases (4-, 5- and 6-byte encodings, TF on and off) would still be useful against #321's jump patch either way.

Read-only, not built. AI-assisted (Claude Code).

<!-- greyfinch-sync:ivall/xcl:comment:7121694805 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/571#issuecomment-7121694805). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T04:05:18Z. --- On the overlap with #321 that the description mentions: I checked it at heads `ff37edccb1` (this PR) and `dfa332a5a4` (#321). The two conflict in `crates/xcl/src/eh.rs` in either order against `main` `f4ce27ceb6`, and #321 changes the premise of this one. - This PR guards the `code.fill(0x90)` path. Several one-byte NOPs move the instruction boundaries a stepping debugger sees on its next visit. - #321 removes that path. `hot_patch_clwb` writes a single 2-byte `jmp short` over the whole CLWB, atomically under the `CLWB_PATCHES` lock. After that patch, a later visit sees one instruction at `rip` that ends at `rip + len`, so the boundary problem this PR fixes no longer occurs. So if #321 lands first, this PR's change mostly becomes unnecessary. The TF check would only matter if the code should stay untouched while a debugger steps at all, in which case it would go at #321's call site (`if hot_patch_clwb(rip, ...) == ClwbPatch::Patched`, line 428 at its head) and return the `Stepped` behaviour. Your test cases (4-, 5- and 6-byte encodings, TF on and off) would still be useful against #321's jump patch either way. Read-only, not built. AI-assisted (Claude Code).
Prime1997 commented 2026-11-24 07:06:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-24T04:08:37Z.


On the overlap with #321 that the description mentions: I checked it at heads ff37edccb1 (this PR) and dfa332a5a4 (#321). The two conflict in crates/xcl/src/eh.rs in either order against main f4ce27ceb6, and #321 changes the premise of this one.

  • This PR guards the code.fill(0x90) path. Several one-byte NOPs move the instruction boundaries a stepping debugger sees on its next visit.
  • Console CPU instructions: serialize CLWB hot-patching and flush icache (#278) #321 removes that path. hot_patch_clwb writes a single 2-byte jmp short over the whole CLWB, atomically under the CLWB_PATCHES lock. After that patch, a later visit sees one instruction at rip that ends at rip + len, so the boundary problem this PR fixes no longer occurs.

So if #321 lands first, this PR's change mostly becomes unnecessary. The TF check would only matter if the code should stay untouched while a debugger steps at all, in which case it would go at #321's call site (if hot_patch_clwb(rip, ...) == ClwbPatch::Patched, line 428 at its head) and return the Stepped behaviour. Your test cases (4-, 5- and 6-byte encodings, TF on and off) would still be useful against #321's jump patch either way.

Read-only, not built. AI-assisted (Claude Code).

Interesting. I was using 321 but I didn't think it would be an issue, but I will try and see if this gets pushed first. If anything, we can use a debugger for the lower end systems.

Good catch!

<!-- greyfinch-sync:ivall/xcl:comment:7121746048 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/571#issuecomment-7121746048). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-24T04:08:37Z. --- > On the overlap with #321 that the description mentions: I checked it at heads `ff37edccb1` (this PR) and `dfa332a5a4` (#321). The two conflict in `crates/xcl/src/eh.rs` in either order against `main` `f4ce27ceb6`, and #321 changes the premise of this one. > > * This PR guards the `code.fill(0x90)` path. Several one-byte NOPs move the instruction boundaries a stepping debugger sees on its next visit. > * [Console CPU instructions: serialize CLWB hot-patching and flush icache (#278) #321](https://github.com/ivall/xcl/pull/321) removes that path. `hot_patch_clwb` writes a single 2-byte `jmp short` over the whole CLWB, atomically under the `CLWB_PATCHES` lock. After that patch, a later visit sees one instruction at `rip` that ends at `rip + len`, so the boundary problem this PR fixes no longer occurs. > > So if #321 lands first, this PR's change mostly becomes unnecessary. The TF check would only matter if the code should stay untouched while a debugger steps at all, in which case it would go at #321's call site (`if hot_patch_clwb(rip, ...) == ClwbPatch::Patched`, line 428 at its head) and return the `Stepped` behaviour. Your test cases (4-, 5- and 6-byte encodings, TF on and off) would still be useful against #321's jump patch either way. > > Read-only, not built. AI-assisted (Claude Code). Interesting. I was using 321 but I didn't think it would be an issue, but I will try and see if this gets pushed first. If anything, we can use a debugger for the lower end systems. Good catch!
DavidM1911 commented 2026-11-25 14:09:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T13:18:33Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7163589058 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/571#issuecomment-7163589058). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T13:18:33Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
upipibi commented 2026-11-26 05:05:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T04:30:07Z.


NVIDIA test report for ff37edc: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.

  • cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4 (the hle::xaudio2 tests hang on this machine, on main too):
  • this PR: 632 passed, 0 failed, 21 ignored; 2 SKIPPED lines (both no wave64). The new clwb_single_step_keeps_code_and_normal_faults_still_patch passes.

Lib tests only; no title run.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7182649611 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/571#issuecomment-7182649611). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-26T04:30:07Z. --- NVIDIA test report for `ff37edc`: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. - `cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4` (the `hle::xaudio2` tests hang on this machine, on `main` too): - this PR: 632 passed, 0 failed, 21 ignored; 2 SKIPPED lines (both `no wave64`). The new `clwb_single_step_keeps_code_and_normal_faults_still_patch` passes. Lib tests only; no title run. AI-assisted (Claude Code, Claude Opus 5.5).
throny commented 2026-11-28 06:50:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T06:50:23Z.


merge-check claim
head: ff37edccb1

<!-- greyfinch-sync:ivall/xcl:comment:7235549855 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/571#issuecomment-7235549855). Originally posted by [throny](https://github.com/throny) on 2026-11-28T06:50:23Z. --- merge-check claim head: ff37edccb1dabb9e39985b51ecf33a5e352c699a
throny commented 2026-11-28 07:07:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T07:07:03Z.


merge-check
base: e429936c
head: ff37edccb1
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2127 passed, 9 failed, 48 ignored (26 SKIPPED lines). The 9 failures are main's own at e429936c on this GPU (reported with a bisect on #3041: they arrive with the merge of #2959); the set is identical with and without this PR. Base alone: 2126 passed, 9 failed, 48 ignored.
review: no blocking finding. XCL never sets the trap flag itself, so a run without a debugger behaves as before; with the flag set no protection change is made, so there is nothing to restore, and the path without it restores the old protection as main does. Pre-existing, not introduced: the handler continues after the emulated instruction with the trap flag still set. For whoever merges: #321 (open) conflicts in eh.rs and replaces the code path this PR adjusts, which would make this change mostly unnecessary; decide the order first.
performance: none by default; only under the trap flag does each visit fault again.
verdict: safe to merge (after deciding the order with #321)
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7235726605 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/571#issuecomment-7235726605). Originally posted by [throny](https://github.com/throny) on 2026-11-28T07:07:03Z. --- merge-check base: e429936c head: ff37edccb1dabb9e39985b51ecf33a5e352c699a merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2127 passed, 9 failed, 48 ignored (26 SKIPPED lines). The 9 failures are main's own at e429936c on this GPU (reported with a bisect on #3041: they arrive with the merge of #2959); the set is identical with and without this PR. Base alone: 2126 passed, 9 failed, 48 ignored. review: no blocking finding. XCL never sets the trap flag itself, so a run without a debugger behaves as before; with the flag set no protection change is made, so there is nothing to restore, and the path without it restores the old protection as main does. Pre-existing, not introduced: the handler continues after the emulated instruction with the trap flag still set. For whoever merges: #321 (open) conflicts in eh.rs and replaces the code path this PR adjusts, which would make this change mostly unnecessary; decide the order first. performance: none by default; only under the trap flag does each visit fault again. verdict: safe to merge (after deciding the order with #321) hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
bmjask commented 2026-11-29 22:46:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:46:11Z.

Review: COMMENTED


Critical review of current head ff37edcc. The trap-flag guard is a targeted fix: while stepping, advancing RIP without rewriting a multi-byte CLWB keeps subsequent instruction boundaries stable; the new encoding fixture exercises the ordinary patch path too. I found no blocker in this head alone. It overlaps #321 in the same handler arm, and #321 changes the patching premise, so please resolve those branches in one direction and rerun the single-step fixture on the integrated result before merge. No local Windows run.

<!-- greyfinch-sync:ivall/xcl:review:6105201501 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/571#pullrequestreview-6105201501). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T22:46:11Z. **Review:** COMMENTED --- Critical review of current head `ff37edcc`. The trap-flag guard is a targeted fix: while stepping, advancing RIP without rewriting a multi-byte CLWB keeps subsequent instruction boundaries stable; the new encoding fixture exercises the ordinary patch path too. I found no blocker in this head alone. It overlaps #321 in the same handler arm, and #321 changes the patching premise, so please resolve those branches in one direction and rerun the single-step fixture on the integrated result before merge. No local Windows run.
relativespace2K commented 2026-11-30 02:37:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by relativespace2K on 2026-11-30T02:37:53Z.


merge-check
base: 53e85fb1
head: ff37edccb1
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2789 passed, 6 failed, 49 ignored; failing: gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form, gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, ram_budget::tests::windows_takes_a_working_set_maximum_and_lifts_it, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (in --test gpu_two_pass_cache_e2e, so 5 failing tests give 6 failures). The same five fail on base 53e85fb1 alone (2788 passed, 6 failed, 49 ignored there), so none comes from this PR; its new test passed. 13 SKIPPED lines, all environmental: no D3D12 debug layer / d3d12SDKLayers.dll, no heap windows, no GPU_UPLOAD, per-lane f16/f32 forms refused.
review: no blocking finding; one file, every hunk read. The change is one condition: when the trap flag is set in the CONTEXT the hot-patch is skipped, so a single-stepped console CLWB stays the one instruction the title asked to step instead of becoming several one-byte 0x90s that the debugger would stop on separately. Everything else on that path is untouched, and the new test proves both directions: with TF the bytes and PAGE_EXECUTE_READ protection are unchanged across two visits, without it the first bytes really become 0x90 and the rest of the buffer is not, for three encodings ([rax], [rsp+8], [r8]) and for an ordinary hot-patching control value. Handling the emulated instruction again on every step is the slower, correct side of that trade, and it only happens under a debugger. Notes, not blocking: the mask is written as a bare 0x100 with the comment naming TF; a named constant would read better, and the test zero-initialises the whole CONTEXT rather than the fields it uses, which is fine for a hand-called emulation. No duplicate: nothing else changes the CLWB path. Duplicate/overlap: not a duplicate of #321 (that one serialises the patch and replaces the 0x90 fill with a jmp short head, and flushes the icache; this one only declines to patch under TF), but both edit the same Clwb => arm in crates/xcl/src/eh.rs, so whichever lands second needs a rebase and the order with #321 should be decided before merging either, as throny noted.
performance: none in a normal run: the branch is only taken when the trap flag is set, which a title run never does.
verdict: safe to merge
hardware / tool and model: AMD Radeon RX 6800 XT 16 GB (RDNA2, wave64), driver 32.0.21045.29003; Ryzen 5 5600, 32 GB RAM; Windows 10 IoT Enterprise LTSC 2024, 10.0.26100 build 26100.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build. DeepSeek Harness coding agent, model DeepSeek V4.1 Flash. The first full run aborted in -p xcl --lib with 0xc0000005 (STATUS_ACCESS_VIOLATION) before that target printed a result, the intermittent abort under parallel scheduling (#1978); the numbers above are the clean rerun.

<!-- greyfinch-sync:ivall/xcl:comment:7267174754 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/571#issuecomment-7267174754). Originally posted by [relativespace2K](https://github.com/relativespace2K) on 2026-11-30T02:37:53Z. --- merge-check base: 53e85fb1 head: ff37edccb1dabb9e39985b51ecf33a5e352c699a merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2789 passed, 6 failed, 49 ignored; failing: gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form, gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, ram_budget::tests::windows_takes_a_working_set_maximum_and_lifts_it, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (in `--test gpu_two_pass_cache_e2e`, so 5 failing tests give 6 failures). The same five fail on base 53e85fb1 alone (2788 passed, 6 failed, 49 ignored there), so none comes from this PR; its new test passed. 13 SKIPPED lines, all environmental: no D3D12 debug layer / d3d12SDKLayers.dll, no heap windows, no GPU_UPLOAD, per-lane f16/f32 forms refused. review: no blocking finding; one file, every hunk read. The change is one condition: when the trap flag is set in the `CONTEXT` the hot-patch is skipped, so a single-stepped console `CLWB` stays the one instruction the title asked to step instead of becoming several one-byte `0x90`s that the debugger would stop on separately. Everything else on that path is untouched, and the new test proves both directions: with `TF` the bytes and `PAGE_EXECUTE_READ` protection are unchanged across two visits, without it the first bytes really become `0x90` and the rest of the buffer is not, for three encodings (`[rax]`, `[rsp+8]`, `[r8]`) and for an ordinary hot-patching control value. Handling the emulated instruction again on every step is the slower, correct side of that trade, and it only happens under a debugger. Notes, not blocking: the mask is written as a bare `0x100` with the comment naming `TF`; a named constant would read better, and the test zero-initialises the whole `CONTEXT` rather than the fields it uses, which is fine for a hand-called emulation. No duplicate: nothing else changes the `CLWB` path. Duplicate/overlap: not a duplicate of #321 (that one serialises the patch and replaces the `0x90` fill with a `jmp short` head, and flushes the icache; this one only declines to patch under `TF`), but both edit the same `Clwb =>` arm in `crates/xcl/src/eh.rs`, so whichever lands second needs a rebase and the order with #321 should be decided before merging either, as throny noted. performance: none in a normal run: the branch is only taken when the trap flag is set, which a title run never does. verdict: safe to merge hardware / tool and model: AMD Radeon RX 6800 XT 16 GB (RDNA2, wave64), driver 32.0.21045.29003; Ryzen 5 5600, 32 GB RAM; Windows 10 IoT Enterprise LTSC 2024, 10.0.26100 build 26100.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build. DeepSeek Harness coding agent, model DeepSeek V4.1 Flash. The first full run aborted in `-p xcl --lib` with `0xc0000005` (`STATUS_ACCESS_VIOLATION`) before that target printed a result, the intermittent abort under parallel scheduling (#1978); the numbers above are the clean rerun.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!566
No description provided.