Skip to content

D3D12.X: render targets on one physical page share its video memory - #1182

Open
3L1A5-1 wants to merge 1 commit into
xcl-dev:mainfrom
3L1A5-1:fix/vram-pages-by-physical-page
Open

3L1A5-1 wants to merge 1 commit into
xcl-dev:mainfrom
3L1A5-1:fix/vram-pages-by-physical-page

Conversation

@3L1A5-1

@3L1A5-1 3L1A5-1 commented Nov 24, 2026 •

Copy link
Copy Markdown

A retail game (retail title) maps one physical page under render targets at two addresses at once – aliasing targets that are never live together, which the console allows. kernelx keeps a page at one address (map_pages moves it), and vram::Pages keyed video memory by title address, so each alias got pages of its own. In the game's first 40 s, 422 render targets (2.1 GB) had their pages mapped under 276 other render targets (1.85 GB), and the game kept using both sets (barriers and views after the move). The duplicate cost 1.85 GB of video memory, and what the GPU wrote through one alias never showed in the other.

A GPU-owned texture's owned pages are now keyed by the physical page mapped at their address, else by the address as before. Sampled textures keep address keys. Part of #320 (8 GB cards) and #345.

What is in it

  • crates/xcl/src/hle/kernelx.rs: physical_pages(va, n): the physical page mapped away at each 64 KiB page (read-only, AWAY only).
  • crates/xcl/src/hle/d3d12x/vram.rs: page_key (PHYS_KEY | page for a page with a physical page, else the address), physical_pages_under (GPU-owned only, asked before PAGES is taken: kernelx takes AWAY and never PAGES), bind takes the physical pages and both its loops (counting the missing tiles, then taking them) use page_key, Target.gpu_owned so remap_if_unmapped keys the same way (it asks the physical pages with PAGES released, then takes it again); tiles_unaccounted_for (test only).
  • crates/xcl/src/hle/d3d12x/title_textures.rs: GPU test render_targets_on_one_physical_page_share_its_video_memory.

Tested

  • NVIDIA GeForce RTX 2060 SUPER 8 GB, driver 617.14; Intel i5-9400F; 16 GB RAM; Windows 11 build 26300; Rust 1.100.0 stable-x86_64-pc-windows-msvc; tests debug, smoke release.
  • Rebased onto main 1a0bbe3 (after D3D12.X: eliminate multi-heap UpdateTileMappings and per-texture Signal stalls in vram::Pages #1747 changed Pages::bind and place_on_pages locking, and D3D12.X: reclaim empty 64 MiB VRAM pool heaps, alias GPU mirror pages, and sync 2048x128 glyph atlases #1985 added canonical_va before place_on_pages asks the physical pages; they are still asked before PAGES is taken). My first rebase (efedeea) left D3D12.X: eliminate multi-heap UpdateTileMappings and per-texture Signal stalls in vram::Pages #1747's new counting loop in bind on address keys: a tile leaked, or bind aborted, when the two keys differed (found by @pvfreis, @veyn-sudo, @thehollowedone). Fixed since 5fa6950.
  • cargo build --workspace then cargo test --workspace --no-fail-fast -- --test-threads=4 on de4d1f6: 1251 passed, 0 failed, 46 ignored
  • SKIPPED on this adapter: no wave64 (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, four lower::tests and the wave64 cases of the lower_dxil programs), the per-lane form refused for some f16/f32 cases, heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (needs Developer Mode)
  • New test: two render targets on one physical page take one 64 KiB page, one on another physical page a page of its own, no pool tile is lost, and a target placed before a page was mapped at its address does not stop a second one after. Without the change (page_key returning the address) it fails: left: 131072, right: 65536. With only bind's counting loop on address keys, it aborts at vram.rs:601 (0xC0000409), and without that case it fails with left: 2, right: 0 (tiles lost). It skips below resource heap tier 2, where vram::place keeps no target on pages (Intel Arc, @JJAutoCompare), and takes its locks poison-tolerantly (@thiagocalile).
  • Retail title 1.0.2.1, 90 s at the menus (no input), 3 runs each, measured before the rebase (main 67a3735 vs this change on it):
main this change
target pages (MB) 3597 / 3596 / 3596 1738 / 1740 / 1721
local video memory (MB) 6651 / 6652 / 6652 4796 / 4794 / 4658
frames 499 / 576 / 491 496 / 645 / 541

Regression run

xcl-smoke v1
commit: 689f2db477c3c062cf162649781640ef8a977c18
gpu: NVIDIA GeForce RTX 2060 SUPER
title: 5c554abc
seconds: 60
exit: 0x0
frames shown: 1432 (PresentX 1432)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15592 MB
xcl-smoke v1
commit: de4d1f676146ac58b4c11037bed9d0c1b5789d0c
gpu: NVIDIA GeForce RTX 2060 SUPER
title: 5c554abc
seconds: 60
exit: 0x0
frames shown: 1245 (PresentX 1245)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13444 MB

Not tested

  • AMD and Intel GPUs; Series S profile; other titles than the retail title (the change only affects GPU-owned textures on pages mapped with MapTitlePhysicalPages).
  • Visual comparison of the aliased targets in game (they now share content, as on the console).
  • A physical page mapped at its own home (MapTitlePhysicalPages(NULL, …)): kernelx::physical_pages reports only pages mapped away, so a target at the home stays keyed by its address and an alias elsewhere gets a page of its own, as on main (@Filip722 found this and has a fix on top of this PR).

AI use

  • Claude Code, Claude Opus 5.5: found the aliasing with local diagnostics (not in this PR), wrote the change, the test and this description, and ran the builds, tests and game runs above on my PC.

🤖 Generated with Claude Code

@towiice towiice 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:

  • Hardware: NVIDIA GeForce GTX 1650 SUPER (Turing TU116, 4 GB VRAM, wave32, driver 610.88), Windows 11 x64 (26H2 / build 26300), DXC v1.9.2609 (01b62ad4), toolchain stable-x86_64-pc-windows-gnullvm (llvm-mingw 23.1.6), debug build.
  • cargo test -p xcl --lib hle::d3d12x::vram -- --test-threads=1: 9 passed, 0 failed.
  • cargo test -p xcl --lib hle::d3d12x::title_textures -- --test-threads=1: 14 passed, 0 failed (3.50 s), including the new render_targets_on_one_physical_page_share_its_video_memory and placed_title_textures_share_vram_and_preserve_pixels.

Verified cleanly on 4 GB VRAM Turing hardware with zero regressions.

Not tested: full workspace suite, release builds, retail titles (smoke.ps1).

@DavidM1911

Copy link
Copy Markdown
Contributor

Independent verification on current main 384f7f7 (branch already contains it — clean).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

@Aniseto

Aniseto commented Nov 24, 2026

Copy link
Copy Markdown

Ran the new test and the title_textures module at 0cf6d08:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=nvidia cargo test -p xcl --lib render_targets_on_one_physical_page
1 passed; 0 failed; 0 ignored      (exit 0)

XCL_ADAPTER=nvidia cargo test -p xcl --lib title_textures::tests -- --test-threads=1
14 passed; 0 failed; 0 ignored     (exit 0)

render_targets_on_one_physical_page_share_its_video_memory passes on this GPU and the rest of the module is unaffected. This adds a Blackwell part with driver 32.0.16.2124 on Windows 11 build 26200 to the author's RTX 2060 SUPER run.

Not tested: retail titles, RDNA2/RDNA4 and Intel GPUs, Wine, release profile.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified.

@bjarngard

Copy link
Copy Markdown

Test report for head 0cf6d08 (AMD)

Tested

  • AMD Radeon(TM) Graphics (Ryzen 9 9950X iGPU, RDNA2, native wave64), driver 32.0.21043.5001; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no SKIPPED
  • render_targets_on_one_physical_page_share_its_video_memory passed when run alone on the AMD adapter

Not tested: retail titles (no smoke run), RDNA3/RDNA4.

AI use: the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.

@JoaoPauluu

Copy link
Copy Markdown

A regression run under Wine on Linux, on a retail title.

Tested

Regression run

main (first run):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1384 (PresentX 1384)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: 0cf6d08ef227c5544b22ddae7734a15991b5ad46
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1439 (PresentX 1439)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The last main run: 1425 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head; native Windows; AMD.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.

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
…ps (ivall#594)

Re-apply XCL_PAGE_BUDGET_MB LRU texture eviction (ivall#640) and fenced unmaps (ivall#594) on top of upstream/main (930e8b4) + ivall#1182/ivall#1142/ivall#800, using real::create_raw_fence for vram queue fences under Wine.

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)
@Rodriguerra

Copy link
Copy Markdown

Confirmed on NVIDIA GeForce RTX 3060 12 GB (Windows 11 26200, driver 32.0.16.1088) on a retail title:

  • target pages dropped from 7,514 MB -> 5,403 MB (-2,111 MB saved before world entry).
  • Local VRAM before 3D world entry dropped accordingly (~9.0 GB vs ~11+ GB previously).

@grahamster2

Copy link
Copy Markdown
Collaborator

Test report on the retail title, on a 10 GB card. #1182 and #1248 were tested together, in one build. The savings below are for both combined, not split between them.

Builds

Setup: RTX 3080 10 GB (driver 610.88), Ryzen 5 7600X, 32 GB RAM, Windows 11 26200. Settings: XCL_NETWORK=0, XCL_PSO_PRELOAD=0, XCL_PSO_WAIT_MS=50. A pressed at 14, 17, 21, 25 and 31 s. Warm DXIL and driver blob caches. One run each. Both runs were stopped at about 100 s by my free-RAM guard (under 0.5 GB of RAM available).

Tested

From the XCL_ACTIVITY memory line. RAM available is GlobalMemoryStatusEx ullAvailPhys.

without with
target pages at 58 s 8641 MB (pools 8960) 6733 MB (pools 6924)
target pages at 74 s 9672 MB (pools 10176) 7081 MB (pools 7628)
video memory local at 74 s 14340 MB 11971 MB
video memory non-local at 74 s 4904 MB 4911 MB
physical RAM available at ~75 s 1994 MB 3175 MB
physical RAM available at ~66 s 4285 MB 3782 MB
device removals / crashes 0 / 0 0 / 0
  • What was saved: about 2.6 GB of target pages, 2.5 GB of pools and 2.4 GB of local video memory, after world start. That matches the 1.85 GB + 768 MiB estimated in the two PRs.
  • Physical RAM: the curves cross. The build with the PRs dips earlier (66 s), then levels off higher (3.2 GB vs 2.0 GB at 75 s).
  • The frame:
    • In the last frame I dumped (about 92 s), two 2560x1440 targets that were all zero in the runs without the PRs now have data: an R32G32 target (172 088 of 230 400 sampled texels non-zero) and an R16G16 target (230 332 of 230 400).
    • The frame had 2228 draws and dispatches, against 1293 in an earlier run without the PRs. That earlier run had 3 workers (XCL_DXC_THREADS=3) and preload on, so this comparison is loose.
    • The world is still black on this card. The G-buffer colour targets stay zero for a reason outside these PRs: large uncached pipeline builds that never finish.

Not tested

  • Each PR on its own: the savings are not split between them.
  • More than one run per build.
  • Cards with more or less than 10 GB, AMD and Wine.
  • Whether the aliased render targets now hold what the title wrote through the other alias. I only counted memory and non-zero texels.

Test report written with Claude Code (Claude Opus 5.5) from my own runs; the extra logging is local only.

@madaraXor

Copy link
Copy Markdown
Contributor

Retail title on a 12 GB RDNA2 card: local video memory stays under the card with this PR (and #1248)

Setup: AMD Radeon RX 6700 XT 12 GB (RDNA2), driver 32.0.21045.29003, Ryzen 5 5600X, 16 GB RAM, Windows 10 Pro 22H2 (19045.6466), Agility SDK 1.620.2, Rust 1.90.0, release. Retail title 1.0.2.1, device_type = "lockhart", XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_PRELOAD=0 XCL_PSO_WAIT_MS=50 XCL_DXC_THREADS=3, the same XCL_PRESS_AT sequence into the story start in both runs.

Two runs of the same tree, main 930e8b4 + #684 + #615 + #495 + #1291 + #1288 + #1315/#1316 and a local eh.rs change, without and with this PR's head 0cf6d08ef and #1248's head 787700174 merged (I did not run them apart, so the split between the two is not known). From XCL_ACTIVITY:

s without: local / target pages / commit with: local / target pages / commit
280 8 590 / 2 942 / 20 634 MB 6 730 / 1 093 / 18 761 MB
404 8 663 / 2 999 / 21 060 MB 6 670 / 1 351 / 19 062 MB
528 10 081 / 4 516 / 22 736 MB 9 747 / 4 323 / 22 399 MB
~600 12 004 / 6 432 / 24 817 MB 11 730 / 4 870 / 27 110 MB
643–650 13 602 / 6 641 / 39 204 MB 11 738 / – / 25 823 MB

Without them local video memory went past the card (13.6 GB at 650 s, the card has 12.2 GB) and that run ended at 658 s in amdxc64.dll (a null read while the driver compiled compute pipelines). With them it peaked at 10.9–12.1 GB in this run and four later ones (same PRs, later local changes), under the card's memory. The sparse pools did not change (4.4–4.8 GB in both).

Not tested: the two PRs apart; NVIDIA; whether anything renders differently (the title is still on its loading screen at that point here).

AI use: Claude Code, Claude Opus 5.5 ran the builds and runs on my PC and wrote this report. Counts, times and sizes only.

@thiagocalile

Copy link
Copy Markdown

Tested commit efedeeacc69838e6702e1127b6ebf55097b44437 on an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native 64-lane waves) with targeted/workspace tests and a 60 s scripts/smoke.ps1 regression run (comparing against main 62265d3).

Tested

  • Hardware: AMD Radeon RX 6600 (8146 MiB VRAM, RDNA2, native wave64 + mesh shaders, driver 32.0.21045.29003; XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.8.2502.11.
  • XCL_ADAPTER=radeon cargo test -p xcl --lib vram::tests -- --test-threads=4: 10 passed, 0 failed, 1 ignored (38.74s).
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 971 passed, 5 failed, 45 ignored (91.43s).
    • Failures: the 3 pre-existing RX 6600 main failures (D3D12.X: map and unmap 3D texture mips separately #1028), render_targets_on_one_physical_page_share_its_video_memory hitting the same VRAM_TEST_LOCK poison cascade in the workspace run (it passed in targeted vram::tests: 10/0), plus gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (known AMD Windows driver 32.0.21045.29003 miscompile).
    • SKIPPED (not counted as coverage): gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::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)); gpu::recomp::lower_dxil::tests::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)); gpu::recomp::lower_dxil::tests::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)); gpu::recomp::lower_dxil::tests::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; shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): O aplicativo solicitou uma operação que depende de um componente SDK que está ausente ou é incompatível. (0x887A002D) (plus D3D12 debug-layer tests skip because d3d12SDKLayers.dll is not installed).

Regression run (scripts/smoke.ps1, 60 s, release build, XCL_ADAPTER=radeon)

Base (main 62265d3):

xcl-smoke v1
commit: 62265d3bbde2255f849fb650cc29872df91a4cf0
gpu: AMD Radeon RX 6600
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1517 (PresentX 1517)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13034 MB

PR (efedeea):

xcl-smoke v1
commit: efedeeacc69838e6702e1127b6ebf55097b44437
gpu: AMD Radeon RX 6600
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1483 (PresentX 1483)
presents per 2 s (last 3): 60 57 28
device removals: 0
crashes: 0
peak commit: 15846 MB

Not tested

  • D3D12 debug layer, NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Antigravity (Gemini 4 Neon) ran the test suites and scripts/smoke.ps1 runs on my RX 6600 and drafted this report; I checked the output before posting.

@JJAutoCompare

Copy link
Copy Markdown

Empirical test report for PR #1182 on Intel Arc A770 (STOR-WINLAB).

  • PR head tested: efedeeacc69838e6702e1127b6ebf55097b44437
  • origin/main: 5796cc467d80e3dac5d7d231ec34f1b0bebce169
  • Mergeability (git merge-tree --write-tree origin/main HEAD): clean (exit 0, tree 4eca6b8f6f8724f0c37c8949ba819632681c8949)

PR-specific finding (Resource Heap Tier 1 / Intel Arc A770)

The new test hle::d3d12x::title_textures::tests::render_targets_on_one_physical_page_share_its_video_memory fails on Intel Arc A770:

  • Panic: crates\xcl\src\hle\d3d12x\title_textures.rs:1691:17: expected a vram::Pages target at 0x...
  • Cause: vram::place() (crates/xcl/src/hle/d3d12x/vram.rs:902-905, 934) returns None when !tier2(dev) (D3D12_FEATURE_DATA_D3D12_OPTIONS::ResourceHeapTier < 2), so create_placed_resource_x falls back to a committed resource + title_textures::register (observed log: xcl: D3D12.X: a small render target at ... (2 planes) is kept in step with the title's memory – a glyph cache the CPU fills). Unlike placed_title_textures_share_vram_and_preserve_pixels (title_textures.rs:1751) and d32s8_targets_take_their_own_size_of_video_memory (vram.rs:1260), the new test's guard (title_textures.rs:1674-1678) checks opts.TiledResourcesTier.0 < D3D12_TILED_RESOURCES_TIER_2.0 but omits opts.ResourceHeapTier.0 < 2.
  • Cascading failures in xcl --lib: Because the test panics while holding VRAM_TEST_LOCK and title_textures::TEST_LOCK, both mutexes are poisoned and cause two other tests in the same binary to fail with PoisonError:
    • hle::d3d12x::title_textures::tests::transitions_apply_when_their_list_is_submitted (title_textures.rs:1471:39)
    • hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory (vram.rs:1247:49)
      Both pass when run without the poisoned lock (note d32s8_targets_take_their_own_size_of_video_memory returns early on ResourceHeapTier < 2).

Tested

  • Hardware & environment:
    • GPU: Intel(R) Arc(TM) A770 Graphics (XCL_ADAPTER=A770), driver 32.0.101.9175 (2026-11-04)
    • CPU: AMD Ryzen 7 3800X 8-Core Processor
    • Windows build: Microsoft Windows 11 Enterprise Evaluation 10.0.26200.9974
    • Rust: rustc 1.100.0 (0ef1bc386 2026-11-09) / cargo 1.100.0 (3acc79c0c 2026-11-05), debug (dev/test) profile
    • DXC: dxcompiler.dll: 1.9(5512-01b62ad4)(1.9.2609.5) - 1.9.2609.5 (01b62ad47)
  • Build:
    • cargo test --workspace --no-run: passed (exit 0)
    • cargo build --workspace: passed (exit 0)
  • PR-targeted runs:
    • cargo test -p xcl --lib hle::d3d12x::title_textures -- --test-threads=4 --show-output: 13 passed, 1 failed, 0 ignored (1 SKIPPED: placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2; failed: render_targets_on_one_physical_page_share_its_video_memory)
    • cargo test -p xcl --lib hle::d3d12x::vram -- --test-threads=4 --show-output: 10 passed, 0 failed, 1 ignored (churn_update_tile_mappings_timing ignored; d32s8_targets_take_their_own_size_of_video_memory returns early silently on ResourceHeapTier < 2)
    • cargo test -p xcl --lib hle::kernelx -- --test-threads=4 --show-output: 35 passed, 0 failed, 1 ignored (scatter_timing ignored)
  • Full workspace suite:
    • cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output: 948 passed, 28 failed, 45 ignored across all 20 workspace test targets (skipped GPU tests below are not counted as coverage):
      • xcl --lib: 900 passed, 27 failed, 25 ignored
        • 3 PR-induced failures: hle::d3d12x::title_textures::tests::render_targets_on_one_physical_page_share_its_video_memory, plus lock-poisoning cascades in hle::d3d12x::title_textures::tests::transitions_apply_when_their_list_is_submitted and hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory
        • 24 unrelated Arc A770 baseline gpu::* failures: 20 CreateComputePipelineState: The parameter is incorrect. (0x80070057) (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0,1,2,3}, gpu::dxil::ops_tests::{doubles_match_cpu,groupshared_barrier_and_atomics_run}, gpu::dxil::round_tests::{gpu_direct_f32_round_modes_dynamic_and_denormals,gpu_direct_f32_round_modes_static}, gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu, gpu::recomp::tests::{gpu_clamp_and_omod_per_instruction,gpu_f64_class_compare,gpu_f64_compares_with_nan,gpu_f64_literal_high_word,gpu_f64_math_random,gpu_f64_roots,gpu_f64_rounding_and_conversions,gpu_float_compares_random,gpu_frexp_f64_exp_and_mant,gpu_ldexp_f64,gpu_rndne_f64}) and 4 shader-semantics mismatches (gpu::recomp::tests::{gpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_ps_image_sample_offset_implicit_lod_between_mips,gpu_valu_16_and_64_bit,gpu_wave64_ps_whole_wave_reductions})
      • tests/e2e.rs: 2 passed, 1 failed, 0 ignored — unrelated Arc A770 baseline failure in test_title_runs_and_game_folder_is_untouched ([FAIL] D3D12.X: dynamic depth bias via RSSetDepthBiasX (#94): top-right [0, 0, 255, 255] (expected green: RSSetDepthBiasX(-1000.5) passes depth test))
      • Remaining 18 test targets (bcpack_parity, console_dlls_e2e, console_shaders, disasm_e2e, gpu_compute_e2e, gpu_pso_e2e, heap_probe, low_va, pls_quota, predication_e2e, rpf_e2e, shaders_e2e, sparse_reinit, texture_states, xg_oracle, xcl bin, xcl-testtitle bin, doc-tests): 46 passed, 0 failed, 20 ignored
  • SKIPPED GPU tests (25 SKIPPED lines across 15 tests — not counted as coverage):
    • SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::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))
    • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::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))
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
    • SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
    • SKIPPED shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)
    • SKIPPED placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2
    • SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll
    • SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
    • SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))

Not tested

  • D3D12 Resource Heap Tier 2 GPUs (e.g. AMD RDNA / NVIDIA), where vram::place() / vram::Pages exercises the shared physical-page video-memory path implemented in this PR.
  • Wave64-capable GPUs (all wave64 checks skipped on Arc A770).
  • D3D12 debug layer and Windows Developer Mode tests (no d3d12SDKLayers.dll / 0x887A002D).
  • Retail game titles / scripts/smoke.ps1 regression run.
  • Release profile builds.

AI use

@pvfreis pvfreis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review of efedeea merged onto main 656c0e8 (clean on 8f5fca5, same lines).

CONFIRMED (run): Pages::bind counts missing tiles by address, then takes them by page_key. vram.rs:568 looks up first + i * PAGE; :593 uses page_key(..), :601 fresh_iter.next().unwrap() (same lines at the head and merged). main uses the address in both (read). With a page mapped away the keys differ. It came with the rebase onto #1747: 0cf6d08 took tiles one at a time (take_tile), so the reports on 0cf6d08 don't cover it; the two posted 60 s smokes of efedeea show no crash.

  1. Physical key present, address key absent: the tile taken is lost. A second target on a physical page that already has a tile is this case too, so it is the PR's own case (read). 1100 placements of a one-page target at one mapped address, our test: (pools, accounted): before (1024, 1023) after (2048, 947), 1 tile each. (1 was already lost before the loop, so the first assert fires; with the line below none is lost, before or after.)
  2. Address key present, physical key absent: the process aborts. Two ways, in child processes; one:
let first = place(a, &rt);   // reserved, no page mapped
map();                       // MapTitlePhysicalPages: one page at `a`
let second = place(a, &rt);  // aborts

The other: map(), a sampled texture at a, place(a, &rt). Both:

panicked at crates\xcl\src\hle\d3d12x\vram.rs:601:51:
called `Option::unwrap()` on a `None` value
panic in a function that cannot unwind

Exit 0xC0000409.

Our three tests pass with:

-                self.pages.get(&(first + i * PAGE)).map(|p| p.tile.0)
+                self.pages.get(&page_key(first + i * PAGE, phys.get(i).copied().flatten())).map(|p| p.tile.0)

cargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4, debug, RTX 3060, one run each, passed / failed / ignored: main 1061 / 1 / 45; merged 1062 / 1 / 45; plus our tests 1062 / 4 / 47; plus the line 1065 / 1 / 47. The shared failure is the e2e title test. The PR's test passes in our three merged runs. Tests on request.

Not tested: a retail title (does it reach the abort?), AMD, our tests on main.

Review by Claude Code (Claude Opus 5.5), checked with Claude Fable 5.2; each point checked by a person before posting.

@iggyvilla

Copy link
Copy Markdown
Collaborator

Test report for #1182 (tested at head 0cf6d08; the PR head has since moved to efedeea, not retested) on RDNA2, a retail title.

Measured by an agent (omp, DeepSeek V4.1 Flash); I (Claude Code, Claude Sonnet 5.5) re-read the run logs, checked
the numbers below against them and wrote this. Measurement only, no code change; the test suite was not run.

  • Hardware: Radeon RX 6650 XT 8 GB (RDNA2), Ryzen 7 5700X, 32 GB RAM, Windows 10.0.26300, release build,
    retail title 7952987A (not included here).
  • Trees: origin/main b7aa9f3 + D3D12.X: compute pipelines are built ahead of their first bind #889 (e1d3b9d) + kernelx: Sleep does not count the time a bind waits for a pipeline build #1288 (95299f4) as control, and the same plus this PR.
    A 300 s scripted walk (XCL_PRESS_AT gamepad presses) from a save past first-run setup, XCL_ACTIVITY=1 XCL_DXC_THREADS=4 XCL_NETWORK=0.
    One run each. Both walks reached the loading art
    (screenshots checked), neither drew the world.
  • At equal DirectStorage progress (10k requests, in the menus): target pages 3,607 -> 1,748 MB, local
    video memory 6,343 -> 4,487 MB. At the world load: peak pages 9,728 -> 7,806 MB, peak local
    15,057 -> 13,202 MB. This reproduces the PR's claim on this card.
  • Unchanged: last present at 140 s in both, no crash, no device removal, process alive at 300 s. Peak
    process commit is the same (37,601 vs 37,551 MB). 0x8007000e appears in neither log, so the PR's
    "CreateHeap OOM instead of +0x23cf683" difference cannot be seen on this walk.
  • A second control run of the base tree shows a process-commit climb of about
    1 GB/s from ~280 s (34 GB -> 71 GB by 308 s) that XCL's page/pool counters do not show. The runs of this
    PR did not climb, but that climb is not caused by this PR: it also happens without it.

Not tested

AI use: an agent (omp, DeepSeek V4.1 Flash) ran and measured; Claude Code, Claude Sonnet 5.5 verified and wrote this report.

@veyn-sudo

Copy link
Copy Markdown

On efedeea, bind counts the tiles it needs by address and then looks the pages up by page_key. Since #1747 the tiles are taken from the pool up front, so the two don't match:

  • a page shared through its physical page is counted as missing: a tile is taken, not used and not given back;
  • an address that has a page while its physical page has none is counted as there: fresh_iter.next().unwrap() would panic.

Test: in render_targets_on_one_physical_page_share_its_video_memory, placing at b again and dropping it must leave the pool's spare tiles unchanged. Without a fix it fails in the first round (1021 instead of 1022). It passes with page_key in both loops and return_tiles for the rest of fresh. I only read the panic case in the code.

With that fix, one run each on a retail title at 154 s: target pages 5,681 → 3,832 MB, local video memory 10,288 → 8,534 MB.

Tested: RTX 2070 SUPER (driver 617.14), Windows 11 26300, debug for the test, release for the title; ported onto a local tree with other changes, so not your branch as it is. Full suite there, before I added the check above: 1175 passed, 0 failed, 46 ignored.

AI use: Claude Code (Claude Opus 5.5) found this, wrote and ran the test, and wrote this.

@thehollowedone

thehollowedone commented Nov 25, 2026 •

Copy link
Copy Markdown

I reproduced both tile-counting cases on efedeeac, following veyn-sudo’s review.

  • Placing and dropping another target on an already shared physical page consumed one unused tile. Free tiles fell from 1,022 to 1,021.
  • Holding a target created before a physical page was mapped, then mapping a physical page at the same address and placing a second target, reproduced the predicted fresh_iter.next().unwrap() panic in Pages::bind. The first target still held the virtual-address entry while the second needed a new physical-page entry.

I tested a local correction that uses the same page_key(first + i * PAGE, phys.get(i).copied().flatten()) lookup to count and consume tiles, then returns fresh_iter.as_slice() to the pool before mapping. Both focused cases passed and the vram::tests group had 10 passed, 0 failed, 1 ignored and zero runtime skips. I extended render_targets_on_one_physical_page_share_its_video_memory for the focused cases and ran each in a fresh process.

Windows 11 build 26300, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug. Synthetic placement and allocator coverage. GPU pixel readback, retail and the workspace suite are outside this report. AI use: OpenAI Codex (GPT-6) wrote the test changes and local correction, ran the comparison, and drafted this report.

GPU pixel follow-up. I added physical_render_target_alias_preserves_gpu_pixels to exercise GPU writes. Two 128×128 RGBA8 render targets shared one title physical page. I cleared one target after an aliasing barrier, returned both aliases to COMMON before switching, then read through the other target. All 16,384 pixels carried the new color. All 16,384 pixels in a third target on a different page retained its original color. The fixture passed twice on the published efedeeac runtime and twice with the local allocator correction, with zero D3D12 error or corruption messages, device removals or skips. Same Windows and GPU setup as above. Codex wrote and ran this synthetic readback fixture.

Recheck on 5fa6950. On the same Windows and RTX 3080 Ti setup, cargo test --offline --locked -p xcl --lib render_targets_on_one_physical_page_share_its_video_memory -j 3 -- --nocapture --test-threads=1 passed 1/1 on the clean PR, with zero ignores or runtime skips. I then applied only the synthetic readback fixture above. The exact fixture passed 1/1, with 16,384/16,384 expected pixels through the alias and 16,384/16,384 in the separate-page control. Graphics Tools reported zero D3D12 errors. This recheck covers distinct virtual addresses sharing the same physical page, with explicit aliasing barriers. Home-address identity and retail behavior were outside this recheck. Codex (GPT-6.2 Sol) ran both tests and drafted this update.

IvyNotFound added a commit to IvyNotFound/xcl that referenced this pull request Nov 25, 2026
# Conflicts:
#	crates/xcl/src/hle/d3d12x/vram.rs
@Filip722

Filip722 commented Nov 25, 2026 •

Copy link
Copy Markdown

I reproduced a second render-target alias case on an RTX 5060 Laptop GPU. If the first target uses the home address returned by MapTitlePhysicalPages(NULL, …), a second target at a chosen address for that physical page reads stale pixels. Both targets remained alive during this test.

Patterned 128×128 RGBA8 readback PR head efedeea + test fixture With home mapping fix
Home → second address 0 / 16,384 16,384 / 16,384
Second address → home 0 / 16,384 16,384 / 16,384
Direct writes and independent page, each 16,384 / 16,384 16,384 / 16,384

The cherry-pickable fix and tests are directly on this PR's head. They track explicitly mapped homes, preserve the existing owner when another page occupies the address, and clear the recorded identity on unmap or free. The GPU test uses fenced aliasing barriers in COMMON and reads both textures back. The separate spare-tile accounting change discussed above is independent.

Bazzite 44.20261011.0, Intel Core 7 240H, RTX 5060 Laptop 8 GB, NVIDIA 615.78.08, Proton Experimental 11.0-20261112, vkd3d-proton 3.1.0 (4522cc1a8b1347f+). Cross-built with Rust 1.98.1 using cargo xwin test --release --locked --target x86_64-pc-windows-msvc -p xcl --lib --no-run. Under Proton I ran each Windows test by exact name with --test-threads=1 --nocapture. Both new tests failed on the test-only control 5763f5a. On d3887f2 the GPU readback and mapping lifecycle tests passed, as did the existing tile-sharing test and seven adjacent kernel mapping tests. No reported skips. These measurements establish the synthetic pixel result. Retail use of this particular mapping sequence remains unverified.

I also ran one offline Series X comparison per build with independent copies of the same prefix and shader caches. At frames 20, 116 and 212 the native present-source readbacks were black in both builds (0 of 518,400 sampled pixels above black per readback). The fixed build also sampled black at frames 308 and 404. All 15 control and 19 patched window captures were black. The external host-memory guard ended the runs at 6,068 and 5,994 MiB available, respectively. This pair did not verify a visible retail improvement.

OpenAI Codex (GPT-6.2-Sol, high) wrote the patch and tests, ran them on this laptop, and prepared this report.

IvyNotFound added a commit to IvyNotFound/xcl that referenced this pull request Nov 25, 2026
xcl-dev#1182 keys owned pages by their physical page, but the count of tiles to take (from the
xcl-dev#1985/xcl-dev#1663 batch code) still looked pages up by address: a page already shared through its
physical page was counted as missing, and a new one not, so fresh_iter ran dry and the
title aborted at vram.rs:789 in the first XCLM run (49 s, menus).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thehollowedone

thehollowedone commented Nov 25, 2026 •

Copy link
Copy Markdown

Independent native Windows GPU check of d3887f26. Windows 11 build 26300, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug.

Tested

  • cargo test --offline --locked -p xcl --lib render_target_at_physical_page_home_inherits_texels_after_move -j 3 -- --exact hle::d3d12x::title_textures::tests::render_target_at_physical_page_home_inherits_texels_after_move --nocapture --test-threads=1 passed 1/1. Both alias directions matched 16,384/16,384 pixels. Direct writes and the independent texture matched 16,384/16,384 each. The fixture printed RTX 3080 Ti.
  • With only kernelx.rs restored from PR head efedeeac, the same fixture failed 0/1. Both alias directions matched 0/16,384 pixels. Direct writes and the independent texture still matched 16,384/16,384 each.
  • hle::kernelx::tests::mapped_home_page_identity_follows_moves_and_partial_frees passed 1/1 on the candidate.

Combined follow-up
I applied the tile-counting correction described earlier to d3887f26 in a disposable checkout. On the same RTX 3080 Ti, the home mapping lifecycle test and bidirectional GPU pixel test passed 1/1 each. The extended render_targets_on_one_physical_page_share_its_video_memory test also passed 1/1 in each of two fresh processes, first with XCL_TEST_REKEY_RT unset and then set to 1. The repeated physical alias retained the same spare tile count, and the address-to-physical-key transition completed without the allocation panic. All four focused runs had zero failures, ignores, or runtime skips. This combined check is synthetic and does not replace a full suite or title regression run.

Not tested
Workspace suite, retail title, AMD, or D3D12 debug-layer validation. The separate tile-counting issue in Pages::bind remains.

AI use
Codex (GPT-6, exact variant unavailable) ran the tests and drafted this report.

@3L1A5-1
3L1A5-1 force-pushed the fix/vram-pages-by-physical-page branch from efedeea to 5fa6950 Compare November 25, 2026 07:23
@3L1A5-1

3L1A5-1 commented Nov 25, 2026

Copy link
Copy Markdown
Author

Thanks, everyone. Pushed 5fa6950, rebased onto the same main 689f2db:

  • bind counting by address (@pvfreis, @veyn-sudo, @thehollowedone): confirmed. It came in with my rebase onto D3D12.X: eliminate multi-heap UpdateTileMappings and per-texture Signal stalls in vram::Pages #1747: I moved the loop that takes the tiles to page_key and missed the new loop that counts them first. Both loops now use page_key. With that, the count matches what the second loop takes, so nothing is left over in fresh, and I left out returning the remainder. The PR's test now also checks that no pool tile is lost (vram::tiles_unaccounted_for) and places a target before a page is mapped at its address, then a second one after. With the counting loop back on address keys it aborts at vram.rs:601 (0xC0000409), and without that case it fails with 2 tiles lost.
  • Intel Arc (@JJAutoCompare): the test now skips below resource heap tier 2, as its neighbours do, since vram::place keeps no target on pages there.
  • RX 6600 lock poisoning (@thiagocalile): the test takes VRAM_TEST_LOCK and TEST_LOCK poison-tolerantly now. Other tests in title_textures.rs still unwrap() them (e.g. gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes, placed_title_textures_share_vram_and_preserve_pixels, and transitions_apply_when_their_list_is_submitted for TEST_LOCK); I left those alone here.
  • @iggyvilla: thanks for the RDNA2 run. It was on 0cf6d08, before the rebase, so it doesn't cover the counting bug.
  • A page mapped at its own home (@Filip722): right, physical_pages only knows pages mapped away, so a target at the home stays address-keyed. That is what main does for every alias, so this PR leaves the case as it was rather than breaking it. Your fix adds bookkeeping in kernelx and its own tests (+274/−55), and it already has @thehollowedone's native check. Would you open d3887f2 as a PR stacked on this one? It would be reviewed on its own, keep this PR under the size limit, and stay your change. I put the case under Not tested in the description.

Full suite on 5fa6950: 976 passed, 0 failed, 45 ignored. Smoke of 5fa6950 is in the description: 1373 frames vs 1432 on main, peak commit 13 255 vs 15 592 MB, no crash.

AI use: Claude Code (Claude Opus 5.5) wrote the fix, the tests and this reply.

@Filip722

Copy link
Copy Markdown

Opened #2177 on top of your updated 5fa6950. The top commit is 244aa780. All ten focused tests passed on the RTX 5060 Laptop, including your updated tile-counting case. Both directions of the home-address test again matched all 16,384 texels. The PR includes the two retail smoke blocks and the workspace results under Proton.

OpenAI Codex (GPT-6.2-Sol, high) prepared the stack and ran the checks.

A retail game maps one physical page under render targets at two
addresses at once (aliasing targets that are never live together, as the
console allows). kernelx keeps a page at one address (`map_pages` moves
it), and `vram::Pages` keyed its video memory by title address, so each
alias got pages of its own: in its first 40 s the game placed 422 targets
(2.1 GB) whose pages it then mapped under 276 others (1.85 GB), and kept
using both sets (barriers, views). The duplicate cost 1.85 GB of video
memory, and what the GPU wrote through one alias never showed in the other.

A GPU-owned texture's owned pages are now keyed by the physical page
mapped at their address (`kernelx::physical_pages`, asked before `PAGES`
is taken), else by the address as before. Sampled textures keep address
keys.

Measured on GTA VI, RTX 2060 SUPER 8 GB, 90 s at the menus, 3 runs each:
target pages 3597 -> 1738 MB, local video memory 6652 -> 4796 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@3L1A5-1
3L1A5-1 force-pushed the fix/vram-pages-by-physical-page branch from 5fa6950 to de4d1f6 Compare November 25, 2026 12:13
@pvfreis

pvfreis commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Both points of our review are fixed at de4d1f6 (read, not rerun): bind counts (vram.rs:708) and takes (:732) with the same page_key, the line our three tests passed with on efedeea. A page is at one address in AWAY and both loops use one phys snapshot, so I also see nothing left over in fresh.

Read by Claude Code (Claude Opus 5.5), checked with Claude Fable 5.2; each point checked by a person before posting.

@pickles976

Copy link
Copy Markdown

RTX 4060 Laptop / stock vkd3d-proton validation of the change and regression from de4d1f676146ac58b4c11037bed9d0c1b5789d0c, including a Series S title trial.

This is a mixed local integration based on 06c9f5505f63f10c5ec49ef932d75b2c28177324, including #867/#1395, #1069, #1916, #615 and #495. This PR's code and test were ported into that tree; #2177 was not included. Not a clean-head comparison or a competing implementation.

Environment: RTX 4060 Laptop 8 GiB, NVIDIA 590.48.01, i7-13620H, 16 GiB RAM; Linux 6.17.0-40-generic, Wine 11.0, stock/assert-enabled vkd3d-proton 3.2.0 (2576c0b4adfae4a), DXVK 3.1.1-209. Rust 1.98.1, Windows MSVC cross-target.

Focused verification

cargo +1.98.1 test -p xcl --lib --target x86_64-pc-windows-msvc <filter> -- --test-threads=1 --nocapture, through Wine, with XCL_REQUIRE_GPU=mesh XCL_DEFER_PRIVATE_HOME_TILES=1:

  • render_targets_on_one_physical_page_share_its_video_memory: passed, including shared-page accounting, the unmapped-address-to-physical-key case and no lost pool tiles.
  • placed_title_textures_share_vram_and_preserve_pixels: passed. Its 512 unreleased 1 MiB textures over 16 MiB retained 16 MiB of pages; pixel checks passed.

Two unique tests, two passes, no test skips. The logs identify the actual NVIDIA adapter despite the configured DXGI vendor spoof. Release build passed.

Bounded retail 1.0.2.1 runs

Same local stack before/after this PR, lockhart, XCL_COHERENT_MB=3408 XCL_ACTIVITY=1 XCL_PSO_PRELOAD=0 XCL_DEFER_PRIVATE_HOME_TILES=1 XCL_FRAME_DUMP=300 XCL_PRESS_A_AT=40,55. The second run received additional manual confirmations through first-run setup.

Measurement Before this PR With this PR
Last sampled target pages / pool capacity (MiB) 1883 / 1920 937 / 960
Last sampled local DXGI usage (MiB) 6716 5756
Peak board-wide GPU usage sampled by nvidia-smi (MiB) 7233 6209
Minimum available system RAM (MiB) 4462.8 4234.1
Stop VRAM guard at 60.44 s 300 s title timer

These end-of-run measurements are not matched gameplay phases. The later run visibly reached Navigation Experience, UI Text Size, Subtitles and Brightness setup. It reported 7,922 presents and 29.9 fps over the last 300, but these were menus, not gameplay. No unhandled title exception was recorded. Shutdown logged GPU fences still pending after 10 s; the guard subsequently timed out querying NVIDIA telemetry. Thus exit code 0 is not a clean-shutdown or stability claim. Offline XStore errors and command-list resubmission warnings also remained.

Not tested: native Windows, AMD, clean PR head, full suite, home-address aliasing (#2177), world gameplay or 15-minute/30fps acceptance. Free disk stayed above 13.49 GiB. No proprietary assets or screenshots attached.

AI assistance: omp / openai-codex/gpt-6-astra performed the integration, commands, measurements and report. Credit for the fix and regression remains with this PR's authors.

@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.

RDNA2 under Wine: render targets sharing physical pages saves about 1.9 GB from the menus on, but the world load still fills a 12 GB card.

main this PR
local / target pages (pools) at 24 s 7263 / 3561 (3648) MB 5433 / 1702 (1792) MB
same at 60 s 8693 / 4626 (4800) MB 6611 / 2711 (2752) MB
card full 87 s 90 s

Stacked with #2306 (XCL_TEXTURE_LEVEL_PAGES=1) and #1916, the same load stays at 5.8 GB local (2379 MB of pages at 60 s), against #2306 alone at 8.3 GB. I merged #2306 on top by hand (both change Pages::bind; I passed phys through #2306's bind_range, with &[] from map_levels, because lazy levels are only for sampled textures and phys only for GPU-owned ones). Head de4d1f6.

Tested (head de4d1f6, merged onto main 06c9f55, no conflicts unless noted)

  • AMD Radeon RX 6700 XT 12 GB (RDNA2, gfx1031, RADV, Mesa 26.3.1), Ryzen 7 5700X, 16 GB RAM, Linux 7.3.5 (CachyOS)
  • proton-cachyos 11.0-20261015 Wine, vkd3d-proton v3.1 + #257's patch (dxil-spirv 53aac418 from #775), DXVK v3.1.1-97 dxgi
  • release build, XCL_COHERENT_MB=512 (the 4095 MB learned window is ~1 fps here, #284), XCL_ACTIVITY=1
  • A retail title from a cold start: it goes from the menus into its world load at about 50 s. Numbers are the activity log's memory: line; "card full" means sysfs mem_info_vram_used reached 11.5 GB, where my guard stops the run (a full card has crashed the compositor here before).

Not tested

  • cargo test under Wine: these were title runs only.
  • Whether the aliased render targets show the right pixels: I did not check image quality.

AI use

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

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

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.