Skip to content

XGameRuntime: refresh blob sizes after replacement (#2421) - #2521

Open
luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/xgameruntime-blobs-metadata
Open

luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/xgameruntime-blobs-metadata

Conversation

@luckyteagirl

@luckyteagirl luckyteagirl commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2421. Read blob sizes from the file path after atomic replacement so Windows directory-entry metadata cannot report a stale size.

What is in it

  • crates/xcl/src/hle/xgameruntime/gamesave.rs: refresh blob sizes with std::fs::metadata and add a Windows-only saved-DirEntry regression test.

Tested

  • Windows 11 Home build 26200; AMD Ryzen 9 5980HX; AMD Radeon RX 6800M, driver 30.0.13002.13003; Rust 1.99.0 / Cargo 1.99.0; debug test profile and release build.
  • Guarded release builds on main (6d12f58a229bc73889878a448c64dc3af25eeba0) and this commit (c5f68eddf00db07ada4c5cddedabddf9c7eff300): cargo build --locked --release -p xcl -j 2, exit 0, memory/time guard not triggered. Logs: work-2421/logs/release-main.log, work-2421/logs/release-head.log.
  • CARGO_BUILD_JOBS=2; isolated test target: work-2421/target.
  • cargo test -p xcl --lib hle::xgameruntime::gamesave::tests::blob_entry_reports_replaced_file_size_from_path -- --exact: 1 passed, 0 failed, 0 ignored (1,324 filtered).
  • cargo test -p xcl --lib hle::xgameruntime::gamesave::tests::blob_enumeration_sees_one_submitted_update -- --exact: 1 passed, 0 failed, 0 ignored (1,324 filtered).
  • Negative control: temporarily restored DirEntry::metadata(); the new test failed as expected (0 passed, 1 failed), reporting 3 bytes instead of 11. Restored the fix and reran both tests successfully.
  • Independent RTX 3080 Ti report on the same exact head: cargo build --workspace passed; cargo test --workspace --no-fail-fast -- --test-threads=4 completed with 1,424 passed, 0 failed, 46 ignored, and 25 explicit GPU skips (21 native-wave64, three refused per-lane, one heap-window). The saved-entry regression also passed. These are the independent reporter's results, not runs on our RX 6800M.
  • git diff --check: passed.

Regression run

  • The paired 5-second main and PR-head runs below used the same local title (hash 2ef5fd64), adapter and duration. Both exited 0 with no device removals or crashes, but showed 0 frames; these runs covered startup only and did not reach blob enumeration. Two 7-second head attempts stopped at the unchanged 1 GiB memory guard (free commit 964 MB and 834 MB), so they produced no smoke block.
xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 5
exit: 0x0
frames shown: 0 (PresentX 0)
presents per 2 s (last 3): 0 0
device removals: 0
crashes: 0
peak commit: 6555 MB
xcl-smoke v1
commit: c5f68eddf00db07ada4c5cddedabddf9c7eff300
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 5
exit: 0x0
frames shown: 0 (PresentX 0)
presents per 2 s (last 3): 0 0
device removals: 0
crashes: 0
peak commit: 6555 MB
  • Independent RTX 4060 retail smoke from Decodere used the exact PR head and its upstream main parent on the same title and adapter for 60 seconds. The head showed 1,575 of main's 1,606 frames and used 14,012 MB peak commit versus main's 14,004 MB. Both exited normally with no crashes or device removals. The run checked startup, presentation, and XGameSave API binding. It did not exercise an interactive save-blob replacement and re-enumeration cycle.

Independent main:

xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1606 (PresentX 1606)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14004 MB

Independent PR head:

xcl-smoke v1
commit: c5f68eddf00db07ada4c5cddedabddf9c7eff300
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1575 (PresentX 1575)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14012 MB

Not tested

  • A separate exact-head reporter run still failed the mixed-enumeration test in 3 of 5 runs because an uppercase ~XCLTMP. entry appeared. XGameRuntime: ignore mixed-case game-save temp files #2373 addresses that filter. A second report identified transient writer MoveFileExW failures and a reader-thread lifetime hazard on panic. This PR addresses stale size metadata only.
  • A full workspace suite on our RX 6800M; the independent RTX 3080 Ti suite skipped 25 GPU tests.
  • The retail title's blob-enumeration path: the local smoke runs showed no frames and the independent run did not exercise an interactive save-blob replacement and re-enumeration cycle. Other GPU/Windows configurations beyond those reported above.

AI use

  • OpenAI Codex, GPT-6 (exact model variant unavailable), implemented the fix and regression test, ran the focused checks, and drafted this description.
  • OpenAI Codex (GPT-6.2 Astra) verified the independent exact-head report and added its linked results to this description.
  • OpenAI Codex (GPT-6.2 Sol) incorporated Decodere's attributed exact-head retail smoke report without changing the PR code.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@fromthemoonx

Copy link
Copy Markdown

Full suite on NVIDIA: passes. The new test fails with DirEntry::metadata() put back (3 of 3, left: 3, right: 11), so it catches the stale size. But #2421's own test, blob_enumeration_sees_one_submitted_update, did not fail on main here (40 of 40 pass). So this machine shows the stale-size effect only through the new test.

Tested: c5f68ed merged onto main e1d84b7 (clean; the only difference from the PR's base 6d12f58 is a README change). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, NTFS, Rust 1.100.0 MSVC, debug.

result
cargo test --workspace --no-fail-fast -- --test-threads=4 1424 passed, 0 failed, 46 ignored; 25 SKIPPED lines (no wave64, refused per-lane forms)
blob_entry_reports_replaced_file_size_from_path alone, 40 runs 40 of 40
blob_enumeration_sees_one_submitted_update alone, 40 runs: on main / with this PR 40 of 40 / 40 of 40
hle::xgameruntime::gamesave:: (12 tests), --test-threads=8, 30 runs 30 of 30
blob_info with e.metadata() instead of std::fs::metadata(&path) (scratch) the new test fails 3 of 3 at gamesave.rs:1175, left: 3, right: 11

Not tested: a title's save path, a release build, AMD.

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

@SlopTart

Copy link
Copy Markdown

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of blob_entry_reports_replaced_file_size_from_path: passed. This is XGameRuntime, CPU-side; it runs fine under the Wine lane.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

@thehollowedone

Copy link
Copy Markdown
Contributor

Independent Windows check of head c5f68ed. The saved-directory-entry regression and full workspace suite passed on this machine.

Tested

  • Windows 11 Pro build 26300; NVIDIA GeForce RTX 3080 Ti, driver 621.35; AMD Ryzen 7 9800X3D; Rust 1.99.1 MSVC; DXC/DXIL 1.8.2502.11; debug profile.
  • cargo test -p xcl --lib hle::xgameruntime::gamesave::tests::blob_entry_reports_replaced_file_size_from_path -- --exact: 1 passed, 0 failed, 0 ignored.
  • cargo build --workspace: passed. cargo test --workspace --no-fail-fast -- --test-threads=4: 1,424 passed, 0 failed, 46 ignored. The 25 explicit SKIPPED notices were 21 native-wave64 cases (unavailable on this GPU), three refused per-lane cases, and one unavailable heap-window case. The suite included both the new saved-entry test and blob_enumeration_sees_one_submitted_update.
  • The PR head merges cleanly with main 08db802 in a local git merge-tree check; no merge commit was made.

Not tested

  • A retail title's blob-enumeration path or a paired title smoke run; AMD hardware. I did not run a negative control with the old metadata call, so this report establishes passing behavior on this head rather than an independent before/after reproduction.

AI use

  • Codex (GPT-6.2 Sol) inspected the diff, ran the commands above, checked the results, and drafted this report.

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
… upstream xcl-dev#1237 + xcl-dev#494 + xcl-dev#1382 loopback)

Port live heads e2a4b1d (xcl-dev#1237), bf21fd8 (xcl-dev#494), 2b765d2 (xcl-dev#1382), all
still OPEN vs upstream/main. Windows hunks already verbatim
reference-only; this is the Linux twin (win64 ABI).

xcl-dev#1237: InitialNotification<T> + notify_initial via queue_from/submit_now
on PORT_COMPLETION + udp/connectivity call fns; both Registers reject
null callback (E_INVALIDARG) and queue the current value.
xcl-dev#494: network_off() reads XCL_NETWORK directly (hle_linux has no netoff
yet) + connectivity_level() 1/3; GetConnectivityHint uses it.
xcl-dev#1382 portable: url_host_and_is_plain_loopback via IpAddr::is_loopback
+ subnet vectors; request_url/security_info/issuer stay Windows-only
(WinHTTP/crypt32 handles, no Linux consumer — same precedent as xcl-dev#843).

Already-landed on Linux, verified no change: xcl-dev#1247, xcl-dev#1753, xcl-dev#2021,
xcl-dev#1588 + Watch xcl-dev#2521/xcl-dev#2524/xcl-dev#2623.

Failing-first: new symbols 0 at HEAD; old Registers accepted cb==0 and
queued nothing. Gates: both checks 0 errors, xtaskqueue_linux 16/16,
lib 760/0/1 t=4, title 12 GPU-only, retail SIGSEGV +0x2237320 HOLDS.
@Ritolino

Copy link
Copy Markdown
Contributor

Tested c5f68ed merged cleanly onto main (8b957bec) on the Windows 11 machine where #2421 reproduces (NVIDIA GeForce RTX 4080, rustc 1.100.0, debug).

hle::xgameruntime::gamesave::tests::blob_enumeration_sees_one_submitted_update still fails intermittently (3/5 runs failed; blob_entry_reports_replaced_file_size_from_path passed).

Printing rows when the assertion trips shows that the failure is not a stale DirEntry::metadata() size — blobs_of is enumerating an extra temp file (len=17) whose prefix is uppercase with a .tmp suffix, bypassing the case-sensitive starts_with(TMP_PREFIX) filter (~xcltmp.):

DIAG MIXED len=17 rows=[(blob00, 16), (blob01, 16), (blob02, 16), (blob03, 16), (blob04, 16), (blob05, 16), (blob06, 16), (blob07, 16), (blob08, 16), (blob09, 16), (blob10, 16), (blob11, 16), (blob12, 16), (blob13, 16), (blob14, 16), (blob15, 16), (~XCLTMP.15376.155.tmp, 0)]

(Likely related to #2366 / #2373, where case-insensitive filtering of ~xcltmp. is still pending.)

AI use: Antigravity with Gemini 4 Neon (Medium) and Gemini 4 Hydrogen (Medium) ran the diagnostic loop and drafted this report; reviewed by human.

@Decodere

Copy link
Copy Markdown
Contributor

Independent desktop NVIDIA verification of PR #2521 at head c5f68eddf00db07ada4c5cddedabddf9c7eff300 (1 commit; exact parent & merge-base: 6d12f58a229bc73889878a448c64dc3af25eeba0, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (NTFS, Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted release tests & build (c5f68edd)

Command Result
cargo test --release -p xcl --lib blob_entry_reports_replaced_file_size_from_path -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.01s × 3, 0 skipped; live Windows 11 NTFS verification)
cargo test --release -p xcl --lib hle::xgameruntime::gamesave:: -- --test-threads=1 (3 consecutive runs) 12 passed; 0 failed; 0 ignored; 1313 filtered out × 3 (2.00s, 1.09s, 0.43s, 0 skipped)
cargo build --release -p xcl Clean build (1m 08s, exit 0, 0 new warnings)

Paired quiet 60 s retail smoke (title: 29640639)

Exact parent & merge-base (6d12f58a229bc73889878a448c64dc3af25eeba0, cached baseline on the same machine):

xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1606 (PresentX 1606)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14004 MB

PR #2521 (c5f68eddf00db07ada4c5cddedabddf9c7eff300):

xcl-smoke v1
commit: c5f68eddf00db07ada4c5cddedabddf9c7eff300
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1575 (PresentX 1575)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14012 MB

Runtime log observations (xcl.log)

  • 9222 log lines, 0 [ERROR] / device-removal / panic lines (XGameRuntime: QueryApiImpl ... -> XGameSave: XCL initialized cleanly; dxil_cache: 460 hits, 0 misses, 0 failures).
  • Final draw/memory telemetry in log: 19549 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample 14011 MB committed by the process; video memory 6115 MB local, 4681 MB non-local.

Limits of coverage

  • Path-based std::fs::metadata(&path) blob-size lookup after atomic file replacement (avoiding stale Windows NTFS DirEntry::metadata() sizes) was verified directly on Windows 11 NTFS via hle::xgameruntime::gamesave::tests::blob_entry_reports_replaced_file_size_from_path (3/3) and the full hle::xgameruntime::gamesave:: suite (12/12 × 3).
  • The 60 s retail smoke confirms startup and XGameSave API binding non-regression (single-run frame/commit delta vs. cached parent reflects normal startup variance, not this PR); it did not drive an interactive in-title save-blob replacement and re-enumeration cycle.

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

@throny

throny commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

merge-check claim
head: c5f68ed

@throny

throny commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

merge-check
base: e13d625
head: c5f68ed
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2131 passed, 10 failed, 48 ignored (26 SKIPPED lines). The 10 failures are the ones main itself has at e13d625 on this GPU (#3093: the nine since #2959 and, since today, gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions), the same set with and without this PR; base alone: 2130 passed, 10 failed, 48 ignored.
review: the change itself is harmless (one metadata call per blob per enumeration), but by a tester's report in the thread it does not fix #2421: the test of that issue still fails in 3 of 5 runs with this PR, and the cause shown there is a temporary file with an upper-case prefix that gets past the case-sensitive prefix filter in blobs_of (main has a case-insensitive helper that blobs_of does not use). I did not reproduce this here; the suite passed once with it.
performance: negligible (save API only).
verdict: not yet: either include the case-insensitive filter, or change "Fixes #2421" to "Part of #2421".
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

@relativespace2K

relativespace2K commented Nov 30, 2026 •

Copy link
Copy Markdown

merge-check
base: 53e85fb
head: c5f68ed
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2789 passed, 6 failed, 49 ignored; failing: gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form, gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, ram_budget::tests::windows_takes_a_working_set_maximum_and_lifts_it, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (in --test gpu_two_pass_cache_e2e, so 5 failing tests give 6 failures). The same five fail on base 53e85fb alone (2788 passed, 6 failed, 49 ignored there), so none comes from this PR; its new test passed. 13 SKIPPED lines, all environmental: no D3D12 debug layer / d3d12SDKLayers.dll, no heap windows, no GPU_UPLOAD, per-lane f16/f32 forms refused.
review: no blocking finding; 38 lines, one file, whole diff read. blobs_of now stats the path instead of using the DirEntry snapshot, which on Windows comes from the directory enumeration and can still carry the old size after an atomic replace; the size is what a save's blob list hands back, so the fix is in the right place, and unwrap_or(0) keeps the old fallback for a vanishing file. The new test takes a DirEntry, replaces the blob with write_atomic and asserts the reported size is the new one: that is exactly the stale case on Windows, and it is #[cfg(windows)] because elsewhere the entry is not cached that way. No duplicate: #2373/#2420/#2793/#2439 touch game-save enumeration for other reasons, none refreshes the size of a replaced blob. throny's not yet asked either for the case-insensitive filter or for the description to say Part of #2421: the description has said Part of #2421. since 2026-11-27, before that check, and the mixed-case temp-file filter is a separate change (#2373), not part of #2421's root cause (the stale DirEntry size). I keep safe to merge on that basis; if the maintainers want the filter in the same PR, it is not in this diff.
performance: one extra metadata call per blob when a container's blobs are listed (a handful per save operation), nothing per frame.
verdict: safe to merge
hardware / tool and model: AMD Radeon RX 6800 XT 16 GB (RDNA2, wave64), driver 32.0.21045.29003; Ryzen 5 5600, 32 GB RAM; Windows 10 IoT Enterprise LTSC 2024, 10.0.26100 build 26100.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build. DeepSeek Harness coding agent, model DeepSeek V4.1 Flash.

@github-actions github-actions Bot added area:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH needs-rebase Has merge conflicts with its base branch labels Nov 30, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head c5f68ed

No open or merged PR makes the same change. Main moved the enumeration into try_blobs_of (commit 1028ba5), but it still sizes each blob with e.metadata() (the DirEntry snapshot). #2979 changes only the enumeration test.
No problems found in the diff. The rebase onto main needs blob_info (or its fs::metadata(path) call) moved into try_blobs_of.
Recommendation: keep open.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH needs-rebase Has merge conflicts with its base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants