Memory: separate Series S coherent window cache from Series X #1101

Closed
xroneyaa wants to merge 1 commit from upstream-pr/1110 into main
xroneyaa commented 2026-11-24 11:42:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by xroneyaa on 2026-11-24T11:42:36Z.


When a title is switched from Series X (anaconda) to Series S (lockhart) in the same data folder, <data>\cache\uma_coherent.txt still holds Series X's larger coherent-heap measurement and note_coherent_need never lowers it. On an 8 GB VRAM + 16 GB RAM Windows host this keeps the coherent window pinned at 4095 MiB (increasing non-local GPU memory usage under WDDM) even when the Series S profile only needs ~3407 MiB. Giving Series S its own <data>\cache\uma_coherent_lockhart.txt lets each console profile size its coherent window independently. Part of #333.

What is in it

  • crates/xcl/src/gpu/uma.rs:
    • coherent_file_for(data_dir, series_s): selects uma_coherent_lockhart.txt when config().is_series_s() is true and keeps uma_coherent.txt for Series X.
    • coherent_hint_from(path, free) and record_coherent_need(path, bytes): helpers extracted from coherent_hint / note_coherent_need using saturating addition before clamping to MAX_SIZE.
    • Unit test series_s_coherent_cache_is_separate_from_series_x: verifies separate cache filenames, independent coherent window sizing (4,804,771,840 B -> MAX_SIZE for Series X vs 3,036,545,024 B -> 3,573,415,936 B for Series S), monotonicity within a file, and the NEEDS_FOR_COHERENT_HEAPS low-commit fallback.

Tested

  • GPU: NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver 32.0.16.1088, 32-lane waves); CPU: 12th Gen Intel Core i5-12400F; 15.9 GB RAM; Windows 11 Pro Build 22631; Rust 1.100.0 (0ef1bc386 2026-11-09); DXC 1.8.2502.11.
  • .\scripts\test.ps1 (cargo test --workspace -- --test-threads=4, debug): 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware), including gpu::uma::tests::series_s_coherent_cache_is_separate_from_series_x.
  • cargo test -p xcl series_s_coherent_cache_is_separate_from_series_x: passed 3 consecutive runs (0 failed).
  • Release build (cargo build --release -p xcl): succeeded cleanly.
  • Measured Series X vs Series S coherent needs on this 8 GB VRAM + 16 GB RAM host in retail diagnostic runs: Series X asked for 4,804,771,840 B (4095 MiB coherent window; non-local peaked at 4685 MB when reused on lockhart), while a fresh lockhart run asked for 3,036,545,024 B (3407 MiB window with XCL's 512 MB headroom; non-local peaked at 3997 MB under XCL_COHERENT_MB=3200).

Regression run
main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1487 (PresentX 1488)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 10404 MB

PR:

xcl-smoke v1
commit: 2c4bcb5d60907274c274d187f80fbdcacef74c4e
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1517 (PresentX 1518)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 10401 MB

Not tested

  • AMD / Intel GPUs and Linux / Wine + vkd3d-proton.
  • Full retail Series S gameplay past 300 s world loading.

AI use

  • Antigravity (Google DeepMind; exact model identifier not exposed in environment) wrote the code, unit test, and PR description; all tests and smoke runs were executed locally on the host RTX 3060 Ti.
<!-- greyfinch-sync:ivall/xcl:issue:5471458139 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1110). Originally posted by [xroneyaa](https://github.com/xroneyaa) on 2026-11-24T11:42:36Z. --- When a title is switched from Series X (`anaconda`) to Series S (`lockhart`) in the same data folder, `<data>\cache\uma_coherent.txt` still holds Series X's larger coherent-heap measurement and `note_coherent_need` never lowers it. On an 8 GB VRAM + 16 GB RAM Windows host this keeps the coherent window pinned at 4095 MiB (increasing non-local GPU memory usage under WDDM) even when the Series S profile only needs ~3407 MiB. Giving Series S its own `<data>\cache\uma_coherent_lockhart.txt` lets each console profile size its coherent window independently. Part of #333. **What is in it** - `crates/xcl/src/gpu/uma.rs`: - `coherent_file_for(data_dir, series_s)`: selects `uma_coherent_lockhart.txt` when `config().is_series_s()` is true and keeps `uma_coherent.txt` for Series X. - `coherent_hint_from(path, free)` and `record_coherent_need(path, bytes)`: helpers extracted from `coherent_hint` / `note_coherent_need` using saturating addition before clamping to `MAX_SIZE`. - Unit test `series_s_coherent_cache_is_separate_from_series_x`: verifies separate cache filenames, independent coherent window sizing (`4,804,771,840` B -> `MAX_SIZE` for Series X vs `3,036,545,024` B -> `3,573,415,936` B for Series S), monotonicity within a file, and the `NEEDS_FOR_COHERENT_HEAPS` low-commit fallback. **Tested** - GPU: NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver `32.0.16.1088`, 32-lane waves); CPU: 12th Gen Intel Core i5-12400F; 15.9 GB RAM; Windows 11 Pro Build 22631; Rust `1.100.0 (0ef1bc386 2026-11-09)`; DXC `1.8.2502.11`. - `.\scripts\test.ps1` (`cargo test --workspace -- --test-threads=4`, debug): **742 passed, 0 failed, 41 ignored** (`SKIPPED` GPU tests: `2 (no wave64)`: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`), including `gpu::uma::tests::series_s_coherent_cache_is_separate_from_series_x`. - `cargo test -p xcl series_s_coherent_cache_is_separate_from_series_x`: passed 3 consecutive runs (0 failed). - Release build (`cargo build --release -p xcl`): succeeded cleanly. - Measured Series X vs Series S coherent needs on this 8 GB VRAM + 16 GB RAM host in retail diagnostic runs: Series X asked for `4,804,771,840` B (`4095` MiB coherent window; `non-local` peaked at `4685` MB when reused on `lockhart`), while a fresh `lockhart` run asked for `3,036,545,024` B (`3407` MiB window with XCL's `512` MB headroom; `non-local` peaked at `3997` MB under `XCL_COHERENT_MB=3200`). **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-title seconds: 60 exit: 0x0 frames shown: 1487 (PresentX 1488) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 10404 MB ``` PR: ``` xcl-smoke v1 commit: 2c4bcb5d60907274c274d187f80fbdcacef74c4e gpu: NVIDIA GeForce RTX 3060 Ti title: retail-title seconds: 60 exit: 0x0 frames shown: 1517 (PresentX 1518) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 10401 MB ``` **Not tested** - AMD / Intel GPUs and Linux / Wine + vkd3d-proton. - Full retail Series S gameplay past 300 s world loading. **AI use** - Antigravity (Google DeepMind; exact model identifier not exposed in environment) wrote the code, unit test, and PR description; all tests and smoke runs were executed locally on the host RTX 3060 Ti.
futurepro62 commented 2026-11-24 15:05:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:17:06Z.


Full-suite run, since this PR has no test report yet. Tested exact head 2c4bcb5 (on its base 47efa2e).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: series_s_coherent_cache_is_separate_from_series_x.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no skips.
  • My first Radeon run of this head failed one timing check, origin_events_issue_tokens_and_flips_have_statistics ("4 origins at 60 Hz took 18 ms"), while other GPU jobs ran on the machine; the rerun above is clean.

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:7134127854 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1110#issuecomment-7134127854). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T14:17:06Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `2c4bcb5` (on its base `47efa2e`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **742 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `series_s_coherent_cache_is_separate_from_series_x`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **742 passed, 0 failed, 41 ignored**, no skips. - My first Radeon run of this head failed one timing check, `origin_events_issue_tokens_and_flips_have_statistics` ("4 origins at 60 Hz took 18 ms"), while other GPU jobs ran on the machine; the rerun above is clean. **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.
luckyteagirl commented 2026-11-25 07:05:44 +00:00 (Migrated from github.com)

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


Independent Windows check of exact PR head 2c4bcb5d60907274c274d187f80fbdcacef74c4e.

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.
  • XCL_REQUIRE_GPU=0, XCL_DIRECT_DXIL=0; cargo test --locked -p xcl --lib -j 2 gpu::uma::tests -- --test-threads=1 --show-output: 8 passed, 0 failed, 0 ignored, 0 SKIPPED. This includes series_s_coherent_cache_is_separate_from_series_x, which exercises distinct cache paths and coherent-window calculations. These tests did not create a D3D12 device; the GPU identifies the host, not GPU coverage.

I did not run the full GPU workspace suite, change the host between Series X and Series S profiles, or run a paired title smoke for this PR. The test validates cache selection and calculations, not a live game's coherent allocation behavior.

AI-assisted checkout, testing, log verification, and report drafting with OpenAI Codex (GPT-6). No game data was used.

<!-- greyfinch-sync:ivall/xcl:comment:7155370023 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1110#issuecomment-7155370023). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-25T06:59:30Z. --- Independent Windows check of exact PR head `2c4bcb5d60907274c274d187f80fbdcacef74c4e`. **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. - `XCL_REQUIRE_GPU=0`, `XCL_DIRECT_DXIL=0`; `cargo test --locked -p xcl --lib -j 2 gpu::uma::tests -- --test-threads=1 --show-output`: **8 passed, 0 failed, 0 ignored, 0 SKIPPED**. This includes `series_s_coherent_cache_is_separate_from_series_x`, which exercises distinct cache paths and coherent-window calculations. These tests did not create a D3D12 device; the GPU identifies the host, not GPU coverage. I did not run the full GPU workspace suite, change the host between Series X and Series S profiles, or run a paired title smoke for this PR. The test validates cache selection and calculations, not a live game's coherent allocation behavior. AI-assisted checkout, testing, log verification, and report drafting with OpenAI Codex (GPT-6). No game data was used.
DavidM1911 commented 2026-11-25 09:08:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:21:52Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7156933804 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1110#issuecomment-7156933804). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T08:21:52Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
safesearch77 commented 2026-11-26 16:40:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by safesearch77 on 2026-11-26T16:40:55Z.


Reviewed 2c4bcb5d (#333 uma_coherent_lockhart.txt separation) and compile-verified a rebase
onto main (8b957bec). One important adaptation for main's 8/16-window XCL_HEAP_WINDOWS=1
support in crates/xcl/src/gpu/uma.rs:

  • main replaced MAX_SIZE in coherent_hint_for(windows) and note_coherent_need with
    let cap = max_coherent_bytes(windows); (up to 5 or 13 coherent windows). Passing cap: usize
    into coherent_hint_from(path: &Path, free: usize, cap: usize) (title.saturating_add( RUNTIME_COMMITTED_CAP).min(cap)) instead of clamping to MAX_SIZE preserves multi-window sizing
    while keeping Series S and Series X caches separate.
// Compile-verified conflict resolution in crates/xcl/src/gpu/uma.rs on 8b957bec:
fn coherent_hint_from(path: &std::path::Path, free: usize, cap: usize) -> usize {
    let title = std::fs::read_to_string(path).ok().and_then(|s| s.trim().parse::<usize>().ok()).unwrap_or(0);
    if title > 0 && free < NEEDS_FOR_COHERENT_HEAPS {
        crate::xlog_warn!(
            "UMA: {} MB of commit free, under {} MB: the title's GPU heaps stay outside unified memory (a larger page file gives them the coherent window)",
            free >> 20,
            NEEDS_FOR_COHERENT_HEAPS >> 20
        );
        return RUNTIME_COMMITTED_CAP;
    }
    title.saturating_add(RUNTIME_COMMITTED_CAP).min(cap)
}

pub fn coherent_hint_for(windows: usize) -> usize {
    let cap = max_coherent_bytes(windows);
    if let Some(mb) = std::env::var("XCL_COHERENT_MB").ok().and_then(|v| v.parse::<usize>().ok()) {
        return (mb << 20).clamp(GRAIN, cap);
    }
    coherent_hint_from(&coherent_file(), free_commit(), cap)
}

pub fn coherent_hint() -> usize {
    coherent_hint_for(MAX_WINDOWS)
}

pub fn note_coherent_need(bytes: usize) {
    static NOTED: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
    let path = coherent_file();
    if NOTED.fetch_max(bytes, std::sync::atomic::Ordering::Relaxed) < bytes && record_coherent_need(&path, bytes) {
        let cap = max_coherent_bytes(configured_runtime_windows());
        crate::xlog_info!(
            "UMA: the title's graphics memory for the coherent window: {} MB (up to {} MB from the next run)",
            bytes >> 20,
            bytes.saturating_add(RUNTIME_COMMITTED_CAP).min(cap) >> 20
        );
    }
}

(Keep both runtime_layout_supports_eight_and_sixteen_heap_windows and
series_s_coherent_cache_is_separate_from_series_x in mod tests, passing MAX_SIZE as cap in
the latter.)

Checked by merging 2c4bcb5d onto main (8b957bec) and running cargo check --workspace --tests
(x86_64-pc-windows-gnu, 0 errors, 0 new warnings); no GPU, Wine or Windows run.

AI use: Antigravity (Gemini 4 Carbon High) adapted 2c4bcb5d to main's multi-window UMA layout
and compile-checked the tree; independently verified by Gemini 4 Hydrogen XHigh.

<!-- greyfinch-sync:ivall/xcl:comment:7197960767 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1110#issuecomment-7197960767). Originally posted by [safesearch77](https://github.com/safesearch77) on 2026-11-26T16:40:55Z. --- Reviewed `2c4bcb5d` (`#333` `uma_coherent_lockhart.txt` separation) and compile-verified a rebase onto `main` (`8b957bec`). One important adaptation for `main`'s 8/16-window `XCL_HEAP_WINDOWS=1` support in `crates/xcl/src/gpu/uma.rs`: - `main` replaced `MAX_SIZE` in `coherent_hint_for(windows)` and `note_coherent_need` with `let cap = max_coherent_bytes(windows);` (up to 5 or 13 coherent windows). Passing `cap: usize` into `coherent_hint_from(path: &Path, free: usize, cap: usize)` (`title.saturating_add( RUNTIME_COMMITTED_CAP).min(cap)`) instead of clamping to `MAX_SIZE` preserves multi-window sizing while keeping Series S and Series X caches separate. ```rust // Compile-verified conflict resolution in crates/xcl/src/gpu/uma.rs on 8b957bec: fn coherent_hint_from(path: &std::path::Path, free: usize, cap: usize) -> usize { let title = std::fs::read_to_string(path).ok().and_then(|s| s.trim().parse::<usize>().ok()).unwrap_or(0); if title > 0 && free < NEEDS_FOR_COHERENT_HEAPS { crate::xlog_warn!( "UMA: {} MB of commit free, under {} MB: the title's GPU heaps stay outside unified memory (a larger page file gives them the coherent window)", free >> 20, NEEDS_FOR_COHERENT_HEAPS >> 20 ); return RUNTIME_COMMITTED_CAP; } title.saturating_add(RUNTIME_COMMITTED_CAP).min(cap) } pub fn coherent_hint_for(windows: usize) -> usize { let cap = max_coherent_bytes(windows); if let Some(mb) = std::env::var("XCL_COHERENT_MB").ok().and_then(|v| v.parse::<usize>().ok()) { return (mb << 20).clamp(GRAIN, cap); } coherent_hint_from(&coherent_file(), free_commit(), cap) } pub fn coherent_hint() -> usize { coherent_hint_for(MAX_WINDOWS) } pub fn note_coherent_need(bytes: usize) { static NOTED: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0); let path = coherent_file(); if NOTED.fetch_max(bytes, std::sync::atomic::Ordering::Relaxed) < bytes && record_coherent_need(&path, bytes) { let cap = max_coherent_bytes(configured_runtime_windows()); crate::xlog_info!( "UMA: the title's graphics memory for the coherent window: {} MB (up to {} MB from the next run)", bytes >> 20, bytes.saturating_add(RUNTIME_COMMITTED_CAP).min(cap) >> 20 ); } } ``` (Keep both `runtime_layout_supports_eight_and_sixteen_heap_windows` and `series_s_coherent_cache_is_separate_from_series_x` in `mod tests`, passing `MAX_SIZE` as `cap` in the latter.) Checked by merging `2c4bcb5d` onto `main` (`8b957bec`) and running `cargo check --workspace --tests` (`x86_64-pc-windows-gnu`, 0 errors, 0 new warnings); no GPU, Wine or Windows run. AI use: Antigravity (Gemini 4 Carbon High) adapted `2c4bcb5d` to `main`'s multi-window UMA layout and compile-checked the tree; independently verified by Gemini 4 Hydrogen XHigh.

Pull request closed

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!1101
No description provided.