xcl run: write final report on NtTerminateProcess under Wine (#1461) #1484

Closed
github-bot wants to merge 1 commit from gh-pr/1484/head into gh-pr/1484/base
Owner

@⁠mahfuzinam0045-spec on GitHub · 2026-11-24 16:49 UTC · original
mahfuzinam0045-spec:fix/wine-report-on-terminate → main · +31 −9 · 1 files · 1 commits · closed without merging

Under Wine, an executable's TLS callbacks never receive DLL_PROCESS_DETACH (reason 0) when the process exits. Because XCL writes its final report.json inside loader::on_tls_event upon receiving DLL_PROCESS_DETACH, report.json was left in its initial pre-run state under Wine / Proton (lacking called_stubs, subsystem counters, and final exit status), as reported in #1461.

In hk_nt_terminate_process, invoke report::write_final(None) before logging and flushing when running under Wine (util::under_wine()). On native Windows, the hook continues to rely on standard TLS detach notifications, keeping native Windows execution paths unaffected.

Fixes #1461.

What is in it

  • crates/xcl/src/eh.rs: in hk_nt_terminate_process, delegate to on_nt_terminate, invoking report::write_final(None) when util::under_wine() is true.
  • crates/xcl/src/eh.rs: add unit test nt_terminate_writes_report_under_wine verifying that write_final is invoked under Wine and skipped on native Windows.

Tested

  • Windows 11 x64, Rust 1.98.1 MSVC
  • cargo test -p xcl --lib eh::tests: 7 passed, 0 failed.
  • cargo test -p xcl --lib: 708 passed, 0 failed, 21 ignored.
  • cargo test -p xcl --test console_dlls_e2e --test e2e: 16 passed, 0 failed.

Regression run

  • A retail title smoke run was not performed (no retail title dump on this system). The change is narrow and confined to final report flush under Wine in eh::hk_nt_terminate_process. Awaiting maintainer review / test-only waiver or community Wine smoke run.

Not tested

  • Physical execution under Wine / Proton (tested logic on native Windows host where under_wine() is verified by unit assertions).

AI use

  • Antigravity with Gemini 3.8 Flash investigated the issue, implemented the Wine report flush in eh.rs, wrote the unit tests, and drafted this PR.
**@⁠mahfuzinam0045-spec** on GitHub · 2026-11-24 16:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/1484) `mahfuzinam0045-spec:fix/wine-report-on-terminate` → `main` · +31 −9 · 1 files · 1 commits · closed without merging Under Wine, an executable's TLS callbacks never receive `DLL_PROCESS_DETACH` (reason 0) when the process exits. Because XCL writes its final `report.json` inside `loader::on_tls_event` upon receiving `DLL_PROCESS_DETACH`, `report.json` was left in its initial pre-run state under Wine / Proton (lacking `called_stubs`, subsystem counters, and final exit status), as reported in #1461. In `hk_nt_terminate_process`, invoke `report::write_final(None)` before logging and flushing when running under Wine (`util::under_wine()`). On native Windows, the hook continues to rely on standard TLS detach notifications, keeping native Windows execution paths unaffected. Fixes #1461. **What is in it** - `crates/xcl/src/eh.rs`: in `hk_nt_terminate_process`, delegate to `on_nt_terminate`, invoking `report::write_final(None)` when `util::under_wine()` is true. - `crates/xcl/src/eh.rs`: add unit test `nt_terminate_writes_report_under_wine` verifying that `write_final` is invoked under Wine and skipped on native Windows. **Tested** - Windows 11 x64, Rust 1.98.1 MSVC - `cargo test -p xcl --lib eh::tests`: 7 passed, 0 failed. - `cargo test -p xcl --lib`: 708 passed, 0 failed, 21 ignored. - `cargo test -p xcl --test console_dlls_e2e --test e2e`: 16 passed, 0 failed. **Regression run** - A retail title smoke run was not performed (no retail title dump on this system). The change is narrow and confined to final report flush under Wine in `eh::hk_nt_terminate_process`. Awaiting maintainer review / `test-only` waiver or community Wine smoke run. **Not tested** - Physical execution under Wine / Proton (tested logic on native Windows host where `under_wine()` is verified by unit assertions). **AI use** - Antigravity with Gemini 3.8 Flash investigated the issue, implemented the Wine report flush in `eh.rs`, wrote the unit tests, and drafted this PR.
Under Wine, an executable's TLS callbacks never receive `DLL_PROCESS_DETACH`
(reason 0) when the process terminates. Because XCL writes its final
`report.json` in `loader::on_tls_event` on `DLL_PROCESS_DETACH`, `report.json`
was left in its initial pre-run state under Wine / Proton (affecting Linux
and macOS runs, and causing `e2e.rs:164` to observe an empty `called_stubs`).

Call `report::write_final(None)` inside `hk_nt_terminate_process` when running
under Wine (`util::under_wine()`), before logging and flushing. Native Windows
continues to rely on TLS `DLL_PROCESS_DETACH`, keeping Windows behaviour
unchanged.

Fixes #1461.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:55:20 +00:00
github-bot closed this pull request 2026-11-26 04:55:20 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 16:55 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 main@b7aa9f3 (baseline 770 passed, 0 failed, 41 ignored on this box):

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

One more than the baseline; the final report written on NtTerminateProcess is exercised and green.

Tree restored afterwards (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.

**@⁠dcastell1** on GitHub · 2026-11-24 16:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1484#issuecomment-7138416948) 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 `main@b7aa9f3` (baseline **770 passed, 0 failed, 41 ignored** on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 771 passed; 0 failed; 41 ignored (exit 0) ``` One more than the baseline; the final report written on `NtTerminateProcess` is exercised and green. Tree restored afterwards (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.
Author
Owner

@⁠eizispark on GitHub · 2026-11-24 17:12 UTC · original

Hardware test report — commit 408ad5c

Verified 408ad5cd797b951e0a05117fe15aa8de1ef767e4 (based on main b7aa9f3bd212088e0d927439284dc5ed325ce3c7, clean merge with origin/main 9e3831e): pass.

Tested

  • Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), 32 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 752 passed, 0 failed, 41 ignored (GPU tests skipped on this adapter: none), including eh::tests::nt_terminate_writes_report_under_wine and both wave64 GPU tests (gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware, console_wave64_compute_through_the_pso_hook_dispatch_and_read_back)

Regression run
main (b7aa9f3bd212088e0d927439284dc5ed325ce3c7):

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1678 (PresentX 1678)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14855 MB

PR (408ad5cd797b951e0a05117fe15aa8de1ef767e4):

xcl-smoke v1
commit: 408ad5cd797b951e0a05117fe15aa8de1ef767e4
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14855 MB

Not tested

  • Wine (DLL_PROCESS_DETACH / NtTerminateProcess exit path under Wine), NVIDIA/Intel GPUs, XCL_SAMPLE_*

AI use

  • Antigravity (Google DeepMind, Gemini 4 Carbon) — ran the workspace test suite and 60 s retail smoke run on this commit and formatted the report.
**@⁠eizispark** on GitHub · 2026-11-24 17:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/1484#issuecomment-7138835604) ### Hardware test report — commit `408ad5c` Verified `408ad5cd797b951e0a05117fe15aa8de1ef767e4` (based on `main` `b7aa9f3bd212088e0d927439284dc5ed325ce3c7`, clean merge with `origin/main` `9e3831e`): **pass**. **Tested** - Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), 32 GB RAM, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, release + test profile - `cargo test --workspace --no-fail-fast -- --test-threads=4`: `752 passed, 0 failed, 41 ignored` (GPU tests skipped on this adapter: `none`), including `eh::tests::nt_terminate_writes_report_under_wine` and both wave64 GPU tests (`gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware`, `console_wave64_compute_through_the_pso_hook_dispatch_and_read_back`) **Regression run** `main` (`b7aa9f3bd212088e0d927439284dc5ed325ce3c7`): ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1678 (PresentX 1678) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14855 MB ``` PR (`408ad5cd797b951e0a05117fe15aa8de1ef767e4`): ``` xcl-smoke v1 commit: 408ad5cd797b951e0a05117fe15aa8de1ef767e4 gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1677 (PresentX 1677) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14855 MB ``` **Not tested** - Wine (`DLL_PROCESS_DETACH` / `NtTerminateProcess` exit path under Wine), NVIDIA/Intel GPUs, `XCL_SAMPLE_*` **AI use** - Antigravity (Google DeepMind, Gemini 4 Carbon) — ran the workspace test suite and 60 s retail smoke run on this commit and formatted the report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 18:53 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 18:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1484#issuecomment-7141295558) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Author
Owner

@⁠throny on GitHub · 2026-11-24 19:55 UTC · original

Two contributors checked independently and found that this PR makes the same change as #1479 (for #1461): #1607, group D8. They suggest keeping #1479. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps.

This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

**@⁠throny** on GitHub · 2026-11-24 19:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1484#issuecomment-7142779985) <!-- xcl-1607-hint:D8 --> Two contributors checked independently and found that this PR makes the same change as #1479 (for #1461): #1607, group D8. They suggest keeping #1479. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps. This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Author
Owner

@⁠ivall on GitHub · 2026-11-24 20:43 UTC · original

Closing this as a duplicate: #1479 makes the same change and was opened first (under Wine the final report is written when the process terminates). It stays open and is the one that will be reviewed and merged.

This says nothing about the quality of the code here. I compared the two diffs; the pair was also found by independent checks in #1607. If this PR covers a case #1479 does not, or #1479 is closed without being merged, say so and I'll reopen it. A test that is only here is welcome on #1479.

Thank you for the work.

AI use: Claude Code (Claude Opus 5.5) compared the diffs and wrote this comment; the decision is the maintainer's.

**@⁠ivall** on GitHub · 2026-11-24 20:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1484#issuecomment-7143964888) Closing this as a duplicate: #1479 makes the same change and was opened first (under Wine the final report is written when the process terminates). It stays open and is the one that will be reviewed and merged. This says nothing about the quality of the code here. I compared the two diffs; the pair was also found by independent checks in #1607. If this PR covers a case #1479 does not, or #1479 is closed without being merged, say so and I'll reopen it. A test that is only here is welcome on #1479. Thank you for the work. AI use: Claude Code (Claude Opus 5.5) compared the diffs and wrote this comment; the decision is the maintainer's.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.