this_first: a test of the stale-vtable return buffer and either argument order #263

Manually merged
github merged 2 commits from gh-pr/263/head into gh-pr/263/base 2026-11-26 04:17:59 +00:00
Owner

@⁠ryosen0 on GitHub · 2026-11-23 22:07 UTC · original
ryosen0:this-first-tests → main · +46 −0 · 1 files · 2 commits · merged 2026-11-23 23:20 UTC

A test for real::this_first (7a033c8) - synthetic objects only, no GPU and no title.

Covers:

  • either argument order with one adopted object;
  • neither adopted / null: unchanged; one null argument: the other is this, either position;
  • the retail case: an object off the stack and a stack return buffer whose first word is a stale copy of its vtable pointer - both look adopted, and the stack one is the buffer in either order;
  • both on the stack, neither the device: the C++ way (a).

The fake adopted object is built the way queue_tests builds its fake queue (the extension vtable's word before slot 0 points at a PC table, registered in EXTS, removed after).

While writing it I also ran a native MSVC x64 probe of the member-call ABI on this machine (Ryzen 7 9800X3D, Windows 11, MSVC 14.44): for a member function returning a 16-byte struct, rcx = this and rdx = the hidden return buffer, and the compiler reuses the same stack slot for the return buffer across calls at the same stack depth - which is how a stale vtable copy ends up in it. Consistent with the crash this fixed.

Tested

  • Ryzen 7 9800X3D, RTX 3060 Ti 8 GB (driver 32.0.16.1742), 32 GB, Windows 11, rustc 1.100.0-nightly, release
  • cargo test --workspace -- --test-threads=4: 612 passed, 0 failed, 20 ignored; plus the other suites: 13+3+1+3+2+7+1+1+2+1+6 passed, 0 failed, 4+12 ignored
  • SKIPPED on this adapter: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64)
  • Regression run (below): main 1937 frames / PR head 2179 frames in 90 s, no device removal, no crash, peak commit 15.4 GB / 14.7 GB

Not tested

  • AMD GPUs, wave64 hardware
  • the retail title's later gameplay (the run reaches the first menu; audio stutter observed there - see below)
  • XAudio2 behaviour: the 90 s runs show the menu's audio stuttering on both main and this PR (the PR adds a test only, no runtime change), so this is not covered here

Regression run
main (9ab7d76):

xcl-smoke v1
commit: 9ab7d763197c7f420bff10cd9bf1310f07e2a9aa
gpu: Meta Virtual Monitor
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 1937 (PresentX 1937)
presents per 2 s (last 3): 37 36 35
device removals: 0
crashes: 0
peak commit: 15419 MB

this PR's head (130a143, no uncommitted changes):

xcl-smoke v1
commit: 130a14387196432caa3a37786dbd847667b1d0ab
gpu: Meta Virtual Monitor
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2179 (PresentX 2179)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14659 MB

AI use
GPT-6.2 Astra (API model selector), working as the coding agent in this session: wrote the test and this description, ran the tests, the smoke runs and the native ABI probe on the machine above. The human contributor reviewed the diff and the measurements.

**@⁠ryosen0** on GitHub · 2026-11-23 22:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/263) `ryosen0:this-first-tests` → `main` · +46 −0 · 1 files · 2 commits · merged 2026-11-23 23:20 UTC A test for `real::this_first` (7a033c8) - synthetic objects only, no GPU and no title. Covers: - either argument order with one adopted object; - neither adopted / null: unchanged; one null argument: the other is `this`, either position; - **the retail case**: an object off the stack and a stack return buffer whose first word is a stale copy of its vtable pointer - both look adopted, and the stack one is the buffer in either order; - both on the stack, neither the device: the C++ way (`a`). The fake adopted object is built the way `queue_tests` builds its fake queue (the extension vtable's word before slot 0 points at a PC table, registered in `EXTS`, removed after). While writing it I also ran a native MSVC x64 probe of the member-call ABI on this machine (Ryzen 7 9800X3D, Windows 11, MSVC 14.44): for a member function returning a 16-byte struct, `rcx` = this and `rdx` = the hidden return buffer, and the compiler **reuses the same stack slot for the return buffer across calls at the same stack depth** - which is how a stale vtable copy ends up in it. Consistent with the crash this fixed. **Tested** - Ryzen 7 9800X3D, RTX 3060 Ti 8 GB (driver 32.0.16.1742), 32 GB, Windows 11, rustc 1.100.0-nightly, release - `cargo test --workspace -- --test-threads=4`: 612 passed, 0 failed, 20 ignored; plus the other suites: 13+3+1+3+2+7+1+1+2+1+6 passed, 0 failed, 4+12 ignored - SKIPPED on this adapter: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64) - Regression run (below): main 1937 frames / PR head 2179 frames in 90 s, no device removal, no crash, peak commit 15.4 GB / 14.7 GB **Not tested** - AMD GPUs, wave64 hardware - the retail title's later gameplay (the run reaches the first menu; audio stutter observed there - see below) - XAudio2 behaviour: the 90 s runs show the menu's audio stuttering on both main and this PR (the PR adds a test only, no runtime change), so this is not covered here **Regression run** main (9ab7d76): ``` xcl-smoke v1 commit: 9ab7d763197c7f420bff10cd9bf1310f07e2a9aa gpu: Meta Virtual Monitor title: ScarlettGame seconds: 90 exit: 0x0 frames shown: 1937 (PresentX 1937) presents per 2 s (last 3): 37 36 35 device removals: 0 crashes: 0 peak commit: 15419 MB ``` this PR's head (130a143, no uncommitted changes): ``` xcl-smoke v1 commit: 130a14387196432caa3a37786dbd847667b1d0ab gpu: Meta Virtual Monitor title: ScarlettGame seconds: 90 exit: 0x0 frames shown: 2179 (PresentX 2179) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14659 MB ``` **AI use** GPT-6.2 Astra (API model selector), working as the coding agent in this session: wrote the test and this description, ran the tests, the smoke runs and the native ABI probe on the machine above. The human contributor reviewed the diff and the measurements.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:17:58 +00:00
github manually merged commit 130a143871 into gh-pr/263/base 2026-11-26 04:17:59 +00:00
Author
Owner

@⁠PHeitor1 on GitHub · 2026-11-23 22:47 UTC · original

Tested 130a143 merged onto main 9ab7d76 on RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X (Zen 3), Windows 11 Pro 26300 (native), rustc 1.100.0 MSVC, debug, cargo test --workspace --no-fail-fast -- --test-threads=4, no XCL_SAMPLE_*. Baseline main 9ab7d76: 651 passed, 0 failed, 40 ignored.

Pass: 652 passed, 0 failed, 40 ignored. GPU skips: the same 2 as on main (no wave64).

Run and written with Claude Code (Claude Opus 5.5).

**@⁠PHeitor1** on GitHub · 2026-11-23 22:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/263#issuecomment-7116192216) Tested `130a143` merged onto `main` `9ab7d76` on RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X (Zen 3), Windows 11 Pro 26300 (native), rustc 1.100.0 MSVC, debug, `cargo test --workspace --no-fail-fast -- --test-threads=4`, no `XCL_SAMPLE_*`. Baseline `main` `9ab7d76`: 651 passed, 0 failed, 40 ignored. **Pass:** 652 passed, 0 failed, 40 ignored. GPU skips: the same 2 as on `main` (`no wave64`). _Run and written with Claude Code (Claude Opus 5.5)._
Author
Owner

@⁠requiemsnkrp on GitHub · 2026-11-23 23:15 UTC · original

Tested 130a143 on NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.1714 / 617.14, 32-lane waves), Ryzen 5 5600X, Windows 11 Pro 25H2 (26200.9974), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17 (Windows SDK), debug: pass.

Tested

  • cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip test_title_draws_with_a_root_signature_under_the_debug_layer: 650 passed, 0 failed, 40 ignored
  • SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware
  • PR's test: hle::d3d12x::real::this_first_tests::a_return_buffer_with_a_stale_vtable_copy_is_not_the_object ... ok
  • main 4017f8f on the same machine, same command: 650 passed, 0 failed, 40 ignored, same 2 SKIPPED. The test commit 2f5979e is on 9ab7d76; the head 130a143 is a merge of main into the branch.
  • Tested the head itself; it merges cleanly into main 4017f8f (git merge-tree), the merge result was not tested.
  • Not run here: the two e2e tests that run the test title (test_title_runs_and_game_folder_is_untouched, test_title_draws_with_a_root_signature_under_the_debug_layer): they open the XCL game window and this PC was in use (the 2 "filtered out").

Not tested

  • Retail title regression run (no game copy here; the PR adds a test only).

AI use: Claude Code with Claude Opus 5.5 (ran the tests and wrote this report).

**@⁠requiemsnkrp** on GitHub · 2026-11-23 23:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/263#issuecomment-7116756261) Tested `130a143` on NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.1714 / 617.14, 32-lane waves), Ryzen 5 5600X, Windows 11 Pro 25H2 (26200.9974), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17 (Windows SDK), debug: **pass**. **Tested** - `cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip test_title_draws_with_a_root_signature_under_the_debug_layer`: 650 passed, 0 failed, 40 ignored - `SKIPPED` (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` - PR's test: `hle::d3d12x::real::this_first_tests::a_return_buffer_with_a_stale_vtable_copy_is_not_the_object ... ok` - `main` `4017f8f` on the same machine, same command: 650 passed, 0 failed, 40 ignored, same 2 SKIPPED. The test commit `2f5979e` is on `9ab7d76`; the head `130a143` is a merge of `main` into the branch. - Tested the head itself; it merges cleanly into `main` `4017f8f` (`git merge-tree`), the merge result was not tested. - Not run here: the two e2e tests that run the test title (`test_title_runs_and_game_folder_is_untouched`, `test_title_draws_with_a_root_signature_under_the_debug_layer`): they open the XCL game window and this PC was in use (the 2 "filtered out"). **Not tested** - Retail title regression run (no game copy here; the PR adds a test only). **AI use**: Claude Code with Claude Opus 5.5 (ran the tests and wrote this report).
This discussion has been locked. Commenting is limited to contributors.
No description provided.