D3D12.X: register x64 .pdata unwind info for stub and guard thunks #936
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!936
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-936"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@AlpPesen on GitHub · 2026-11-24 08:44 UTC · original
AlpPesen:fix/thunk-pdata-unwind→main· +140 −51 · 2 files · 1 commits · openRegisters x64
.pdata(UNWIND_INFO+RUNTIME_FUNCTIONviaRtlAddFunctionTable) for the RWX thunks emitted bystubs::make_stub_infoandd3d12x::guard::thunk, matching whatguard::make_call_traceralready does.Without
.pdata, WindowsRtlLookupFunctionEntrytreats those thunks as leaf functions even thoughmake_stub_infoadjustsrsp(sub rsp, 0x28) andguard::thunkpushesrcx/rdx/r8/r9and allocates0x68bytes before calling into Rust. That breakseh::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: extractalloc_code_with_unwind(appends 4-byte-alignedUNWIND_INFO+RUNTIME_FUNCTION, flushes icache, callsRtlAddFunctionTable) and use it inmake_stub_info(UWOP_ALLOC_SMALLforsub rsp, 0x28); add live-stackRtlVirtualUnwindtest (stub_thunk_unwinds_through_pdata_to_its_caller).crates/xcl/src/hle/d3d12x/guard.rs: reusestubs::alloc_code_with_unwindinmake_call_tracerand register unwind info forthunk(sub rsp, 0x68+push r9/r8/rdx/rcx, ending right before the tail jump once the stack is restored to leaf state); add live-stackRtlVirtualUnwindtest (guard_thunk_unwinds_through_pdata_to_its_caller).Tested
26300), Intel Core i9-9900K, AMD Radeon RX 6800 (16337 MiB VRAM, driver32.0.21045.29003),rustc 1.100.0(x86_64-pc-windows-msvc), DXC1.9.2602.17(debugfor tests,releasefor smoke runs).XCL_REQUIRE_GPU=wave64,mesh+cargo test --workspace --no-fail-fast -- --test-threads=4on9a1e188: 715 passed, 3 failed, 41 ignored, 0 GPU skipped (xcllib: 674 passed / 3 failed / 21 ignored; integration/e2e: 41 passed / 0 failed / 20 ignored;XCL_SAMPLE_*unset).stubs::tests::stub_thunk_unwinds_through_pdata_to_its_callerandhle::d3d12x::guard::tests::guard_thunk_unwinds_through_pdata_to_its_caller) pass.placed_title_textures_share_vram_and_preserve_pixels(3D 64x64x64 4 mips: subresource 2 mismatch, failing identically on unmodifiedmainand fixed by open PR #470) plus its 2VRAM_TEST_LOCKPoisonErrorcascades (transitions_apply_when_their_list_is_submittedandd32s8_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):PR head (
9a1e18804c89):Not tested
XCL_SAMPLE_*unset).RtlCaptureContext+RtlLookupFunctionEntry+RtlVirtualUnwind).AI use
@dcastell1 on GitHub · 2026-11-24 08:56 UTC · original
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):Two more passing tests than main: the x64
.pdataunwind 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 on GitHub · 2026-11-24 10:38 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
9a1e188onto main9aec53d, 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 on GitHub · 2026-11-24 10:39 UTC · original
Code/CI review only (not independently runtime-tested by me): clean merge with both checks green (
Build and test+PR description). Cleanly registers x64.pdataunwind info for generated stub and guard thunks. Recommend merging, @ivall.@thaqiart139-alt on GitHub · 2026-11-24 22:49 UTC · original
Test report for this PR's head
9a1e188, merged intomain689f2db(no conflicts), on AMD RDNA2 with native 64-lane waves and on a 32-lane NVIDIA card.Tested
XCL_ADAPTER.cargo test --workspace --no-fail-fast -- --test-threads=4:main689f2dbmain, from #1679's new fuzz tests, and both are already reported on #1679:fuzz_validate_and_gpu_0to_3(CreateComputePipelineState:0x8007000E)fuzz_validate_and_gpu_1(seed 540: res[833] = 0x7, CPU 0x6)guard_thunk_unwinds_through_pdata_to_its_caller,stub_thunk_unwinds_through_pdata_to_its_caller.SKIPPED tests (the same on
mainand with this PR)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_gpugpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu, and the wave64 cases of itsf16/f32/f64/integer_programs_on_the_gpugpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwarelower_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)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_passeslower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused, as aboveheap_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
XCL_SAMPLE_*tests, a title run; other GPUs; Linux / Wine.AI use
@DavidM1911 on GitHub · 2026-11-25 09:17 UTC · original
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!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.