e2e: close leaked event/COM handles and fix duplicate fence signal in testtitle #2155

Manually merged
github merged 1 commit from gh-pr/2155/head into gh-pr/2155/base 2026-11-26 05:20:54 +00:00
Owner

@⁠HumanlyDev on GitHub · 2026-11-25 06:24 UTC · original
HumanlyDev:e2e/testtitle-gpu-handle-and-signal-fixes → main · +167 −99 · 1 files · 1 commits · merged 2026-11-25 10:51 UTC

Fix Windows Event handle leaks, IDStorageFactoryX/COM/page error-path leaks, a duplicate queue.Signal(&fence, 1) in present_x_frame(), and unbalanced MFStartup ordering in tests/testtitle/src/gpu.rs. Test-title change under tests/testtitle/; no runtime files modified.

What is in it

  • tests/testtitle/src/gpu.rs:
    • Declare CloseHandle and add an EventHandle RAII guard (verifying !h.is_null() before returning and closing the handle on drop), used in wait() and direct_storage().
    • Remove the duplicate queue.Signal(&fence, 1) immediately before wait(&queue, &fence, 1) in present_x_frame(), and ensure set_interval(d, null, 0, 0, 0) runs even on error paths.
    • Add ComPtr (null-checked, calling Release on drop) and PhysPage (XMemFreePhysicalPages on drop) guards in direct_storage() so IDStorageFactoryX, q, file, status, and page are always released on both success and error paths.
    • Move let dev = device()?; before MFStartup in mfplat_reset_dxgi_device_manager() so MFStartup is not left unbalanced if device() fails.

Tested

  • Hardware & toolchain: NVIDIA GeForce RTX 4060 (32.0.16.1088), AMD Ryzen 5 7600, Windows 11 Pro 10.0.26200 (build 26200), rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.8.2502.11, debug build.
  • cargo build --workspace: succeeded with 0 errors.
  • cargo test -p xcl --test e2e -- --nocapture: 3 passed, 0 failed, 0 ignored (xcl_testtitle: done, failures: 0, exit code 0).
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4, RTX 4060, debug): 1154 passed, 0 failed, 46 ignored across 21 targets (25 SKIPPED GPU checks: 20 no wave64, 3 per-lane form #1426 refusals, 1 no heap windows, 1 cannot disable the driver cache (Windows Developer Mode is required)).

Regression run

  • Not needed: test-title change under tests/testtitle/ (no runtime files under crates/xcl/src/ modified).

Not tested

  • Simulated error-injection paths in direct_storage() / present_x_frame(), retail titles / XCL_SAMPLE_*, AMD RDNA3/4, Linux / Wine.

AI use

  • Antigravity (Google DeepMind; Gemini 4): audited tests/testtitle/src/gpu.rs, implemented the RAII handle/COM/page guards and signal/MFStartup fixes, ran the workspace tests, and drafted this PR description.
**@⁠HumanlyDev** on GitHub · 2026-11-25 06:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/2155) `HumanlyDev:e2e/testtitle-gpu-handle-and-signal-fixes` → `main` · +167 −99 · 1 files · 1 commits · merged 2026-11-25 10:51 UTC Fix Windows Event handle leaks, `IDStorageFactoryX`/COM/page error-path leaks, a duplicate `queue.Signal(&fence, 1)` in `present_x_frame()`, and unbalanced `MFStartup` ordering in `tests/testtitle/src/gpu.rs`. Test-title change under `tests/testtitle/`; no runtime files modified. **What is in it** - `tests/testtitle/src/gpu.rs`: - Declare `CloseHandle` and add an `EventHandle` RAII guard (verifying `!h.is_null()` before returning and closing the handle on drop), used in `wait()` and `direct_storage()`. - Remove the duplicate `queue.Signal(&fence, 1)` immediately before `wait(&queue, &fence, 1)` in `present_x_frame()`, and ensure `set_interval(d, null, 0, 0, 0)` runs even on error paths. - Add `ComPtr` (null-checked, calling `Release` on drop) and `PhysPage` (`XMemFreePhysicalPages` on drop) guards in `direct_storage()` so `IDStorageFactoryX`, `q`, `file`, `status`, and `page` are always released on both success and error paths. - Move `let dev = device()?;` before `MFStartup` in `mfplat_reset_dxgi_device_manager()` so `MFStartup` is not left unbalanced if `device()` fails. **Tested** - Hardware & toolchain: NVIDIA GeForce RTX 4060 (`32.0.16.1088`), AMD Ryzen 5 7600, Windows 11 Pro `10.0.26200` (build `26200`), `rustc 1.100.0 (0ef1bc386 2026-11-09)`, DXC `1.8.2502.11`, debug build. - `cargo build --workspace`: succeeded with 0 errors. - `cargo test -p xcl --test e2e -- --nocapture`: 3 passed, 0 failed, 0 ignored (`xcl_testtitle: done, failures: 0`, exit code `0`). - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`, RTX 4060, debug): 1154 passed, 0 failed, 46 ignored across 21 targets (25 SKIPPED GPU checks: 20 `no wave64`, 3 `per-lane form` `#1426` refusals, 1 `no heap windows`, 1 `cannot disable the driver cache (Windows Developer Mode is required)`). **Regression run** - Not needed: test-title change under `tests/testtitle/` (no runtime files under `crates/xcl/src/` modified). **Not tested** - Simulated error-injection paths in `direct_storage()` / `present_x_frame()`, retail titles / `XCL_SAMPLE_*`, AMD RDNA3/4, Linux / Wine. **AI use** - Antigravity (Google DeepMind; Gemini 4): audited `tests/testtitle/src/gpu.rs`, implemented the RAII handle/COM/page guards and signal/MFStartup fixes, ran the workspace tests, and drafted this PR description.
Add RAII guards in testtitle's gpu checks (EventHandle for CreateEventW/CloseHandle in wait() and direct_storage(), ComPtr and PhysPage in direct_storage()) so event handles, DirectStorage COM objects, and physical pages are always released on both success and error paths.

Also remove the duplicate queue.Signal(&fence, 1) call before wait() in present_x_frame(), ensure SetFrameIntervalX(..., 0, 0, 0) runs on error paths, and obtain the device before MFStartup in mfplat_reset_dxgi_device_manager().

Assisted-by: Antigravity (Gemini 4)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:20:52 +00:00
github manually merged commit 77bb02d59e into gh-pr/2155/base 2026-11-26 05:20:54 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 07:04 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!

**@⁠DavidM1911** on GitHub · 2026-11-25 07:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/2155#issuecomment-7155466089) 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!
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 07:05 UTC · original

Independent Windows x64 + Intel Arc A770 test report on commit 77bb02d59e5a80bc26bdafc4420013045432a88e.

Environment

  • OS: Windows 11 Enterprise Evaluation x64 (build 26200.9974, Session 0, no audio device, no d3d12SDKLayers.dll)
  • CPU: AMD Ryzen 7 3800X
  • GPU: Intel Arc A770 16 GiB (driver 32.0.101.9175, Tiled Resources Tier 4, Resource Heap Tier 1, DoublePrecisionFloatShaderOps=0)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) (debug build), DXC 1.9.2609.5 (01b62ad47)

Command
Executed under serialized Arc A770 GPU mutex (XCL_ADAPTER=A770) with pre/in/post-mutex executable SHA-256 verified (7EB9A5E13EB3D853825046956E7346BC81E68868B3B4405FDA6E185E8DC10A32):

e2e-7bb743f5cbebecc5.exe test_title_ --nocapture --test-threads=1

Results

  • Exercised passed: 0, Failed: 1, Ignored: 0, Skipped: 1 (libtest reported 1 passed; 1 failed; 0 ignored, exit code 101, 1.98s)
  • test_title_draws_with_a_root_signature_under_the_debug_layer: SKIPPED (no d3d12SDKLayers.dll; not counted as coverage)
  • test_title_runs_and_game_folder_is_untouched: FAILED at crates\xcl\tests\e2e.rs:132:5 with [FAIL] D3D12.X: dynamic depth bias via RSSetDepthBiasX (#94): top-right [0, 0, 255, 255] (expected green: RSSetDepthBiasX(-1000.5) passes depth test) (Arc A770 reported ID3D12GraphicsCommandList9::RSSetDepthBias supported). No origin/main baseline comparison was run in this check, so this Arc depth-bias failure may be pre-existing.

Not tested

  • D3D12 debug-layer e2e test (host lacks d3d12SDKLayers.dll), origin/main baseline e2e comparison, full workspace suite, and game smoke run.

AI use

  • Verified and published with T3 Code / Antigravity (gemini-4-neon).
**@⁠JJAutoCompare** on GitHub · 2026-11-25 07:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/2155#issuecomment-7155472931) Independent Windows x64 + Intel Arc A770 test report on commit `77bb02d59e5a80bc26bdafc4420013045432a88e`. **Environment** - OS: Windows 11 Enterprise Evaluation x64 (build 26200.9974, Session 0, no audio device, no `d3d12SDKLayers.dll`) - CPU: AMD Ryzen 7 3800X - GPU: Intel Arc A770 16 GiB (driver `32.0.101.9175`, Tiled Resources Tier 4, Resource Heap Tier 1, `DoublePrecisionFloatShaderOps=0`) - Toolchain: `rustc 1.100.0 (0ef1bc386 2026-11-09)` (debug build), DXC `1.9.2609.5 (01b62ad47)` **Command** Executed under serialized Arc A770 GPU mutex (`XCL_ADAPTER=A770`) with pre/in/post-mutex executable SHA-256 verified (`7EB9A5E13EB3D853825046956E7346BC81E68868B3B4405FDA6E185E8DC10A32`): ```powershell e2e-7bb743f5cbebecc5.exe test_title_ --nocapture --test-threads=1 ``` **Results** - Exercised passed: 0, Failed: 1, Ignored: 0, Skipped: 1 (libtest reported `1 passed; 1 failed; 0 ignored`, exit code 101, 1.98s) - `test_title_draws_with_a_root_signature_under_the_debug_layer`: **SKIPPED** (`no d3d12SDKLayers.dll`; not counted as coverage) - `test_title_runs_and_game_folder_is_untouched`: **FAILED** at `crates\xcl\tests\e2e.rs:132:5` with `[FAIL] D3D12.X: dynamic depth bias via RSSetDepthBiasX (#94): top-right [0, 0, 255, 255] (expected green: RSSetDepthBiasX(-1000.5) passes depth test)` (Arc A770 reported `ID3D12GraphicsCommandList9::RSSetDepthBias` supported). No `origin/main` baseline comparison was run in this check, so this Arc depth-bias failure may be pre-existing. **Not tested** - D3D12 debug-layer e2e test (host lacks `d3d12SDKLayers.dll`), `origin/main` baseline e2e comparison, full workspace suite, and game smoke run. **AI use** - Verified and published with T3 Code / Antigravity (`gemini-4-neon`).
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 07:03 UTC · original · edited 2026-11-25 07:13 UTC

Full-suite run, since this PR has no test report yet. Tested exact head 77bb02d (on its base 6ea813a).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1142 passed, 0 failed, 44 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_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, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • No new #[test] functions in the diff.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1153 passed, 0 failed, 46 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 568e7db too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-25 07:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/2155#issuecomment-7155442305) · edited 2026-11-25 07:13 UTC Full-suite run, since this PR has no test report yet. Tested exact head `77bb02d` (on its base `6ea813a`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests`: **1142 passed, 0 failed, 44 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_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`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - No new `#[test]` functions in the diff. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **1153 passed, 0 failed, 46 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `--skip` leaves out tests that fail on main `568e7db` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651), the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests, `const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` and `mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu` ([follow-up on #1651](https://git.gtahub.st/github/xcl-dev--xcl/issues/1651)) fail because `runner::skip_test` turns their skips into failures under `XCL_REQUIRE_GPU=mesh`, and `gpu::dxil::fuzz_tests` seeds 70, 545, 1019 and 1507 fail `CreateComputePipelineState` with `E_OUTOFMEMORY` on this card (drivers 616.64 and 621.40). On AMD: `fuzz_validate_and_gpu_1` fails on seed 540 (`res[833]` 0x7 vs CPU 0x6). The AMD run does not set `XCL_REQUIRE_GPU`. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
This discussion has been locked. Commenting is limited to contributors.
No description provided.