XGameRuntime: forward every IID of a forwarding class through its own clone (#2399) #2613

Open
kotekompotek wants to merge 1 commit from upstream-pr/2623 into main
kotekompotek commented 2026-11-26 02:54:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by kotekompotek on 2026-11-26T02:54:03Z.


QueryApiImpl filled a forwarding class's shared Obj.pc from a load-then-store pair: two concurrent queries for the same class could both call pc_object and leak the loser's COM reference (a per-IID clone would take the alias-map lock instead). The same shared Obj is also what layout() builds when a class's iids merge several interface versions: a PC object cached for one version's IID can be reused for another's, and forward() then indexes the PC vtable past its end. Both holes close by routing every IID of a forwarding class through forward_alias_obj, which already makes a per-IID clone under the alias-map lock – the shared Obj keeps pc empty. No forwarding class in today's gdk_table merges IIDs, so the vtable over-read is latent; the refcount race is reachable on XGameUi alone. Fixes #2399.

What is in it

  • QueryApiImpl: !o.iface.forward.is_empty() → forward_alias_obj(o, c, i) unconditionally (crates/xcl/src/hle/xgameruntime/api.rs).
  • a_forwarding_class_answers_with_a_per_iid_clone: queries XGameUi for a known IID, asserts the title gets a clone (not the shared Obj), that the shared Obj.pc stays empty, and that a repeat query returns the same clone. Fails on the old dispatch ("the title must not get the shared Obj").

Tested

  • NVIDIA GeForce GTX 1050 (driver 32.0.15.8129, 32-lane waves only), AMD Ryzen 5 3600, Windows 11, Rust 1.91.0; debug build for the tests, release for the smoke runs
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1421 passed, 3 failed, 46 ignored (the lib was rerun alone after parallel release builds flaked 8 timing-sensitive tests; cargo test -p xcl --lib: 1296 passed, 3 failed, 26 ignored)
  • SKIPPED: 355 (no mesh shader / wave64 / SM 6.6 on this adapter)
  • This PR's new test in the workspace run:
    • a_forwarding_class_answers_with_a_per_iid_clone: ok
  • The 3 failures are environmental (driver HRESULT/0x80070057, no SM 6.6 PSOs) and reproduce identically on main; details below.

Regression run (0 s, default settings, a retail title)

main:

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce GTX 1050
title: 9cc6a39e
seconds: 0
exit: 0x0
frames shown: 0 (PresentX 0)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 903 MB

this PR:

xcl-smoke v1
commit: 41e715e5d39fc51ecd0c2227efbf232b67686294
gpu: NVIDIA GeForce GTX 1050
title: 9cc6a39e
seconds: 0
exit: 0x0
frames shown: 0 (PresentX 0)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 897 MB

Not tested

  • hle::d3d12x::vram::tests::gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark, shaders::pipeline_cap_tests::stale_blob_cannot_bypass_the_offline_pipeline_cap, shaders::pipeline_cap_tests::split_compute_program_prebuilds_and_caches_chain_pieces: fail on main identically (GTX 1050 is SM 6.5 max; driver answers 0x80070057).
  • Anything needing SM 6.6, wave64, or mesh shaders: skipped on this adapter.
  • The GTA6 title used for the smoke blocks crashes ~2–12 s into its own early init on this hardware (breakpad catch, not an XCL removal), so only -Seconds 0 produces a clean run; frames shown is 0 in both blocks.

AI use

  • Devin (SWE-2 High) verified the issue claims against the code, wrote the fix and the test, ran the suite and the smoke runs, and opened the PR.
<!-- greyfinch-sync:ivall/xcl:issue:5503130816 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T02:54:03Z. --- `QueryApiImpl` filled a forwarding class's shared `Obj.pc` from a load-then-store pair: two concurrent queries for the same class could both call `pc_object` and leak the loser's COM reference (a per-IID clone would take the alias-map lock instead). The same shared `Obj` is also what `layout()` builds when a class's `iids` merge several interface versions: a PC object cached for one version's IID can be reused for another's, and `forward()` then indexes the PC vtable past its end. Both holes close by routing every IID of a forwarding class through `forward_alias_obj`, which already makes a per-IID clone under the alias-map lock – the shared `Obj` keeps `pc` empty. No forwarding class in today's `gdk_table` merges IIDs, so the vtable over-read is latent; the refcount race is reachable on `XGameUi` alone. Fixes #2399. **What is in it** - `QueryApiImpl`: `!o.iface.forward.is_empty()` → `forward_alias_obj(o, c, i)` unconditionally (`crates/xcl/src/hle/xgameruntime/api.rs`). - `a_forwarding_class_answers_with_a_per_iid_clone`: queries `XGameUi` for a known IID, asserts the title gets a clone (not the shared `Obj`), that the shared `Obj.pc` stays empty, and that a repeat query returns the same clone. Fails on the old dispatch ("the title must not get the shared Obj"). **Tested** - NVIDIA GeForce GTX 1050 (driver 32.0.15.8129, 32-lane waves only), AMD Ryzen 5 3600, Windows 11, Rust 1.91.0; debug build for the tests, release for the smoke runs - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1421 passed, 3 failed, 46 ignored (the lib was rerun alone after parallel release builds flaked 8 timing-sensitive tests; `cargo test -p xcl --lib`: 1296 passed, 3 failed, 26 ignored) - SKIPPED: 355 (no mesh shader / wave64 / SM 6.6 on this adapter) - This PR's new test in the workspace run: - `a_forwarding_class_answers_with_a_per_iid_clone`: ok - The 3 failures are environmental (driver `HRESULT`/`0x80070057`, no SM 6.6 PSOs) and reproduce identically on `main`; details below. **Regression run** (0 s, default settings, a retail title) main: ``` xcl-smoke v1 commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea gpu: NVIDIA GeForce GTX 1050 title: 9cc6a39e seconds: 0 exit: 0x0 frames shown: 0 (PresentX 0) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 903 MB ``` this PR: ``` xcl-smoke v1 commit: 41e715e5d39fc51ecd0c2227efbf232b67686294 gpu: NVIDIA GeForce GTX 1050 title: 9cc6a39e seconds: 0 exit: 0x0 frames shown: 0 (PresentX 0) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 897 MB ``` **Not tested** - `hle::d3d12x::vram::tests::gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark`, `shaders::pipeline_cap_tests::stale_blob_cannot_bypass_the_offline_pipeline_cap`, `shaders::pipeline_cap_tests::split_compute_program_prebuilds_and_caches_chain_pieces`: fail on `main` identically (GTX 1050 is SM 6.5 max; driver answers `0x80070057`). - Anything needing SM 6.6, wave64, or mesh shaders: skipped on this adapter. - The GTA6 title used for the smoke blocks crashes ~2–12 s into its own early init on this hardware (breakpad catch, not an XCL removal), so only `-Seconds 0` produces a clean run; frames shown is 0 in both blocks. **AI use** - Devin (SWE-2 High) verified the issue claims against the code, wrote the fix and the test, ran the suite and the smoke runs, and opened the PR.
DarkPanda69 commented 2026-11-26 03:06:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-26T03:05:33Z.


The three GPU tests listed as not tested (they fail on the GTX 1050, which has SM 6.5 at most) pass with this PR on two SM 6.6 cards, an RX 9070 XT and an RTX 3060. The new test passes too.

Head 41e715e applied on main b49be18, debug, Windows 11 Pro 26200, card chosen with XCL_ADAPTER, each run with --nocapture:

cargo test -p xcl --lib -- <filter> RX 9070 XT (RDNA4, 32.0.32029.2010) RTX 3060 (32.0.16.1088)
gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark ok, no SKIPPED ok, no SKIPPED
pipeline_cap_tests (stale_blob_cannot_bypass_the_offline_pipeline_cap, split_compute_program_prebuilds_and_caches_chain_pieces and the cap test) 3 passed, no SKIPPED 3 passed, no SKIPPED
a_forwarding_class_answers_with_a_per_iid_clone ok
xgameruntime 76 passed, 0 failed

Not tested: the whole suite with this PR, a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7181387751 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#issuecomment-7181387751). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-26T03:05:33Z. --- The three GPU tests listed as not tested (they fail on the GTX 1050, which has SM 6.5 at most) pass with this PR on two SM 6.6 cards, an RX 9070 XT and an RTX 3060. The new test passes too. Head `41e715e` applied on `main` `b49be18`, debug, Windows 11 Pro 26200, card chosen with `XCL_ADAPTER`, each run with `--nocapture`: | `cargo test -p xcl --lib -- <filter>` | RX 9070 XT (RDNA4, 32.0.32029.2010) | RTX 3060 (32.0.16.1088) | |---|---|---| | `gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark` | ok, no SKIPPED | ok, no SKIPPED | | `pipeline_cap_tests` (`stale_blob_cannot_bypass_the_offline_pipeline_cap`, `split_compute_program_prebuilds_and_caches_chain_pieces` and the cap test) | 3 passed, no SKIPPED | 3 passed, no SKIPPED | | `a_forwarding_class_answers_with_a_per_iid_clone` | ok | | | `xgameruntime` | 76 passed, 0 failed | | Not tested: the whole suite with this PR, a title. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
oni-swr commented 2026-11-26 04:07:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-26T03:31:58Z.


Test report: AMD RX 7800 XT, exact head 41e715e5d39fc51ecd0c2227efbf232b67686294, with its exact parent e1d84b7d9153f86a97d2ec5d209d196046fc0bea as control. Both were clean detached checkouts (no uncommitted changes), not merged with current main (b49be18).

Hardware / setup

  • AMD Radeon RX 7800 XT (RDNA3), driver 32.0.31035.1003. Windows 11 Pro 10.0.26200, Rust 1.100.0, debug builds, XCL_NETWORK=0, cargo -j 4, a separate CARGO_TARGET_DIR. The logs show Compiling xcl from the checkout for each commit. No XCL_SAMPLE_* variables set (game-data tests do nothing).

Tested

  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 (37 test binaries):
    • head 41e715e: 1423 passed, 1 failed, 46 ignored
    • parent e1d84b7: 1422 passed, 1 failed, 46 ignored
    • On both, the only failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722: res[30] = 0x1, CPU 0x7fffffff, the known #2115). It also fails alone (cargo test -p xcl --lib gpu::dxil::fuzz_tests: 4 passed, 1 failed, 2 ignored) on both commits, so it is not from this PR.
    • SKIPPED (7, the same on both): the 6 f16/f32 per-lane forms of f16_programs_on_the_gpu / f32_programs_on_the_gpu (refused, #1426), and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
    • The +1 passed on the head is the new test, hle::xgameruntime::api::tests::a_forwarding_class_answers_with_a_per_iid_clone: ok on the head, not present on the parent.
  • cargo test -p xcl --lib hle::xgameruntime -- --test-threads=4: head 76 passed, 0 failed; parent 75 passed, 0 failed.
  • The three tests listed under "Not tested" in the description (they fail on the GTX 1050) are ok, not skipped, on this card in the workspace run, on both head and parent: hle::d3d12x::vram::tests::gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark, and shaders::pipeline_cap_tests::stale_blob_cannot_bypass_the_offline_pipeline_cap and ::split_compute_program_prebuilds_and_caches_chain_pieces.

Causal control for the new test (local only, not proposed for the PR)
On a head checkout, I put the parent's dispatch back in QueryApiImpl (the block that, for a known IID, does a load-then-store on pc and returns the shared Obj, and calls forward_alias_obj otherwise) and kept the PR's test. cargo test -p xcl --lib hle::xgameruntime: 75 passed, 1 failed. The failing test is a_forwarding_class_answers_with_a_per_iid_clone, with the title must not get the shared Obj. With the PR's one-line change restored (the clean head), it passes. So the test is red without the fix and green with it. The working tree was restored (git status clean).

Not tested

  • scripts/smoke.ps1 / any retail title, so no regression run is given here. Other AMD generations (RDNA2/4) and the concurrent-query refcount race itself: the test checks which object the title gets, not the race.
  • No review verdict on the change.

AI use: Claude Code (Claude Sonnet 5.5), coordinated by Codex (gpt-6.2-sol), ran these tests and wrote this report. The results come from the runs above on this machine.

<!-- greyfinch-sync:ivall/xcl:comment:7181801169 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#issuecomment-7181801169). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-26T03:31:58Z. --- **Test report: AMD RX 7800 XT, exact head `41e715e5d39fc51ecd0c2227efbf232b67686294`**, with its exact parent `e1d84b7d9153f86a97d2ec5d209d196046fc0bea` as control. Both were clean detached checkouts (no uncommitted changes), not merged with current `main` (`b49be18`). **Hardware / setup** - AMD Radeon RX 7800 XT (RDNA3), driver 32.0.31035.1003. Windows 11 Pro 10.0.26200, Rust 1.100.0, debug builds, `XCL_NETWORK=0`, `cargo -j 4`, a separate `CARGO_TARGET_DIR`. The logs show `Compiling xcl` from the checkout for each commit. No `XCL_SAMPLE_*` variables set (game-data tests do nothing). **Tested** - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4` (37 test binaries): - head `41e715e`: **1423 passed, 1 failed, 46 ignored** - parent `e1d84b7`: **1422 passed, 1 failed, 46 ignored** - On both, the only failure is `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` (`seed 722: res[30] = 0x1, CPU 0x7fffffff`, the known #2115). It also fails alone (`cargo test -p xcl --lib gpu::dxil::fuzz_tests`: 4 passed, 1 failed, 2 ignored) on both commits, so it is not from this PR. - SKIPPED (7, the same on both): the 6 f16/f32 per-lane forms of `f16_programs_on_the_gpu` / `f32_programs_on_the_gpu` (refused, #1426), and `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - The +1 passed on the head is the new test, `hle::xgameruntime::api::tests::a_forwarding_class_answers_with_a_per_iid_clone`: ok on the head, not present on the parent. - `cargo test -p xcl --lib hle::xgameruntime -- --test-threads=4`: head 76 passed, 0 failed; parent 75 passed, 0 failed. - The three tests listed under "Not tested" in the description (they fail on the GTX 1050) are `ok`, not skipped, on this card in the workspace run, on both head and parent: `hle::d3d12x::vram::tests::gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark`, and `shaders::pipeline_cap_tests::stale_blob_cannot_bypass_the_offline_pipeline_cap` and `::split_compute_program_prebuilds_and_caches_chain_pieces`. **Causal control for the new test** (local only, not proposed for the PR) On a head checkout, I put the parent's dispatch back in `QueryApiImpl` (the block that, for a known IID, does a load-then-store on `pc` and returns the shared `Obj`, and calls `forward_alias_obj` otherwise) and kept the PR's test. `cargo test -p xcl --lib hle::xgameruntime`: **75 passed, 1 failed**. The failing test is `a_forwarding_class_answers_with_a_per_iid_clone`, with `the title must not get the shared Obj`. With the PR's one-line change restored (the clean head), it passes. So the test is red without the fix and green with it. The working tree was restored (`git status` clean). **Not tested** - `scripts/smoke.ps1` / any retail title, so no regression run is given here. Other AMD generations (RDNA2/4) and the concurrent-query refcount race itself: the test checks which object the title gets, not the race. - No review verdict on the change. **AI use:** Claude Code (Claude Sonnet 5.5), coordinated by Codex (gpt-6.2-sol), ran these tests and wrote this report. The results come from the runs above on this machine.
luckyteagirl commented 2026-11-26 05:30:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:30:11Z.

Review: COMMENTED


Could the cache-hit path retry the PC query while a forwarding clone's pc is zero? The first pc_object(&c, &i) can fail temporarily, but forward_alias_obj inserts that clone with pc=0 and every later query returns it without trying the PC runtime again. The known-IID path on main retried on the next query, so a transient initialization failure now leaves that IID using the fallback stub indefinitely. The existing map lock could serialize a retry while preserving the clone's pointer identity. A fixture where PC lookup returns None once and a valid object next would cover recovery. Source review only at head 41e715e5; I did not reproduce a live runtime failure. AI-assisted with Codex (GPT-6.2 Sol).

<!-- greyfinch-sync:ivall/xcl:review:6068997712 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#pullrequestreview-6068997712). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:30:11Z. **Review:** COMMENTED --- Could the cache-hit path retry the PC query while a forwarding clone's `pc` is zero? The first `pc_object(&c, &i)` can fail temporarily, but `forward_alias_obj` inserts that clone with `pc=0` and every later query returns it without trying the PC runtime again. The known-IID path on main retried on the next query, so a transient initialization failure now leaves that IID using the fallback stub indefinitely. The existing map lock could serialize a retry while preserving the clone's pointer identity. A fixture where PC lookup returns `None` once and a valid object next would cover recovery. Source review only at head `41e715e5`; I did not reproduce a live runtime failure. AI-assisted with Codex (GPT-6.2 Sol).
DavidM1911 commented 2026-11-26 09:07:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T08:29:27Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7186656827 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#issuecomment-7186656827). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T08:29:27Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
saintwolf commented 2026-11-30 17:58:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T17:58:32Z.


merge-check claim
head: 41e715e5d3

<!-- greyfinch-sync:ivall/xcl:comment:7287126023 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#issuecomment-7287126023). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T17:58:32Z. --- merge-check claim head: 41e715e5d39fc51ecd0c2227efbf232b67686294
saintwolf commented 2026-11-30 18:05:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T18:05:13Z.


merge-check
base: 9dfbe3ea66
head: 41e715e5d3
merge: clean (trial merge daa03b2b1a3962c9eb12c3b271865cab9d20d081; git diff --check clean; +17/-8 in crates/xcl/src/hle/xgameruntime/api.rs)
build: cargo build --workspace -> ok (pre-existing warnings only, none from the PR's lines)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored (base + 1 new test); SKIPPED: 27, the standard set for this card (22 "no wave64" — wave32-only GPU, 2 "no heap windows", 1 "cannot disable the driver cache (Developer Mode)", 2 "no xgameruntime.dll"). Failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 — pre-existing on this machine, identical on base 9dfbe3ea. The new a_forwarding_class_answers_with_a_per_iid_clone passes in the targeted xgameruntime run (83/0) and inside the full suite.
review: read the whole diff and the surrounding code. For a forwarding class (XGameUi is the one in today's table: no XCL impls, all 15 slots forwarded to the PC runtime), QueryApiImpl previously gave the shared Obj to known IIDs after a lazy load-then-store of its pc field. That had two holes, both fixed by routing every IID through the existing forward_alias_obj per-IID clone path: (1) two concurrent queries for the same class could both call pc_object and leak the loser's COM reference — reachable on XGameUi alone; (2) a PC object created for one interface version (a shorter PC vtable) cached in the shared Obj could be reused for another IID of the same class, and forward() would then index the PC vtable past its end — latent, since no forwarding class in today's gdk_table merges interface IIDs. I checked the clone path itself (pre-existing, previously only reached for unknown IIDs): the clone is created under the ALIASES mutex with its own pc set synchronously via pc_object(&c, &i) before it is published to the cache, so there is no load-then-store left; it is cached per (clsid, iid), so a repeat query returns the same clone, and clones are immortal like all XCL objects (add_ref always 1). For a single-IID query the clone's pc is exactly the pc_object(&c, &i) value the old code would have stored on the shared Obj, so behavior only diverges when IIDs of the class are mixed — where the old code could hand the title a PC vtable of the wrong version. The shared Obj now keeps pc = 0 and is no longer handed to the title; a QI on a clone only returns the clone (iids = vec![i], main: false), and a QI for another known IID of the class from a clone answers E_NOINTERFACE, the same behavior the alias path already had. The test queries XGameUi with a known IID and asserts the title gets the clone, not the shared Obj (the assertion that fails on the old dispatch), that the shared Obj.pc stays empty, and that a repeat query returns the same clone; the IID is the same one an existing test at api.rs:1585 already uses for its FORWARDS-shim assertion, which is unaffected because the clone's vtable is built identically. Thread: the author's GTX 1050 full suite (1421/3/46, the 3 environmental failures reproducing identically on main) with a paired 0 s retail xcl-smoke (both clean, 0 crashes — the title crashes in its own early init on that card, so 0 s is the cleanest run there); DarkPanda69 at head on main b49be18 with an RX 9070 XT and an RTX 3060: the three "not tested" SM 6.6 GPU tests from the description pass on both cards and the xgameruntime lib run is 76/0; oni-swr on an RX 7800 XT with a head-vs-parent control (1423/1/46 vs 1422/1/46, the only failure on both the known #2115 fuzz_validate_and_gpu_1; xgameruntime 76 vs 75) and a causal control — parent's dispatch plus this test fails with "the title must not get the shared Obj", the PR's dispatch passes; DavidM1911's RTX 3060 Ti re-verification at the new head merged with current main: cargo test -p xcl --lib all passed, 27 ignored. Overlap note: #1610 (rank 32, already full, in #1607 groups D47/D57) patches the same hunk with a narrower condition (share o.pc only when i is the exact single table IID) plus IUnknown/sibling QI rework; #2623 is in no duplicate group. If both merge they conflict textually in that hunk — #1610 would likely land first and this one would need a rebase, whose remaining value is removing the load-then-store race that #1610's condition still leaves for same-IID concurrent queries. One file, no new dependencies, no stop-criteria files; the only unsafe in the diff is the test's usual query() call.
performance: none; one cached clone per (class, IID) queried — the same allocation the unknown-IID path already made — and the shared Obj no longer does a lazy pc init.
verdict: safe to merge
hardware / tool and model: RTX 4070 SUPER (driver 32.0.16.2140), Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 / OpenCode, Qwen 3.8 27B

<!-- greyfinch-sync:ivall/xcl:comment:7287325917 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#issuecomment-7287325917). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T18:05:13Z. --- merge-check base: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b head: 41e715e5d39fc51ecd0c2227efbf232b67686294 merge: clean (trial merge daa03b2b1a3962c9eb12c3b271865cab9d20d081; git diff --check clean; +17/-8 in crates/xcl/src/hle/xgameruntime/api.rs) build: cargo build --workspace -> ok (pre-existing warnings only, none from the PR's lines) tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored (base + 1 new test); SKIPPED: 27, the standard set for this card (22 "no wave64" — wave32-only GPU, 2 "no heap windows", 1 "cannot disable the driver cache (Developer Mode)", 2 "no xgameruntime.dll"). Failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 — pre-existing on this machine, identical on base 9dfbe3ea. The new a_forwarding_class_answers_with_a_per_iid_clone passes in the targeted xgameruntime run (83/0) and inside the full suite. review: read the whole diff and the surrounding code. For a forwarding class (XGameUi is the one in today's table: no XCL impls, all 15 slots forwarded to the PC runtime), QueryApiImpl previously gave the shared Obj to known IIDs after a lazy load-then-store of its pc field. That had two holes, both fixed by routing every IID through the existing forward_alias_obj per-IID clone path: (1) two concurrent queries for the same class could both call pc_object and leak the loser's COM reference — reachable on XGameUi alone; (2) a PC object created for one interface version (a shorter PC vtable) cached in the shared Obj could be reused for another IID of the same class, and forward() would then index the PC vtable past its end — latent, since no forwarding class in today's gdk_table merges interface IIDs. I checked the clone path itself (pre-existing, previously only reached for unknown IIDs): the clone is created under the ALIASES mutex with its own pc set synchronously via pc_object(&c, &i) before it is published to the cache, so there is no load-then-store left; it is cached per (clsid, iid), so a repeat query returns the same clone, and clones are immortal like all XCL objects (add_ref always 1). For a single-IID query the clone's pc is exactly the pc_object(&c, &i) value the old code would have stored on the shared Obj, so behavior only diverges when IIDs of the class are mixed — where the old code could hand the title a PC vtable of the wrong version. The shared Obj now keeps pc = 0 and is no longer handed to the title; a QI on a clone only returns the clone (iids = vec![i], main: false), and a QI for another known IID of the class from a clone answers E_NOINTERFACE, the same behavior the alias path already had. The test queries XGameUi with a known IID and asserts the title gets the clone, not the shared Obj (the assertion that fails on the old dispatch), that the shared Obj.pc stays empty, and that a repeat query returns the same clone; the IID is the same one an existing test at api.rs:1585 already uses for its FORWARDS-shim assertion, which is unaffected because the clone's vtable is built identically. Thread: the author's GTX 1050 full suite (1421/3/46, the 3 environmental failures reproducing identically on main) with a paired 0 s retail xcl-smoke (both clean, 0 crashes — the title crashes in its own early init on that card, so 0 s is the cleanest run there); DarkPanda69 at head on main b49be18 with an RX 9070 XT and an RTX 3060: the three "not tested" SM 6.6 GPU tests from the description pass on both cards and the xgameruntime lib run is 76/0; oni-swr on an RX 7800 XT with a head-vs-parent control (1423/1/46 vs 1422/1/46, the only failure on both the known #2115 fuzz_validate_and_gpu_1; xgameruntime 76 vs 75) and a causal control — parent's dispatch plus this test fails with "the title must not get the shared Obj", the PR's dispatch passes; DavidM1911's RTX 3060 Ti re-verification at the new head merged with current main: cargo test -p xcl --lib all passed, 27 ignored. Overlap note: #1610 (rank 32, already full, in #1607 groups D47/D57) patches the same hunk with a narrower condition (share o.pc only when i is the exact single table IID) plus IUnknown/sibling QI rework; #2623 is in no duplicate group. If both merge they conflict textually in that hunk — #1610 would likely land first and this one would need a rebase, whose remaining value is removing the load-then-store race that #1610's condition still leaves for same-IID concurrent queries. One file, no new dependencies, no stop-criteria files; the only unsafe in the diff is the test's usual query() call. performance: none; one cached clone per (class, IID) queried — the same allocation the unknown-IID path already made — and the shared Obj no longer does a lazy pc init. verdict: safe to merge hardware / tool and model: RTX 4070 SUPER (driver 32.0.16.2140), Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 / OpenCode, Qwen 3.8 27B
coolpersonnn commented 2026-11-30 18:41:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T18:41:43Z.


merge-check claim
head: 41e715e5d3

<!-- greyfinch-sync:ivall/xcl:comment:7288229018 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#issuecomment-7288229018). Originally posted by [coolpersonnn](https://github.com/coolpersonnn) on 2026-11-30T18:41:43Z. --- merge-check claim head: 41e715e5d39fc51ecd0c2227efbf232b67686294
coolpersonnn commented 2026-11-30 18:46:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T18:46:52Z.


merge-check
base: abec7ce9ee
head: 41e715e5d3
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2887 passed, 0 failed, 51 ignored (25 SKIPPED: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache); failing: none; new test hle::xgameruntime::api::tests::a_forwarding_class_answers_with_a_per_iid_clone passed
review: none. Read the full diff (+17/-8 in crates/xcl/src/hle/xgameruntime/api.rs). In QueryApiImpl, routing all IIDs of a forwarding class through forward_alias_obj(o, c, i) removes the unsynchronized o.pc load-then-store race on the shared Obj and isolates each (CLSID, IID) pair's PC object under ALIASES's mutex (#2399). The new unit test verifies that querying XGAMEUI with its known IID returns a per-IID clone distinct from the shared Obj, leaves main.pc at 0, and returns the same clone on repeat queries (would fail before the fix). Note: open PR #1610 touches the same QueryApiImpl branch (alongside IUnknown/sibling QI) with a narrower guard that still retains the o.pc load-then-store path for single-IID classes; not a strict duplicate, though whichever merges second will need a rebase. No other duplicates found in open/merged PRs or #1607.
performance: none (one mutex lookup in a tiny BTreeMap per QueryApiImpl call on forwarding classes; one cached clone per distinct (CLSID, IID))
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.2101), AMD Ryzen 9 9950X3D, Windows 11 Pro build 26300, Rust 1.100.0 / T3 Code (Antigravity), Gemini 4 Neon (Medium)

<!-- greyfinch-sync:ivall/xcl:comment:7288353090 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#issuecomment-7288353090). Originally posted by [coolpersonnn](https://github.com/coolpersonnn) on 2026-11-30T18:46:52Z. --- merge-check base: abec7ce9ee2f25efe8c089ca4128ddf171c37afa head: 41e715e5d39fc51ecd0c2227efbf232b67686294 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2887 passed, 0 failed, 51 ignored (25 SKIPPED: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache); failing: none; new test hle::xgameruntime::api::tests::a_forwarding_class_answers_with_a_per_iid_clone passed review: none. Read the full diff (+17/-8 in crates/xcl/src/hle/xgameruntime/api.rs). In QueryApiImpl, routing all IIDs of a forwarding class through forward_alias_obj(o, c, i) removes the unsynchronized o.pc load-then-store race on the shared Obj and isolates each (CLSID, IID) pair's PC object under ALIASES's mutex (#2399). The new unit test verifies that querying XGAMEUI with its known IID returns a per-IID clone distinct from the shared Obj, leaves main.pc at 0, and returns the same clone on repeat queries (would fail before the fix). Note: open PR #1610 touches the same QueryApiImpl branch (alongside IUnknown/sibling QI) with a narrower guard that still retains the o.pc load-then-store path for single-IID classes; not a strict duplicate, though whichever merges second will need a rebase. No other duplicates found in open/merged PRs or #1607. performance: none (one mutex lookup in a tiny BTreeMap per QueryApiImpl call on forwarding classes; one cached clone per distinct (CLSID, IID)) verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.2101), AMD Ryzen 9 9950X3D, Windows 11 Pro build 26300, Rust 1.100.0 / T3 Code (Antigravity), Gemini 4 Neon (Medium)
Foniass commented 2026-12-01 08:30:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:30:05Z.


Triage (#1607) – head 41e715e

No open or merged PR makes the same change; this is the fix suggested in #2399. In api.rs:QueryApiImpl every IID of a forwarding class now goes through forward_alias_obj, so the shared Obj.pc load-then-store race and the shared shorter PC vtable are gone; the new test fails on main (it gets the shared Obj back).
One behaviour change to be aware of: the clone has iids: vec![i] and main: false, so query_interface on it now refuses the class's other known IIDs, which the shared Obj used to accept.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305400411 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#issuecomment-7305400411). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:30:05Z. --- **Triage (#1607)** – head 41e715e No open or merged PR makes the same change; this is the fix suggested in #2399. In `api.rs:QueryApiImpl` every IID of a forwarding class now goes through `forward_alias_obj`, so the shared `Obj.pc` load-then-store race and the shared shorter PC vtable are gone; the new test fails on main (it gets the shared `Obj` back). One behaviour change to be aware of: the clone has `iids: vec![i]` and `main: false`, so `query_interface` on it now refuses the class's other known IIDs, which the shared `Obj` used to accept. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
tiagonleal commented 2026-12-02 21:42:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-12-02T21:42:31Z.


merge-check
base: 5ad98adbc3
head: 41e715e5d3
merge: clean (merge commit eea470c83967d1b928dde986da13612cc4c6b172; git diff --check clean)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3006 passed, 0 failed, 52 ignored; SKIPPED: 24 (22 no wave64, 2 no heap windows); failing: none
title run: Newer Retail Game, release build of this merge, Series S settings (XCL_DEVICE_TYPE=lockhart, XCL_COHERENT_MB=512, XCL_UMA_WINDOWS=16, XCL_SPARSE_LAZY=1), scripted A presses, 240 s planned: into the world at 82 s, 40 s there with 47 frames presented, no crash, no device removal; then our RAM guard stopped it (free RAM under 1 GB on this 32 GB PC, as in main's second run).
review: minor, not blocking: the per-IID clone stores pc_object(..).unwrap_or(0) once and caches it, where the old known-IID path retried while it was 0; and the clone lists only its own IID, so a QueryInterface from it to another known IID of the class now gives E_NOINTERFACE.
performance: negligible (one small object per class and IID queried). World frame rate not compared: on this 32 GB PC the runs of main and of the PRs end 30 to 150 s into the world (RAM guard or time limit).
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (driver 617.42), Ryzen 7 9800X3D, 32 GB, Windows 11 Pro 26300 / Claude Code with Claude Opus 5.5

Same settings on main 5ad98adb, two runs: into the world at 94 s with 145 s there and no frame presented (ran to the 240 s limit); into the world at 80 s with 59 s there and 90 frames, then stopped by our RAM guard (free RAM under 1 GB). "In the world" here means the first 2 s window of the activity log with 5,000+ draws and dispatches.

AI use: Claude Code (Claude Opus 5.5) ran the build, tests and title runs and wrote this; a Claude Sonnet subagent read the diff and I checked its points.
~Tiago

<!-- greyfinch-sync:ivall/xcl:comment:7359666480 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2623#issuecomment-7359666480). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-12-02T21:42:31Z. --- merge-check base: 5ad98adbc360225ac8a57ad9661e16fe8df9d8dd head: 41e715e5d39fc51ecd0c2227efbf232b67686294 merge: clean (merge commit eea470c83967d1b928dde986da13612cc4c6b172; `git diff --check` clean) build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3006 passed, 0 failed, 52 ignored; SKIPPED: 24 (22 no wave64, 2 no heap windows); failing: none title run: Newer Retail Game, release build of this merge, Series S settings (`XCL_DEVICE_TYPE=lockhart`, `XCL_COHERENT_MB=512`, `XCL_UMA_WINDOWS=16`, `XCL_SPARSE_LAZY=1`), scripted A presses, 240 s planned: into the world at 82 s, 40 s there with 47 frames presented, no crash, no device removal; then our RAM guard stopped it (free RAM under 1 GB on this 32 GB PC, as in main's second run). review: minor, not blocking: the per-IID clone stores `pc_object(..).unwrap_or(0)` once and caches it, where the old known-IID path retried while it was 0; and the clone lists only its own IID, so a QueryInterface from it to another known IID of the class now gives E_NOINTERFACE. performance: negligible (one small object per class and IID queried). World frame rate not compared: on this 32 GB PC the runs of main and of the PRs end 30 to 150 s into the world (RAM guard or time limit). verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB (driver 617.42), Ryzen 7 9800X3D, 32 GB, Windows 11 Pro 26300 / Claude Code with Claude Opus 5.5 Same settings on main 5ad98adb, two runs: into the world at 94 s with 145 s there and no frame presented (ran to the 240 s limit); into the world at 80 s with 59 s there and 90 frames, then stopped by our RAM guard (free RAM under 1 GB). "In the world" here means the first 2 s window of the activity log with 5,000+ draws and dispatches. AI use: Claude Code (Claude Opus 5.5) ran the build, tests and title runs and wrote this; a Claude Sonnet subagent read the diff and I checked its points. ~Tiago
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2623:upstream-pr/2623'
git switch 'upstream-pr/2623'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2623'
git switch 'upstream-pr/2623'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2623'
git switch 'upstream-pr/2623'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2623'
git switch 'main'
git merge --squash 'upstream-pr/2623'
git switch 'main'
git merge --ff-only 'upstream-pr/2623'
git switch 'main'
git merge 'upstream-pr/2623'
git push origin 'main'
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!2613
No description provided.