D3D12.X: register x64 .pdata unwind info for stub and guard thunks #930

Merged
real-alponzo merged 1 commit from upstream-pr/936 into main 2026-11-29 12:21:31 +00:00
real-alponzo commented 2026-11-24 08:44:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by real-alponzo on 2026-11-24T08:44:56Z.


Registers x64 .pdata (UNWIND_INFO + RUNTIME_FUNCTION via RtlAddFunctionTable) for the RWX thunks emitted by stubs::make_stub_info and d3d12x::guard::thunk, matching what guard::make_call_tracer already does.

Without .pdata, Windows RtlLookupFunctionEntry treats those thunks as leaf functions even though make_stub_info adjusts rsp (sub rsp, 0x28) and guard::thunk pushes rcx/rdx/r8/r9 and allocates 0x68 bytes before calling into Rust. That breaks eh::unwind (eh::dump_threads) and SEH/C++ unwinding whenever a stub hook or guard callback is on the stack.

What is in it

  • crates/xcl/src/stubs.rs: extract alloc_code_with_unwind (appends 4-byte-aligned UNWIND_INFO + RUNTIME_FUNCTION, flushes icache, calls RtlAddFunctionTable) and use it in make_stub_info (UWOP_ALLOC_SMALL for sub rsp, 0x28); add live-stack RtlVirtualUnwind test (stub_thunk_unwinds_through_pdata_to_its_caller).
  • crates/xcl/src/hle/d3d12x/guard.rs: reuse stubs::alloc_code_with_unwind in make_call_tracer and register unwind info for thunk (sub rsp, 0x68 + push r9/r8/rdx/rcx, ending right before the tail jump once the stack is restored to leaf state); add live-stack RtlVirtualUnwind test (guard_thunk_unwinds_through_pdata_to_its_caller).

Tested

  • Hardware: Windows 11 Pro for Workstations (Build 26300), Intel Core i9-9900K, AMD Radeon RX 6800 (16337 MiB VRAM, driver 32.0.21045.29003), rustc 1.100.0 (x86_64-pc-windows-msvc), DXC 1.9.2602.17 (debug for tests, release for smoke runs).
  • XCL_REQUIRE_GPU=wave64,mesh + cargo test --workspace --no-fail-fast -- --test-threads=4 on 9a1e188: 715 passed, 3 failed, 41 ignored, 0 GPU skipped (xcl lib: 674 passed / 3 failed / 21 ignored; integration/e2e: 41 passed / 0 failed / 20 ignored; XCL_SAMPLE_* unset).
    • Both new live unwind tests (stubs::tests::stub_thunk_unwinds_through_pdata_to_its_caller and hle::d3d12x::guard::tests::guard_thunk_unwinds_through_pdata_to_its_caller) pass.
    • The 3 failures are exclusively the pre-existing AMD RDNA2 packed-mip failure in placed_title_textures_share_vram_and_preserve_pixels (3D 64x64x64 4 mips: subresource 2 mismatch, failing identically on unmodified main and fixed by open PR #470) plus its 2 VRAM_TEST_LOCK PoisonError cascades (transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory, which pass when run individually).

Regression run
Both runs below used the same warmed shader/PSO cache on YouKnowWho (60 s):

main (09940bb87fa1):

xcl-smoke v1
commit: 09940bb87fa11bc394fd9e5de570c2b7cfd16323
gpu: AMD Radeon RX 6800
title: YouKnowWho
seconds: 60
exit: 0x0
frames shown: 405 (PresentX 405)
presents per 2 s (last 3): 11 12 11
device removals: 0
crashes: 0
peak commit: 15870 MB

PR head (9a1e18804c89):

xcl-smoke v1
commit: 9a1e18804c8903c77f2de6251b855ee41e8dce57
gpu: AMD Radeon RX 6800
title: YouKnowWho
seconds: 60
exit: 0x0
frames shown: 370 (PresentX 370)
presents per 2 s (last 3): 9 9 9
device removals: 0
crashes: 0
peak commit: 15874 MB

Not tested

  • Sample-data tests (XCL_SAMPLE_* unset).
  • C++ exception throwing through a live title stub/guard frame (unwinding verified via RtlCaptureContext + RtlLookupFunctionEntry + RtlVirtualUnwind).

AI use

  • Implemented, tested, and verified with Antigravity (Gemini 4 Neon); every change and test result reviewed by the author on local hardware.
<!-- greyfinch-sync:ivall/xcl:issue:5468906368 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/936). Originally posted by [real-alponzo](https://github.com/real-alponzo) on 2026-11-24T08:44:56Z. --- Registers x64 `.pdata` (`UNWIND_INFO` + `RUNTIME_FUNCTION` via `RtlAddFunctionTable`) for the RWX thunks emitted by `stubs::make_stub_info` and `d3d12x::guard::thunk`, matching what `guard::make_call_tracer` already does. Without `.pdata`, Windows `RtlLookupFunctionEntry` treats those thunks as leaf functions even though `make_stub_info` adjusts `rsp` (`sub rsp, 0x28`) and `guard::thunk` pushes `rcx`/`rdx`/`r8`/`r9` and allocates `0x68` bytes before calling into Rust. That breaks `eh::unwind` (`eh::dump_threads`) and SEH/C++ unwinding whenever a stub hook or guard callback is on the stack. **What is in it** - `crates/xcl/src/stubs.rs`: extract `alloc_code_with_unwind` (appends 4-byte-aligned `UNWIND_INFO` + `RUNTIME_FUNCTION`, flushes icache, calls `RtlAddFunctionTable`) and use it in `make_stub_info` (`UWOP_ALLOC_SMALL` for `sub rsp, 0x28`); add live-stack `RtlVirtualUnwind` test (`stub_thunk_unwinds_through_pdata_to_its_caller`). - `crates/xcl/src/hle/d3d12x/guard.rs`: reuse `stubs::alloc_code_with_unwind` in `make_call_tracer` and register unwind info for `thunk` (`sub rsp, 0x68` + `push r9/r8/rdx/rcx`, ending right before the tail jump once the stack is restored to leaf state); add live-stack `RtlVirtualUnwind` test (`guard_thunk_unwinds_through_pdata_to_its_caller`). **Tested** - Hardware: Windows 11 Pro for Workstations (Build `26300`), Intel Core i9-9900K, AMD Radeon RX 6800 (`16337 MiB VRAM`, driver `32.0.21045.29003`), `rustc 1.100.0` (`x86_64-pc-windows-msvc`), DXC `1.9.2602.17` (`debug` for tests, `release` for smoke runs). - `XCL_REQUIRE_GPU=wave64,mesh` + `cargo test --workspace --no-fail-fast -- --test-threads=4` on `9a1e188`: **715 passed, 3 failed, 41 ignored, 0 GPU skipped** (`xcl` lib: 674 passed / 3 failed / 21 ignored; integration/e2e: 41 passed / 0 failed / 20 ignored; `XCL_SAMPLE_*` unset). - Both new live unwind tests (`stubs::tests::stub_thunk_unwinds_through_pdata_to_its_caller` and `hle::d3d12x::guard::tests::guard_thunk_unwinds_through_pdata_to_its_caller`) pass. - The 3 failures are exclusively the pre-existing AMD RDNA2 packed-mip failure in `placed_title_textures_share_vram_and_preserve_pixels` (`3D 64x64x64 4 mips: subresource 2 mismatch`, failing identically on unmodified `main` and fixed by open PR #470) plus its 2 `VRAM_TEST_LOCK` `PoisonError` cascades (`transitions_apply_when_their_list_is_submitted` and `d32s8_targets_take_their_own_size_of_video_memory`, which pass when run individually). **Regression run** Both runs below used the same warmed shader/PSO cache on `YouKnowWho` (60 s): `main` (`09940bb87fa1`): ``` xcl-smoke v1 commit: 09940bb87fa11bc394fd9e5de570c2b7cfd16323 gpu: AMD Radeon RX 6800 title: YouKnowWho seconds: 60 exit: 0x0 frames shown: 405 (PresentX 405) presents per 2 s (last 3): 11 12 11 device removals: 0 crashes: 0 peak commit: 15870 MB ``` PR head (`9a1e18804c89`): ``` xcl-smoke v1 commit: 9a1e18804c8903c77f2de6251b855ee41e8dce57 gpu: AMD Radeon RX 6800 title: YouKnowWho seconds: 60 exit: 0x0 frames shown: 370 (PresentX 370) presents per 2 s (last 3): 9 9 9 device removals: 0 crashes: 0 peak commit: 15874 MB ``` **Not tested** - Sample-data tests (`XCL_SAMPLE_*` unset). - C++ exception throwing through a live title stub/guard frame (unwinding verified via `RtlCaptureContext` + `RtlLookupFunctionEntry` + `RtlVirtualUnwind`). **AI use** - Implemented, tested, and verified with Antigravity (Gemini 4 Neon); every change and test result reviewed by the author on local hardware.
dcastell1 commented 2026-11-24 09:07:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T08:56:54Z.


Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean main@beaa245 (713 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
715 passed; 0 failed; 41 ignored   (exit 0)

Two more passing tests than main: the x64 .pdata unwind registration for stub and guard thunks is exercised and green.

Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

<!-- greyfinch-sync:ivall/xcl:comment:7126763029 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/936#issuecomment-7126763029). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-24T08:56:54Z. --- Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean `main@beaa245` (713 passed, 0 failed, 41 ignored on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 715 passed; 0 failed; 41 ignored (exit 0) ``` Two more passing tests than main: the x64 `.pdata` unwind registration for stub and guard thunks is exercised and green. Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
SlopTart commented 2026-11-24 11:05:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T10:38:28Z.


Linux / AMD RDNA3 datapoint.

Merged state: head 9a1e188 onto main 9aec53d, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 715 passed, 11 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). .pdata unwind registration tests green.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7129050258 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/936#issuecomment-7129050258). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-24T10:38:28Z. --- Linux / AMD RDNA3 datapoint. **Merged state:** head `9a1e188` onto main `9aec53d`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **715 passed, 11 failed, 41 ignored**; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). .pdata unwind registration tests green. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
raylitebull commented 2026-11-24 11:05:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-24T10:39:57Z.


Code/CI review only (not independently runtime-tested by me): clean merge with both checks green (Build and test + PR description). Cleanly registers x64 .pdata unwind info for generated stub and guard thunks. Recommend merging, @ivall.

<!-- greyfinch-sync:ivall/xcl:comment:7129082777 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/936#issuecomment-7129082777). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-24T10:39:57Z. --- Code/CI review only (not independently runtime-tested by me): clean merge with both checks green (`Build and test` + `PR description`). Cleanly registers x64 `.pdata` unwind info for generated stub and guard thunks. Recommend merging, @ivall.
thaqiart139-alt commented 2026-11-24 23:08:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thaqiart139-alt on 2026-11-24T22:49:01Z.


Test report for this PR's head 9a1e188, merged into main 689f2db (no conflicts), on AMD RDNA2 with native 64-lane waves and on a 32-lane NVIDIA card.

Tested

  • GPUs: AMD Radeon(TM) Graphics, the RDNA2 iGPU of a Ryzen 7 7800X3D (native wave64, driver 32.0.21045.29003), and NVIDIA GeForce RTX 5070 (driver 32.0.16.2101), chosen with XCL_ADAPTER.
  • System: 32 GB, Windows 11 Home build 26300, Rust 1.100.0, debug, DXC 1.9.2602.17.
  • cargo test --workspace --no-fail-fast -- --test-threads=4:
main 689f2db with this PR
RTX 5070 971 passed, 4 failed, 45 ignored 973 passed, 4 failed, 45 ignored
Radeon iGPU 974 passed, 1 failed, 45 ignored 976 passed, 1 failed, 45 ignored
  • This PR adds no failure. The failures are the same on main, from #1679's new fuzz tests, and both are already reported on #1679:
    • RTX 5070: fuzz_validate_and_gpu_0 to _3 (CreateComputePipelineState: 0x8007000E)
    • iGPU: fuzz_validate_and_gpu_1 (seed 540: res[833] = 0x7, CPU 0x6)
  • This PR's new tests pass on both GPUs: guard_thunk_unwinds_through_pdata_to_its_caller, stub_thunk_unwinds_through_pdata_to_its_caller.
SKIPPED tests (the same on main and with this PR)
  • RTX 5070:
    • no wave64:
      • gpu::recomp::lower::tests: a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu
      • gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu, and the wave64 cases of its f16 / f32 / f64 / integer_programs_on_the_gpu
      • gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware
    • the wave32 per-lane cases of lower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused ("its #1426 semantics differ from the console's")
    • heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
    • pso_measurement_compiles_an_exact_synthetic_record (Windows Developer Mode is off)
  • Radeon iGPU:
    • no mesh shaders: gpu::dxil::geometry_tests::gpu_geometry_direct_records, emitted_ms_primitive_attribute_reaches_the_pixel_shader, emitted_ms_ps_draw_a_triangle, gpu_geometry_mode_es_gs_strip, gpu_geometry_mode_es_gs_strip_with_branches, gpu_mesh_mode_two_passes
    • the wave32 and wave64 per-lane cases of lower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused, as above
    • heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
    • pso_measurement_compiles_an_exact_synthetic_record (Developer Mode is off)

Not tested

  • a C++ exception thrown through a live title stub or guard frame, XCL_SAMPLE_* tests, a title run; other GPUs; Linux / Wine.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report.
<!-- greyfinch-sync:ivall/xcl:comment:7146677780 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/936#issuecomment-7146677780). Originally posted by [thaqiart139-alt](https://github.com/thaqiart139-alt) on 2026-11-24T22:49:01Z. --- Test report for this PR's head `9a1e188`, merged into `main` `689f2db` (no conflicts), on AMD RDNA2 with native 64-lane waves and on a 32-lane NVIDIA card. **Tested** - GPUs: AMD Radeon(TM) Graphics, the RDNA2 iGPU of a Ryzen 7 7800X3D (native wave64, driver 32.0.21045.29003), and NVIDIA GeForce RTX 5070 (driver 32.0.16.2101), chosen with `XCL_ADAPTER`. - System: 32 GB, Windows 11 Home build 26300, Rust 1.100.0, debug, DXC 1.9.2602.17. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: | | `main` `689f2db` | with this PR | |---|---|---| | RTX 5070 | 971 passed, 4 failed, 45 ignored | 973 passed, 4 failed, 45 ignored | | Radeon iGPU | 974 passed, 1 failed, 45 ignored | 976 passed, 1 failed, 45 ignored | - This PR adds no failure. The failures are the same on `main`, from #1679's new fuzz tests, and both are already reported on #1679: - RTX 5070: `fuzz_validate_and_gpu_0` to `_3` (`CreateComputePipelineState`: `0x8007000E`) - iGPU: `fuzz_validate_and_gpu_1` (`seed 540: res[833] = 0x7, CPU 0x6`) - This PR's new tests pass on both GPUs: `guard_thunk_unwinds_through_pdata_to_its_caller`, `stub_thunk_unwinds_through_pdata_to_its_caller`. <details><summary>SKIPPED tests (the same on <code>main</code> and with this PR)</summary> - **RTX 5070:** - no wave64: - `gpu::recomp::lower::tests`: `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu` - `gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu`, and the wave64 cases of its `f16` / `f32` / `f64` / `integer_programs_on_the_gpu` - `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` - the wave32 per-lane cases of `lower_dxil`'s f16 arithmetic, f16 packed and f32 conversions: refused ("its #1426 semantics differ from the console's") - `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) - `pso_measurement_compiles_an_exact_synthetic_record` (Windows Developer Mode is off) - **Radeon iGPU:** - no mesh shaders: `gpu::dxil::geometry_tests::gpu_geometry_direct_records`, `emitted_ms_primitive_attribute_reaches_the_pixel_shader`, `emitted_ms_ps_draw_a_triangle`, `gpu_geometry_mode_es_gs_strip`, `gpu_geometry_mode_es_gs_strip_with_branches`, `gpu_mesh_mode_two_passes` - the wave32 and wave64 per-lane cases of `lower_dxil`'s f16 arithmetic, f16 packed and f32 conversions: refused, as above - `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) - `pso_measurement_compiles_an_exact_synthetic_record` (Developer Mode is off) </details> **Not tested** - a C++ exception thrown through a live title stub or guard frame, `XCL_SAMPLE_*` tests, a title run; other GPUs; Linux / Wine. **AI use** - Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report.
DavidM1911 commented 2026-11-25 10:10:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T09:17:13Z.


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:7158126431 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/936#issuecomment-7158126431). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T09:17:13Z. --- 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!
Kalmarv commented 2026-11-29 00:21:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T00:21:52Z.


merge-check
base: fa204595a4
head: 9a1e18804c
merge: clean (trial merge 14576f834a505aceb2f934982eda3e7e62bdc310, local, not pushed; git diff --check clean)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2610 passed, 0 failed, 49 ignored; SKIPPED: 26 (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows); failing: none. Both new tests ran and passed (stubs::tests::stub_thunk_unwinds_through_pdata_to_its_caller, guard::tests::guard_thunk_unwinds_through_pdata_to_its_caller).
review: none blocking; whole diff read (stubs.rs, guard.rs). alloc_code_with_unwind lays out code, then 4-byte-aligned UNWIND_INFO (version 1, odd code count padded), then one RUNTIME_FUNCTION relative to the thunk, and registers it with RtlAddFunctionTable. The call tracer's existing table now goes through the same helper, byte for byte. I checked the unwind codes against the prologs:

  • stub thunk: sub rsp, 0x28 -> [4, 0x42] (UWOP_ALLOC_SMALL, (4+1)*8).
  • guard thunk: push rcx/rdx/r8/r9; sub rsp, 0x68 -> [10, 0xC2] [6, 0x90] [4, 0x80] [2, 0x20] [1, 0x10], in reverse order; offsets and registers are correct.
  • The guard thunk's table ends before the tail (test rax / jmp), so an unwind from there treats it as a leaf frame, which matches the stack at that point.
    Note, not blocking: if an asynchronous unwind (a profiler sample, or a stack walk of a suspended thread) lands on the guard thunk's add rsp, 0x68 / pop sequence, the frame is not handled right. Those instructions are inside the table, but no ret or recognised jump follows them, so the unwinder doesn't treat them as an epilog and applies the full prolog codes. Synchronous unwinds through the call to decide (the case the PR is for, and the one the test covers) are right.
    performance: one RtlAddFunctionTable per thunk at creation time and a few bytes per thunk; nothing per call.
    title run (fast-world harness, release builds of base and of the merged PR, each run as the same firewalled exe from its own fresh snapshot of the same warm cache):
  • base fa204595: exit 0x0, crashes 0, device removals 0, no system display events; world entry at 90.6 s, peak commit 28,620 MB, 70 WARN lines, 5 [STUB] lines.
  • PR merge 14576f83: exit 0x0, crashes 0, device removals 0, no system display events; world entry at 123.1 s, peak commit 29,100 MB (+1.7 %), 65 WARN lines (the same kinds as base, nothing new), 5 [STUB] lines.
  • Both runs ~270 s. The cache doesn't match this main's translator identity, so both spent the world part compiling pipelines and showed no frames in the steady window: frame rate not compared. My own suites and builds for other PRs ran on the machine during the PR run, so the later world entry is not evidence against the PR. The runs show no crash, removal or new warning on the way into the world. They don't show an exception actually being unwound through a thunk.
    verdict: safe to merge
    hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, DXC 1.9.2609 via XCL_DXC_DIR; title runs from release builds. Claude Code, Claude Opus 5.5: merge, build, suite, title runs and full-diff review; this report.
<!-- greyfinch-sync:ivall/xcl:comment:7248060693 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/936#issuecomment-7248060693). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T00:21:52Z. --- merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: 9a1e18804c8903c77f2de6251b855ee41e8dce57 merge: clean (trial merge 14576f834a505aceb2f934982eda3e7e62bdc310, local, not pushed; `git diff --check` clean) build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2610 passed, 0 failed, 49 ignored; SKIPPED: 26 (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows); failing: none. Both new tests ran and passed (`stubs::tests::stub_thunk_unwinds_through_pdata_to_its_caller`, `guard::tests::guard_thunk_unwinds_through_pdata_to_its_caller`). review: none blocking; whole diff read (`stubs.rs`, `guard.rs`). `alloc_code_with_unwind` lays out code, then 4-byte-aligned UNWIND_INFO (version 1, odd code count padded), then one RUNTIME_FUNCTION relative to the thunk, and registers it with `RtlAddFunctionTable`. The call tracer's existing table now goes through the same helper, byte for byte. I checked the unwind codes against the prologs: - stub thunk: `sub rsp, 0x28` -> `[4, 0x42]` (UWOP_ALLOC_SMALL, (4+1)*8). - guard thunk: `push rcx/rdx/r8/r9; sub rsp, 0x68` -> `[10, 0xC2] [6, 0x90] [4, 0x80] [2, 0x20] [1, 0x10]`, in reverse order; offsets and registers are correct. - The guard thunk's table ends before the tail (`test rax` / `jmp`), so an unwind from there treats it as a leaf frame, which matches the stack at that point. Note, not blocking: if an asynchronous unwind (a profiler sample, or a stack walk of a suspended thread) lands on the guard thunk's `add rsp, 0x68` / `pop` sequence, the frame is not handled right. Those instructions are inside the table, but no `ret` or recognised jump follows them, so the unwinder doesn't treat them as an epilog and applies the full prolog codes. Synchronous unwinds through the call to `decide` (the case the PR is for, and the one the test covers) are right. performance: one `RtlAddFunctionTable` per thunk at creation time and a few bytes per thunk; nothing per call. title run (fast-world harness, release builds of base and of the merged PR, each run as the same firewalled exe from its own fresh snapshot of the same warm cache): - base `fa204595`: exit 0x0, crashes 0, device removals 0, no system display events; world entry at 90.6 s, peak commit 28,620 MB, 70 WARN lines, 5 `[STUB]` lines. - PR merge `14576f83`: exit 0x0, crashes 0, device removals 0, no system display events; world entry at 123.1 s, peak commit 29,100 MB (+1.7 %), 65 WARN lines (the same kinds as base, nothing new), 5 `[STUB]` lines. - Both runs ~270 s. The cache doesn't match this main's translator identity, so both spent the world part compiling pipelines and showed no frames in the steady window: frame rate not compared. My own suites and builds for other PRs ran on the machine during the PR run, so the later world entry is not evidence against the PR. The runs show no crash, removal or new warning on the way into the world. They don't show an exception actually being unwound through a thunk. verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, DXC 1.9.2609 via XCL_DXC_DIR; title runs from release builds. Claude Code, Claude Opus 5.5: merge, build, suite, title runs and full-diff review; this report.
throny commented 2026-11-29 07:50:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T07:50:33Z.


merge-check claim
head: 9a1e18804c

<!-- greyfinch-sync:ivall/xcl:comment:7252724863 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/936#issuecomment-7252724863). Originally posted by [throny](https://github.com/throny) on 2026-11-29T07:50:33Z. --- merge-check claim head: 9a1e18804c8903c77f2de6251b855ee41e8dce57
throny commented 2026-11-29 08:09:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T08:09:33Z.


merge-check
base: fa204595
head: 9a1e18804c
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2610 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at fa204595: 2608 passed, 0 failed, 49 ignored. Every test binary ran to its end.
review: no finding. The unwind codes match the thunks' prologs (stub thunk: one stack allocation; guard thunk: the allocation and four pushes, listed in reverse order), and the registered range ends before the tail jump, so the tail unwinds as a leaf. The call tracer's bytes are unchanged. Both new tests fail without the change (as an abort of the test process, because the assert sits inside extern "system" frames). Note: the diff alone no longer applies next to main's newer make_before thunk in guard.rs, but the merge itself is clean and builds. One function table is registered per thunk and never removed, which is consistent with thunks never being freed; the lookup cost with thousands of stubs was not measured.
performance: not measured.
verdict: safe to merge
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:7252923521 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/936#issuecomment-7252923521). Originally posted by [throny](https://github.com/throny) on 2026-11-29T08:09:33Z. --- merge-check base: fa204595 head: 9a1e18804c8903c77f2de6251b855ee41e8dce57 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2610 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at fa204595: 2608 passed, 0 failed, 49 ignored. Every test binary ran to its end. review: no finding. The unwind codes match the thunks' prologs (stub thunk: one stack allocation; guard thunk: the allocation and four pushes, listed in reverse order), and the registered range ends before the tail jump, so the tail unwinds as a leaf. The call tracer's bytes are unchanged. Both new tests fail without the change (as an abort of the test process, because the assert sits inside `extern "system"` frames). Note: the diff alone no longer applies next to main's newer `make_before` thunk in guard.rs, but the merge itself is clean and builds. One function table is registered per thunk and never removed, which is consistent with thunks never being freed; the lookup cost with thousands of stubs was not measured. performance: not measured. verdict: safe to merge 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).
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!930
No description provided.