XGameRuntime: snapshot blob enumeration across submitted updates #2155

Merged
luckyteagirl merged 1 commit from upstream-pr/2165 into main 2026-11-25 10:51:02 +00:00
luckyteagirl commented 2026-11-25 06:44:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T06:44:12Z.


XGameSaveEnumerateBlobInfo and its by-name variant collect blob sizes while XGameSaveSubmitUpdate replaces files one at a time. The update holds SAVE_MUTATION, but enumeration did not, so one callback sequence could contain sizes from different submitted updates. This is a narrow follow-up to the enumeration gap noted in #2132.

What is in it

  • each_blob takes SAVE_MUTATION only while collecting the blob metadata snapshot, then releases it before invoking title callbacks. Both blob enumeration entry points use this helper.
  • A concurrent test writes 16 blobs across 30 updates while another thread enumerates them. With only the new test added to main, 24,931 of 26,524 enumerations mixed update versions and the test failed. With the snapshot lock, the test passed and passed 5 more independent runs. Callbacks remain outside the lock so they can call GameSave APIs.

Tested

  • Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver 30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. Debug tests, release smoke.
  • cargo test --locked -p xcl --lib -j 2 gamesave -- --test-threads=1 --show-output: 11 passed, 0 failed, 0 ignored. The new race test passed 5 more runs: 5 passed, 0 failed.
  • cargo build --locked --workspace -j 2 and cargo build --locked --workspace --release -j 2: both passed.
  • cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output: 994 passed, 161 failed, 46 ignored across 21 test targets. The 161 failure names exactly match a clean main run on the same RX 6800M driver (993 passed, 161 failed, 46 ignored); all are GPU tests and the run reports device suspension 0x887A0005. main advanced from 6020a33 to this branch's base 568e7db only in README and an image asset. Nine SKIPPED notices on this head: no native 16-bit ops; two tests after GPU loss; two shader tests with no usable D3D12 device; no reserved cube with mips; two missing debug-layer cases; and no heap windows. Skips are included in the pass count but provide no coverage for those cases.

Regression run

Paired guarded 7-second launches of the same owned 1.0.2.1 title, with isolated data and shader caches. The title reached its first frame but made no GameSave call in this window. The baseline is a main commit whose runtime source matches base 568e7db.

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 6969 MB
xcl-smoke v1
commit: 1028ba5edca648bf562b90aef2f247beb5650236
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 6917 MB

Not tested

  • A retail title performing save updates while enumerating, non-Windows hosts, or reentrant GameSave callbacks. The short smoke pair does not exercise the changed path.
  • A clean full GPU suite on this driver; the same 161 GPU failures occur on unmodified main.

AI use

OpenAI Codex (GPT-6) read the code, wrote the fix and concurrent test, ran the failed-first control and Windows checks, and drafted this description. All counts and smoke blocks above are from local runs; no game data is included.

<!-- greyfinch-sync:ivall/xcl:issue:6598871774 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2165). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-25T06:44:12Z. --- `XGameSaveEnumerateBlobInfo` and its by-name variant collect blob sizes while `XGameSaveSubmitUpdate` replaces files one at a time. The update holds `SAVE_MUTATION`, but enumeration did not, so one callback sequence could contain sizes from different submitted updates. This is a narrow follow-up to the enumeration gap noted in #2132. **What is in it** - `each_blob` takes `SAVE_MUTATION` only while collecting the blob metadata snapshot, then releases it before invoking title callbacks. Both blob enumeration entry points use this helper. - A concurrent test writes 16 blobs across 30 updates while another thread enumerates them. With only the new test added to `main`, 24,931 of 26,524 enumerations mixed update versions and the test failed. With the snapshot lock, the test passed and passed 5 more independent runs. Callbacks remain outside the lock so they can call GameSave APIs. **Tested** - Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver `30.0.13002.13003`; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. Debug tests, release smoke. - `cargo test --locked -p xcl --lib -j 2 gamesave -- --test-threads=1 --show-output`: **11 passed, 0 failed, 0 ignored**. The new race test passed 5 more runs: **5 passed, 0 failed**. - `cargo build --locked --workspace -j 2` and `cargo build --locked --workspace --release -j 2`: both passed. - `cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output`: **994 passed, 161 failed, 46 ignored** across 21 test targets. The 161 failure names exactly match a clean `main` run on the same RX 6800M driver (**993 passed, 161 failed, 46 ignored**); all are GPU tests and the run reports device suspension `0x887A0005`. `main` advanced from `6020a33` to this branch's base `568e7db` only in README and an image asset. Nine `SKIPPED` notices on this head: no native 16-bit ops; two tests after GPU loss; two shader tests with no usable D3D12 device; no reserved cube with mips; two missing debug-layer cases; and no heap windows. Skips are included in the pass count but provide no coverage for those cases. **Regression run** Paired guarded 7-second launches of the same owned 1.0.2.1 title, with isolated data and shader caches. The title reached its first frame but made no GameSave call in this window. The baseline is a `main` commit whose runtime source matches base `568e7db`. ```text xcl-smoke v1 commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09 gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 6969 MB ``` ```text xcl-smoke v1 commit: 1028ba5edca648bf562b90aef2f247beb5650236 gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 6917 MB ``` **Not tested** - A retail title performing save updates while enumerating, non-Windows hosts, or reentrant GameSave callbacks. The short smoke pair does not exercise the changed path. - A clean full GPU suite on this driver; the same 161 GPU failures occur on unmodified `main`. **AI use** OpenAI Codex (GPT-6) read the code, wrote the fix and concurrent test, ran the failed-first control and Windows checks, and drafted this description. All counts and smoke blocks above are from local runs; no game data is included.
futurepro62 commented 2026-11-25 08:08:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-25T07:06:50Z.


Full-suite run, since this PR has no test report yet. Tested exact head 1028ba5 (on its base 568e7db).

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: 1143 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.
  • The new tests ran and passed: blob_enumeration_sees_one_submitted_update.
  • 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: 1154 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.
<!-- greyfinch-sync:ivall/xcl:comment:7155502438 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2165#issuecomment-7155502438). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-25T07:06:50Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `1028ba5` (on its base `568e7db`). **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`: **1143 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`. - The new tests ran and passed: `blob_enumeration_sees_one_submitted_update`. - 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`: **1154 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://github.com/xcl-dev/xcl/issues/1651#issuecomment-7146069648)) 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.
DavidM1911 commented 2026-11-25 08:08:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T07:20:35Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7155754132 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2165#issuecomment-7155754132). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T07:20:35Z. --- 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!
upstream-sync closed this pull request 2026-11-25 11:08:28 +00:00
raylitebull commented 2026-11-25 11:09:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T10:45:01Z.


Code review on 1028ba5:

  • Snapshotting blobs_of(&c.dir) under SAVE_MUTATION inside each_blob (crates/xcl/src/hle/xgameruntime/gamesave.rs) prevents concurrent updates from tearing blob enumeration, verified by blob_enumeration_sees_one_submitted_update.
  • Note overlap with #2132 (a18c180), which also targets gamesave.rs read/update consistency.
  • Diff audited and CI workflow approved (running).

Remaining before merge: Build and test finishing green plus dual-vendor verification on 1028ba5.

<!-- greyfinch-sync:ivall/xcl:comment:7160120913 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2165#issuecomment-7160120913). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T10:45:01Z. --- Code review on `1028ba5`: - Snapshotting `blobs_of(&c.dir)` under `SAVE_MUTATION` inside `each_blob` (`crates/xcl/src/hle/xgameruntime/gamesave.rs`) prevents concurrent updates from tearing blob enumeration, verified by `blob_enumeration_sees_one_submitted_update`. - Note overlap with `#2132` (`a18c180`), which also targets `gamesave.rs` read/update consistency. - Diff audited and CI workflow approved (running). **Remaining before merge:** `Build and test` finishing green plus dual-vendor verification on `1028ba5`.
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!2155
No description provided.