Skip to content

D3D12.X: allow title texture pages in system memory - #1702

Open
rrrarrra9 wants to merge 1 commit into
xcl-dev:mainfrom
rrrarrra9:codex/texture-pages-system-memory
Open

rrrarrra9 wants to merge 1 commit into
xcl-dev:mainfrom
rrrarrra9:codex/texture-pages-system-memory

Conversation

@rrrarrra9

@rrrarrra9 rrrarrra9 commented Nov 24, 2026 •

Copy link
Copy Markdown

Part of #1773. XCL_TEXTURE_PAGES_SYSTEM_MEMORY=1 opts title texture page pools into D3D12 L0. On a discrete GPU this moves page backing into non-local memory and can reduce local-memory pressure.

What is in it

Tested

  • GTX 1650 4 GB, driver 32.0.16.1656, Ryzen 5 4600H, Windows 11 26300.9974, Rust 1.100.0 MSVC. On 84740c9, cargo check --locked --offline --workspace --tests passed. cargo test --locked --offline -p xcl --lib hle::d3d12x::vram::tests -- --test-threads=1 --show-output reported 17 passed, 0 failed, 1 ignored and no explicit skips in each mode. The two-tile readback ran in both modes.
  • On the exact head, after building the debug workspace prerequisites, cargo test --locked --offline --workspace --no-fail-fast -- --test-threads=4 --show-output reported 1,235 passed, 3 failed, 46 ignored, and 26 explicit skips. The three failed library tests cover mesh-cache routing, an HLSL mesh-cache hit, and UAV-format handling. All three also failed in the matched main run on the preceding base; the test corrections in upstream Tests: two expectations that no longer match the code #2245 address the routing and UAV assertions. The end-to-end target passed on this head.
  • In fresh offline 60 s starts on the same release binary, the default and L0 samples near 59 s used the same 896 MiB texture pool capacity. Local DXGI use was 3,019 / 2,123 MiB and non-local use was 1,086 / 2,022 MiB. The L0 run ended cleanly with 295 presents and 11,502 MiB peak process commit. The paired default-placement regression run retained 88.7% of main's frames with no crash or device removal.
  • Independent earlier-revision reports cover RTX 3090 texture readback and RTX 4060 Ti local-memory use.

Regression run

Main and head, release without debug symbols, default placement, fresh XCL data roots.

xcl-smoke v1
commit: c55ba167295333c81b7024a307e654ec818c475f
gpu: NVIDIA GeForce GTX 1650
title: retail-series-x-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 557 (PresentX 558)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 11435 MB
xcl-smoke v1
commit: 84740c9b864acf3e57259d975127a104a64f760f
gpu: NVIDIA GeForce GTX 1650
title: retail-series-x-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 494 (PresentX 494)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 11439 MB

Not tested

  • Playable story mode, consistent frame-time effects, or the exact head on AMD and Intel. An earlier Arc A770 report saw CreateHeap return E_INVALIDARG for both heap types. The rebased GPU fixture includes the resource heap tier if allocation fails.

AI use

  • OpenAI Codex (gpt-6.2-sol on the earlier revision, GPT-6 on this revision, exact variant not exposed) resolved the rebases, added the copy/readback check, ran validation, and drafted the report.

@WebIdentity1

Copy link
Copy Markdown

Independent RTX 3090 check of exact head d19ae2e (24 November). I compared clean parent 9e3831e1f570d3646e53ab753b19ec07eb8f1485 and head d19ae2e70e22b159300e7f80db301885a0c71e6c on Windows 10 19045, RTX 3090 driver 591.74, Ryzen 7 7800X3D, Rust 1.98.1 MSVC, Agility 1.620.2 x64. Each 227-file source archive matched its SHA256 manifest on Windows before and after. Serial desktop Session 1 runs used XCL_ADAPTER=3090, XCL_REQUIRE_GPU=mesh, XCL_HEAP_WINDOWS=1, direct DXIL unset. cargo build --locked --workspace exited 0 for all three configurations. cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output across 20 targets:

Configuration Passed / failed / ignored
Parent, L0 flag absent 775 / 1 / 41
Head, L0 flag absent 776 / 1 / 41
Head, XCL_TEXTURE_PAGES_SYSTEM_MEMORY=1 776 / 1 / 41

The head's extra pass is its new heap-properties test. All three runs failed only the existing gpu_clamp_and_omod_per_instruction lane-0 v_pk_add_i16 clamp case (separate #202); each printed two explicit debug-layer SKIPPED lines; no timeout. Neither full suite passed.

For direct NVIDIA coverage of the changed path, I used a local test-only fixture on the exact head in two fresh SSH Session 0 processes, flag absent versus 1: cargo test --locked -p xcl --lib texture_page_pool_reads_back_on_selected_adapter -- --test-threads=1 --show-output --nocapture. It selected adapter=NVIDIA GeForce RTX 3090, placed two four-tile R32_UINT reserved textures through place_pages, checked the actual 64 MiB pool heap descriptor, and uploaded/read back all eight 64 KiB tiles. Both runs 1 passed / 0 failed / 0 ignored, no skip or wrong words. Flag absent: DEFAULT heap, DXGI local/nonlocal usage delta +70.46/+14.91 MiB. Flag 1: CUSTOM heap with L0, CPU page unavailable, delta +6.46/+78.91 MiB. The snapshot includes D3D12 overhead, but the ~64 MiB segment shift matches Microsoft's L0/nonlocal mapping on discrete GPUs. The test-only overlay was just a four-line vram.rs registration plus synthetic fixture; Windows SHA256 after the runs matched local (vram.rs b03175aba088cac2b781139e38d2174604f8e27c9287eaae5ad10005deee924d, fixture e5954677705451fe8fbd1820e0c0a532923633a132fcfb2ebfb31c7cd4be3836).

This verifies L0 selection and GPU-byte readback on a 3090, not title performance, longer churn, shader sampling or gameplay. I used no proprietary title files; I cannot provide the required exact-head retail smoke. The author's GTX 1650 title runs still ended in device removal. No code from this probe was committed or pushed.

AI use: Codex (GPT-6) prepared and ran the exact-revision Windows comparisons and synthetic GPU fixture, checked the hashes and logs, and drafted this report.

@ofc0urse

Copy link
Copy Markdown
Contributor

Tested d19ae2e on an 8 GB NVIDIA card in the retail title. The switch moves the texture pages out of VRAM as described: 3.9 GB local instead of 13.9 GB, with about the same number of frames.

Tested: main 85e3826 with d19ae2e merged (no conflicts), release, no local patches. RTX 4060 Ti 8 GB, driver 621.24, i5-14400F, 32 GB, Windows 11 Pro 26300, retail 1.0.2.1. XCL_NETWORK=0, XCL_ACTIVITY=1, A pressed at 115, 125 and 150 s, 600 s per run. The same binary for both runs, XCL_TEXTURE_PAGES_SYSTEM_MEMORY=1 first, unset second.

=1 (1st run) unset (2nd run)
video memory, local, at 200 / 300 / 580 s 3,836 / 3,843 / 3,882 MB 13,928 / 13,956 / 13,956 MB
video memory, non-local, at 300 s 14,960 MB 4,872 MB
process commit at 300 s 31,241 MB 32,970 MB
frames in the run 4,307 4,413
last 2 s window with presents ends 200 s ends 182 s
compute pipelines built by the driver 35 61
device removals 0 0
  • Neither run had a device removal in 600 s. With the switch off, local video memory went well past the card's 8 GB and nothing hung either, so on this machine the switch is not needed to avoid a hang.
  • Both runs stop presenting at about the same point and then build compute pipelines one after the other until the end. The switch does not change that wall.
  • The second run was ended at 584 s by my own guard (free commit under 5 GB): the process went from 35 to 51 GB of commit in 20 s while the driver built a 805 KB DXIL compute program. The first run had not reached that program (35 builds against 61, colder cache), so I don't count it against either setting.

Not tested: one run per setting, not repeated in swapped order. Frame times after the stall, since there were none. AMD or Intel.

AI use: Claude Code (Claude Opus 5.5) built the test binary, ran both runs, read the logs and wrote this comment.

@rrrarrra9

Copy link
Copy Markdown
Author

Exact-head GTX 1650 follow-up

Windows and GTX 1650 (4 GB), clean d19ae2e, with XCL_TEXTURE_PAGES_SYSTEM_MEMORY unset or 1. The release workspace suite reported 777 passed, 0 failed, 41 ignored in both modes. Four tests printed SKIPPED (two wave64 cases, reserved cube mips, and heap windows disabled), plus a junction subcase. Command: cargo test --locked --offline --workspace --release --no-fail-fast -- --test-threads=4 --show-output.

Both 150 s offline startup smoke runs completed without device removal. PresentX counts were 2,329 / 1,886 and sampled peak local DXGI usage was 8,263 / 3,133 MiB (DEFAULT / L0). At the comparable 59 s samples, L0 moved about 3.5 GiB to the non-local segment with the same texture pool capacity. The sample breakdown and the synthetic transfer result are in #1773. Story mode remains unverified.

The current allocator in #1747 conflicts with this branch. A rebased run needs a new matched workload before review.

AI use: OpenAI Codex with gpt-6.2-sol ran the tests and summarized the results.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

@rrrarrra9
rrrarrra9 force-pushed the codex/texture-pages-system-memory branch from d19ae2e to 670a0f9 Compare November 24, 2026 22:37
@rrrarrra9
rrrarrra9 marked this pull request as ready for review November 24, 2026 22:56
@NAbobo101

NAbobo101 commented Nov 24, 2026 •

Copy link
Copy Markdown

Tested the head 670a0f9 (on main 689f2db) on an 8 GB NVIDIA card with the retail title in Series X mode: XCL_TEXTURE_PAGES_SYSTEM_MEMORY=1, XCL_DIRECT_DXIL=1, XCL_HEAP_WINDOWS=1, XCL_PSO_WAIT_MS=2000, scripted presses into the world load.

Tested

  • RTX 5060 8 GB (wave32 only), driver 621.40; Ryzen 7 5700G, 32 GB RAM, 48–64 GB page file; Windows 11 Pro 26300; Rust 1.100.0 MSVC; DXC 1.8.2502.11; release.
  • The log says title texture page pools use system memory (D3D12_MEMORY_POOL_L0), and local video memory stays at 4.0–4.2 GB, with 13.8 GB non-local. That matches the 13.9 → 3.9 GB reported above.
run end local / non-local video memory skipped draws / dispatches slowest compute PSO in the driver
1 device removed (0x887a0006), 559.9 s 4.2 / 13.8 GB 256 / 2 178 s
2 title watchdog (+0x23cf683), 470.9 s 4.0 / 13.8 GB 158 / 7 216 s
3 (window kept in the foreground) title watchdog (+0x23cf683), 319.0 s 4.0 / 13.7 GB 0 / 0 152 s
4 (window kept in the foreground) device removed (0x887a0006), 384.3 s 4.6 / 14.6 GB 128 / 0 151 s

In runs 3 and 4 the game window was brought to the foreground every 30 s, and each check found it in the foreground and never hung (IsHungAppWindow 0 in 23 checks). That rules out a background window as the reason the picture goes away. Its title shows the frame rate falling from 30 to 6, 1 and then 0 fps, while the background pool reports compiling shaders: 0 running, 0 done, ~57 000 pipelines queued for most of the run.

For comparison, the same settings without this PR on main 1d027e5, the same machine, gave 13.7–14.4 GB local. One run reached the 900 s cap without a removal, and one had a device removal at 670 s.

So on this card the switch moves the texture pages out of video memory as described, but it does not prevent the device removal in the world load: run 1 lost the device with only 2 dispatches skipped and 4.2 GB of local video memory in use, and run 4 with no dispatch skipped at all. Whatever hangs the GPU there isn't video memory overcommit, at least not alone. In runs 1 and 2 the loading screen kept presenting until about 290 s and 350 s; after that the window showed no image.

Not tested

  • The test suite on this head; the switch without the bounded wait; AMD.
  • Whether frame times changed: the runs don't reach rendered gameplay.

AI use

  • Claude Code (Claude Opus 5.5) scripted and ran the runs, read the logs and drafted this comment. I checked the results.

Edit: the driver for all these runs was 621.40 (Windows updated it before them), not 621.14 as first written.

@JJAutoCompare

Copy link
Copy Markdown

XCL PR #1702 Arc A770 verification

Clean detached head 670a0f926b14f628349ab1f7be0ad7e85977b3af. The PR changes README.md and crates/xcl/src/hle/d3d12x/vram.rs.

STOR-WINLAB ran Windows 11 Enterprise Evaluation build 26200 on a Ryzen 7 3800X with an Intel Arc A770 (driver 32.0.101.9175). DXC 1.9.2609.5 and rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), debug build.

Tested

  • cargo build --workspace and cargo test --workspace --no-run both succeeded outside the Arc lock.
  • cargo test -p xcl --lib texture_pools_use_system_memory_only_when_requested with XCL_ADAPTER=NONE_CPU_ONLY reported 1 passed, 0 failed, 0 ignored, 0 skips. It checked default heap properties and custom L0 properties with CPU access disabled.
  • cargo test -p xcl --lib texture_page_batch_uses_the_selected_heap ran twice under Invoke-ArcTest.ps1 with XCL_ADAPTER=A770, first with XCL_TEXTURE_PAGES_SYSTEM_MEMORY unset, then set to 1. Each run reported 0 passed, 1 failed, 0 ignored, 0 skips. D3D12 CreateHeap returned 0x80070057 (E_INVALIDARG) for both the default and custom L0 heaps. The test stopped at bind two tiles before it could check heap properties, tile mapping, unmapping, or reclamation.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once under the Arc lock with XCL_ADAPTER=A770, RUST_TEST_NOCAPTURE=1, and system-memory opt-in unset. Exit 101. The 20 result lines (19 test binaries and 1 doctest target) total 951 passed, 26 failed, and 45 ignored. The pass total includes early returns.

Workspace failures and skips

  • The library target had 25 failures, including the same default-heap failure and 24 DXIL or recompiler failures. The end-to-end title test also failed the RSSetDepthBiasX check (blue pixel, expected green).
  • pr1702-suite.log contains 25 lines beginning with SKIPPED . Reasons were unavailable wave64 (17), refused DXIL lowerings (3), missing debug-layer support (2), tiled tier below 2 (1), no heap windows (1), and driver-cache controls unavailable (1).

Not tested

Matched main baseline, retail-title smoke, sample-dependent cases (XCL_SAMPLE_* unset), and other GPUs.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1702-suite.log and published.

@anes66

anes66 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

CPU-only tile-ownership verification on exact head 670a0f926b14f628349ab1f7be0ad7e85977b3af passed. Optional test companion f55cbd3 is directly on that head, adding one test in vram.rs and no runtime changes.

The existing churn test checks the free count after a failed batch. This adds identity-level checks when a batch consumes existing tiles, successfully grows by zero, one or three heaps, then fails its next heap allocation. It also checks the cooling boundary and that a retry can consume all returned tiles without further growth.

Tested

  • Windows 10 Pro 19045, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug. No GPU, DXC or title execution.
  • 180 cases: five synthetic pool sizes (1, 2, 7, 64, 1024 tiles), three instants immediately before / at / after COOL, three successful-growth counts, and four preferred-heap choices including an invalid preference.
  • An independent set of all tiles minus live/uncooled tiles is compared with the actual free lists. Checks include exact identities, no duplicates, correct free_total, unchanged ownership of live/cooling tiles, retained newly grown pool slots, and complete retry reuse.
  • cargo test --locked -p xcl --lib tile_pool_ -j 2 -- --nocapture --test-threads=1: 2 passed / 0 failed / 0 ignored / 0 skips (the new matrix and existing churn test).
  • Temporary negative control: returning tile index zero instead of the real index keeps counts plausible but fails the new test with rollback duplicated a free tile. Restored before the final passing run and commit.

Not tested
Real heap allocation, L0/default placement on the GPU, GPU fences or mapping, actual memory pressure, release, full workspace suite, retail smoke or newer-main integration. This tests the common batch allocator's bookkeeping; it does not establish that L0 fixes memory exhaustion or that the title is playable. No runtime defect was found in the tested rollback implementation.

AI use: Codex (GPT-6; exact variant unavailable) wrote the test and temporary negative control, ran CPU verification and prepared this report.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@Dezmonius

Copy link
Copy Markdown

RTX 5070 / 610.88 native Windows follow-up. I tested #1702 (670a0f9) on cbc296ab + the same local #1464, #1931 and #929 test setup, using local-budget activity logging adapted from #1515. Same binary, offline Series X, copied profile, direct DXIL, DRED, no frame capture, same cache location. XCL_TEXTURE_PAGES_SYSTEM_MEMORY=1 ran second. Both planned for 300 s.

Default texture heaps System-memory texture heaps
Peak local DXGI usage 14,794 MiB 4,671 MiB
Peak non-local DXGI usage 1,241 MiB 11,102 MiB
Local DXGI budget 11,176 MiB 11,176 MiB
Min available physical RAM 8.61 GiB 2.95 GiB
Sampled PresentX calls 873 864
GPU queue watchdog releases 4 2
End 300 s timer, exit 0 external physical-memory guard at 270.8 s

No device removal was logged in either run. The L0 stop was the test harness's 3 GiB available-physical-memory floor, with 23.62 GiB of commit headroom. The default run remained alive while local usage exceeded the DXGI budget. The L0 run stayed below that budget and still logged queue waits. This pair shows the residency shift on the 5070. Frame capture was off, so gameplay was not visually verified.

cargo test --locked --offline -j 4 -p xcl --lib hle::d3d12x::vram::tests::texture_ -- --nocapture --test-threads=1: 2 passed in each mode, no failures or skips; both tests include checking the chosen heap, and the GPU test mapped and released it. Full suite not run. No game data or raw logs included. AI-assisted (OpenAI Codex, GPT-6).

Pass per-device heap properties when the batched allocator grows. Keep xcl-dev#1747 batching and xcl-dev#1985 heap slot reuse and fence-delayed retirement for both heap types. Verify the selected backing with a two-tile GPU copy/readback.

Assisted-by: OpenAI Codex (GPT-6)
@rrrarrra9
rrrarrra9 force-pushed the codex/texture-pages-system-memory branch from 670a0f9 to 84740c9 Compare November 25, 2026 11:40
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.

9 participants