Skip to content

xcl run: report process memory under Wine - #1097

Open
Filip722 wants to merge 4 commits into
xcl-dev:mainfrom
Filip722:wine-activity-memory
Open

Filip722 wants to merge 4 commits into
xcl-dev:mainfrom
Filip722:wine-activity-memory

Conversation

@Filip722

@Filip722 Filip722 commented Nov 24, 2026 •

Copy link
Copy Markdown

On Linux Wine, XCL's activity log and smoke summary report 0 MB even while title memory use grows. The activity log now uses Wine's PagefileUsage estimate when PrivateUsage is missing and Wine identifies its host as Linux.

What is in it

  • Prefer PrivateUsage whenever the OS supplies it. Query the cached Wine host name to select the Linux fallback. The guest title-memory APIs retain their existing counter selection.
  • Cover both counter choices and the macOS reservation case. The CrossOver 26.3 report on this PR measured 50,169 MiB of virtual size after an 8 GiB reservation, with no change after committing and writing 1 GiB. That value is unsuitable for the activity log.
  • Document that the Linux fallback estimates anonymous resident memory and swap.

Tested

  • Intel Core 7 240H, NVIDIA GeForce RTX 5060 Laptop GPU (8 GB, driver 615.78.08), Bazzite 44 Testing F44.20261011, kernel 7.2.9-ogc2.1.fc44.x86_64. Windows MSVC release binaries cross-built with Rust 1.98.1. Proton Experimental 11.0-20261112 and vkd3d-proton 3.1 build 4522cc1a8b1347f+ with local compatibility changes.
  • A headless Windows probe running the changed code under Proton identified the host as Linux. After reserving 8 GiB, the estimate stayed at 2,912,256 bytes when 32 MiB was committed and left untouched. Writing those pages raised it by exactly 32 MiB. Releasing the allocation returned it to 2,912,256 bytes. PrivateUsage remained zero.
  • Built the Windows release workspace and all 19 test harnesses with Cargo xwin. Under Proton, --test-threads=4 --nocapture reported 970 passed, 6 failed, 45 ignored. The new counter-selection regression and the existing guest title-budget test both passed again in isolation.
  • The depth/UAV placement check failed with the same assertion on current clean main. The other five failures also occurred in the earlier baseline run on this setup. They cover Opus and XMA2 source-voice lifetime, the synthetic title's hidden-window and voice checks, PLS quota error reporting and GPU predication.
  • There were 25 explicit SKIPPED subcases across the harnesses. Eighteen required wave64, three used unsupported per-lane conversions or arithmetic, two needed the D3D12 debug layer, one needed heap windows and one needed driver-cache disabling. Optional retail test fixtures were unset.
  • Two 25-second offline title smokes with identical starting title data and independent fresh driver and DXIL caches. Main reported 0 MB across 371 frames. The updated PR reported an estimated peak of 4,165 MB across 408 frames. Both exited normally. PowerShell ran the repository smoke script with a Proton launcher wrapper.

Regression run

Main

xcl-smoke v1
commit: 689f2db477c3c062cf162649781640ef8a977c18
gpu: NVIDIA GeForce RTX 5060 Laptop GPU
title: bc4a7118
seconds: 25
exit: 0x0
frames shown: 371 (PresentX 371)
presents per 2 s (last 3): 26 26 1
device removals: 0
crashes: 0
peak commit: 0 MB

PR

xcl-smoke v1
commit: bdf09130d7b416823c1207e6df1e46cb70259c15
gpu: NVIDIA GeForce RTX 5060 Laptop GPU
title: bc4a7118
seconds: 25
exit: 0x0
frames shown: 408 (PresentX 408)
presents per 2 s (last 3): 4 21 61
device removals: 0
crashes: 0
peak commit: 4165 MB

Not tested

The updated head has not been run here on macOS or native Windows. The CrossOver numbers come from the tester's standalone probe on the previous PR head. The Linux title smoke covered startup.

AI use

OpenAI Codex with GPT-6.2-Sol high investigated the original Wine behavior and ran the original checks. OpenAI Codex with GPT-6.2-astra implemented the Linux host check, tested the revision and drafted this update.

Wine leaves PrivateUsage unset, which makes the activity log report zero process memory. Reuse the existing title-memory fallback to PagefileUsage so pressure is visible during a run.

Assisted-by: OpenAI Codex (GPT-6.2-Sol high)
@ezamelczyk

Copy link
Copy Markdown

Test report for 54221a0 (this PR's head) against main 47efa2e, on AMD RDNA4 under Linux. Your runs were on NVIDIA; this covers AMD / RADV.

Tested

Regression run (from smoke.sh under Wine)

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 9070 XT (RADV GFX1201)
title: game_dump
seconds: 60
exit: 0x0
frames shown: 10 (PresentX 14)
presents per 2 s (last 3): 0 0 1
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: 54221a06832467622d78af242796e4adf43414f8
gpu: AMD Radeon RX 9070 XT (RADV GFX1201)
title: game_dump
seconds: 60
exit: 0x0
frames shown: 12 (PresentX 15)
presents per 2 s (last 3): 0 1 0
device removals: 0
crashes: 0
peak commit: 6571 MB

An earlier pair of head runs gave 6243 MB. The first main run on a fresh data folder showed 603 frames. Later runs of both builds show 10–15, so the frame count depends on the title's saved state, not on this change.

Not tested

  • Windows. On Windows PrivateUsage is set, so the fallback is not used there.
  • Whether PagefileUsage under Wine tracks the commit charge as closely as PrivateUsage does on Windows. I only checked that it is non-zero and grows over the run (4277 → 6179 MB).

AI use

  • Claude Code (Claude Opus 5.5) set up the Wine environment, ran the builds, tests and smoke runs on this machine, and wrote this report. I checked the results.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…vall#1142, ivall#1150, ivall#1156, ivall#1182, ivall#1191, ivall#1195, ivall#1221

Integrate 10 high-impact open upstream PRs on top of upstream/main (930e8b4):
- ivall#1182: share video memory across render targets aliased onto one physical page (~1.85-2.1 GB VRAM saved)
- ivall#1142: declare tiled texture pools texture-only (D3D12_HEAP_FLAG_DENY_BUFFERS) for vkd3d-proton
- ivall#1097: report process memory under Wine via PagefileUsage fallback
- ivall#1078: bound BCPack record scratch memory to 2 KiB stack batches
- ivall#1150: convert console clear-value formats in CreatePlacedResource
- ivall#1156: release the interface returned by QueryInterface in class_for
- ivall#1139: check pointer alignment in is_adopted before dereferencing
- ivall#1195: skip ExecuteIndirect dispatch of untranslated console compute pipelines
- ivall#1191: VirtualProtect commits lazy pages in its range first
- ivall#1221: unmark lazy away mappings in FreeTitlePhysicalPages

Assisted-by: Antigravity (Google DeepMind)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…ll#1221, and updated Linux PRs

Update fork README for upstream/main 930e8b4 (BCPack BC1-BC7, XCL_PSO_WAIT_MS, low-VA ASLR < 2^40, alloc_pool, sparse tile parking/pool reuse, direct page moves, write-watch merge), newly integrated PRs (ivall#1078, ivall#1097, ivall#1139, ivall#1142, ivall#1150, ivall#1156, ivall#1182, ivall#1191, ivall#1195, ivall#1221), and updated Linux PRs (ivall#867, ivall#871, ivall#877).

Assisted-by: Antigravity (Google DeepMind)

@crastinator crastinator left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on RDNA2 under Proton: no new failures.

Tested (head 54221a0, merged onto main 930e8b4: no conflicts)

  • AMD Radeon RX 6700 XT (RDNA2, gfx1031, RADV NAVI22, Mesa 26.3.1), Ryzen 7 5700X, Linux 7.3.5 (CachyOS)
  • Proton Experimental 11.0-20261112's Wine, vkd3d-proton v3.1 + #257's patch (-Db_ndebug=true, dxil-spirv 53aac418 from #775), DXVK v3.1.1-209 dxgi, DXC 1.9.2609.5, libopus 1.5.2, XCL_REQUIRE_GPU=wave64,mesh (0 SKIPPED)
  • cross-built for x86_64-pc-windows-msvc (clang-cl / lld-link, xwin SDK 10.0.26100), Rust 1.99.1, debug
  • cargo test -p xcl --lib -- --test-threads=1 plus every integration test (--test '*' -- --test-threads=1), compared per test with the same runs on main 930e8b4. main here: 8 stable Wine-lane failures (#530 ×2, #676, #890 ×2, e2e, pls_quota #810, predication_e2e #1272). Separately, title_textures::{placed_title_textures_share_vram_and_preserve_pixels, transitions_apply_when_their_list_is_submitted} and vram::d32s8_targets… fail together in 2 of 5 main runs (the #718 family), so I do not count a pass of those as a fix either way.
  • PR: 743 passed, 8 failed, 41 ignored (main: 740 / 11 / 41, with the #718 flakes failing in that run). No test fails here that passes on main. The PR adds no test, so none of these runs exercise the Wine PrivateUsage = 0 path itself.

Not tested

  • Anything that needs game files: no XCL_SAMPLE_* was set, so the tests that read them (about 66) pass without running.
  • xcl run's activity log under Wine with a title (no game here), which is what the PR changes.

AI use

  • Claude Code (Claude Opus 5.5) merged, built and ran this and wrote the report; I checked the results.

@Lucasyudi

Lucasyudi commented Nov 24, 2026 •

Copy link
Copy Markdown

Update for bdf0913 (same Mac, same toolchain):

  • wine_get_host_version under CrossOver 26.3 returns sysname=Darwin release=27.2.0 (a plain probe that calls it the way util::linux_wine does), so linux_wine() is false here and the activity log keeps 0 MB on a Mac, as on main, instead of the virtual size. That is the behaviour the README line now describes.
  • cargo test -p xcl --lib filtered to activity_commit, title_memory_status and util::: 7 passed, 0 failed (activity_commit_uses_pagefile_only_when_allowed included). xcl.exe builds.
  • Still not measured: a memory: line from this build (the test title ends before the first tick here). The title-facing TitleMemoryStatus keeps the PagefileUsage fallback, so on a Mac a title still sees the virtual size there; you kept that on purpose and it is unchanged from main, so only a note.

Test report for 2ba567b (this PR's head) on macOS, since shortside noted on #258 that peak commit reads 0 MB in every Mac smoke block. On CrossOver for macOS the PagefileUsage fallback gives a number, but it is the process's virtual size, reservations included, not commit or resident memory. So on a Mac the figure moves from 0 MB to about 40 GB plus whatever XCL reserves.

Tested

  • Apple M4 Pro, macOS 27.2.1, CrossOver 26.3 (Wine 11.0), Rosetta 2. mingw-w64 (GCC 16.2.0) cross-build.

  • A plain probe (no XCL) calling K32GetProcessMemoryInfo with PROCESS_MEMORY_COUNTERS_EX, the call process_private_bytes makes, after each step, in MB:

    step WorkingSetSize PagefileUsage PrivateUsage
    start 14 41974 0
    VirtualAlloc reserve 8 GB 16 50169 0
    commit 1 GB of it, untouched 16 50169 0
    write the 1 GB 1040 50169 0
    release 16 41977 0

    PagefileUsage follows the reservation (+8 GB) and ignores commit and touch; WorkingSetSize follows the pages written. PeakPagefileUsage reads 0.

  • The PR build itself: cargo build --workspace at 2ba567b, then the test title with XCL_ACTIVITY=1 under CrossOver. It ends before the first 2 s activity tick on this host (the D3DMetal stop in macOS (Apple Silicon, CrossOver + D3DMetal): the newer retail game reaches its first-run menus at 30 fps #258), so I have no memory: line from the PR's own log; the numbers above are from the probe only.

What it means here: on Linux Wine the README line in this PR (anonymous resident memory and swap) matches what you measured. On macOS Wine it does not, and with the 125 % peak-commit rule in mind (#1103), a smoke pair on a Mac would compare virtual sizes. Either saying "Linux Wine" in the README line, or not taking PagefileUsage when it is far above the working set, would avoid that; your call, I haven't tried either.

Not tested: Linux, Windows, a retail title, the memory: line from this build on a Mac.

AI use: Claude Code with Claude Opus 5.5 (claude-opus-5-5) wrote the probe, ran it and drafted this report.

CrossOver on macOS includes uncommitted address space in PagefileUsage. Use that counter for activity reporting only when Wine identifies its host as Linux. Keep the guest title-memory API behavior.

Assisted-by: OpenAI Codex (GPT-6.2-astra)
@Filip722

Copy link
Copy Markdown
Author

Thanks for measuring the reserve, commit and touch steps on CrossOver. In bdf0913, the activity log uses the PagefileUsage fallback only when Wine reports Linux as its host. The regression test uses the 50,169 MiB reservation figure from your probe.

On Linux Proton, committing 32 MiB without touching it left the estimate unchanged. Writing all 32 MiB increased the estimate by exactly that amount. The RTX 5060 Laptop startup smoke reported 0 MB on main and a 4,165 MB estimated peak on the revised head, with both runs exiting normally. macOS validation of the revised head is still open.

OpenAI Codex with GPT-6.2-astra wrote and tested this follow-up.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants