Skip to content

D3D12.X: eliminate multi-heap UpdateTileMappings and per-texture Signal stalls in vram::Pages - #1747

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
raylitebull:fix/world-freeze-180s
Nov 24, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
raylitebull:fix/world-freeze-180s

Conversation

@raylitebull

@raylitebull raylitebull commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Eliminates multi-heap UpdateTileMappings stalls in vram::Pages by keeping tile allocations contiguous within a single heap, trimming mapped tile ranges, and moving CreateReservedResource / GetResourceTiling outside PAGES.lock().

What is in it

  • crates/xcl/src/hle/d3d12x/vram.rs: add per-heap contiguous TilePool (pick_heap, take_batch, heap_ranges_trimmed), move CreateReservedResource / GetResourceTiling outside PAGES.lock(), cache reservable(), use D3D12_TILE_MAPPING_FLAG_NONE, keep immediate queue.Signal(&self.fence, self.value) in Pages::map and Pages::unmap so tile-mapping operations are always fenced before resource release, and add tile_pool_keeps_churned_allocations_in_single_heap_and_contiguous + churn_update_tile_mappings_timing.

Tested

  • Hardware & toolchain: AMD Radeon RX 9070 XT (16191 MiB VRAM, RDNA4, native wave64), Windows 11 x64 (10.0.22631.0), rustc 1.99.1 (58cf8f9c3 2026-10-13), release & debug builds, based on 7f7e768.
  • cargo test -p xcl --test e2e test_title_draws_with_a_root_signature_under_the_debug_layer -- --test-threads=1: 3 passed, 0 failed (2.89 s, 1.88 s, 2.15 s; 0 D3D12 debug-layer errors).
  • cargo test -p xcl --lib hle::d3d12x::vram::tests -- --test-threads=1: 10 passed, 0 failed (2.30 s).
  • churn_update_tile_mappings_timing (--release, 256 x 2 MiB tiled textures across 64 pools on RX 9070 XT, D3D12_TILE_MAPPING_FLAG_NONE + 256 Signals in both arms):
    • BEFORE (8,192 UpdateTileMappings + 256 Signals): submit = 951.18 ms, gpu_done = 987.70 ms
    • AFTER (256 UpdateTileMappings + 256 Signals): submit = 43.54 ms (21.8x faster), gpu_done = 69.03 ms (14.3x faster)

Regression run
main:

xcl-smoke v1
commit: e9e94ce665d16bb0e2d2e4cb6b37e149f0d27721
gpu: AMD Radeon RX 9070 XT
title: 29e814f5
seconds: 60
exit: 0x0
frames shown: 1582 (PresentX 1583)
presents per 2 s (last 3): 60 55 60
device removals: 0
crashes: 0
peak commit: 18359 MB

PR:

xcl-smoke v1
commit: 3bc7143a8dbc5a2326345d6e734604c56a9e3266
gpu: AMD Radeon RX 9070 XT
title: 29e814f5
seconds: 60
exit: 0x0
frames shown: 1617 (PresentX 1617)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16716 MB

Not tested

  • NVIDIA and Intel GPUs, wave32-only adapters, and Linux/Wine/vkd3d-proton on 3bc7143.
  • Full cargo test --workspace run on 3bc7143, and deeper world-streaming heap churn beyond the 60 s Account Picker smoke window.

AI use

  • Antigravity (Claude Opus 4.6) assisted with code implementation, benchmarking, and test verification; the author reviewed the diff and results.

@WebIdentity1

WebIdentity1 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Corrected head 39e5f31 — RTX 3090 result (24 November). The new Pages::map and timing-test calls use documented D3D12_TILE_MAPPING_FLAG_NONE, addressing my unsupported-flag finding for old head 6b5c030. The author has since updated the PR's RX 9070 XT NONE benchmark and exact-head smoke blocks; I did not run those retail or AMD checks.

I compared clean exact parent 4178e888c0b5be50a2887eda45cdb832763b68a4 and head 39e5f31e9b67f328755dc4ee99a2fd85a6b17dc5 on Windows 10 19045, RTX 3090 driver 591.74, Ryzen 7 7800X3D, Rust 1.98.1 MSVC, Agility 1.620.2 x64. Both 295-file source archives matched SHA256 manifests on Windows. With XCL_ADAPTER=3090, XCL_REQUIRE_GPU=mesh, XCL_HEAP_WINDOWS=1, direct DXIL unset, in desktop Session 1, cargo build --locked --workspace exited 0 on each. cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output across 20 targets: parent 889 passed / 2 failed / 42 ignored; head 890 passed / 2 failed / 43 ignored. The extra pass is the new tile-pool test; the extra ignored test is the timing benchmark. The same two failures occurred on both: known #202 v_pk_add_i16 clamp lane 0 and the synthetic PSO measurement test, which cannot disable driver cache on this Windows installation without Developer Mode / the missing SDK component while XCL_REQUIRE_GPU=mesh makes it fail. Each run printed two explicit SKIPPED lines for unavailable debug-layer checks. No timeout or head-only suite failure; neither full suite passed.

The existing title-texture test selects DXGI adapter 0 internally, so its full-suite run is not specific 3090 evidence. I therefore ran a local test-only fixture on this exact corrected head: cargo test --locked -p xcl --lib two_textures_wait_for_one_batched_mapping_signal -- --test-threads=1 --show-output --nocapture, fresh SSH Session 0 process with XCL_ADAPTER=3090, XCL_REQUIRE_GPU=mesh. It selected adapter=NVIDIA GeForce RTX 3090, placed two distinct four-tile reserved textures before submit, observed dirty=true, targets=2, fence_value=0 become dirty=false, targets=2, fence_value=1, and uploaded/read back all eight 64 KiB tiles with zero wrong words. 1 passed / 0 failed / 0 ignored, no skip, timeout or device removal. The fixture only adds a four-line vram.rs module registration and a synthetic test file; hashes matched Windows after the run (vram.rs 2b16226cc3f3b6ad8d9317714d8e5c3aeab4bbb88536b89a04bcda8479010384, fixture b6b8d8dbfdd180b9c8b5b6e4ced5abf4106a101b23409c60be497faeed2e31c1). This supports the corrected batching path on a 3090 for two synthetic textures; it does not measure world-scale churn, rendering or gameplay. No proprietary title files were used.

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

RTX 3090 parent/head test follow-up — 24 November: I tested exact parent b9b6ea62080cc62fc19e212033372d01c6214e5c and PR head 6b5c030c28115d4633ed79caa893ebcd6625c313 on Windows 10 19045, RTX 3090 driver 591.74, Rust 1.98.1 MSVC, Agility 1.620.2. Each clean 295-file source archive matched its Windows copy before and after. With XCL_ADAPTER=3090, XCL_REQUIRE_GPU=mesh, XCL_HEAP_WINDOWS=1, XCL_DIRECT_DXIL unset, Session 1: cargo build --locked --workspace exit 0 on both. cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output: parent 887 passed / 2 failed / 42 ignored; head 888 passed / 2 failed / 43 ignored across 20 targets. The head's extra pass is its new tile-pool unit test; extra ignored is its timing benchmark. The same two failures occur on both: known #202 v_pk_add_i16 clamp lane 0 and the synthetic PSO measurement test, which cannot disable the driver cache on this machine while XCL_REQUIRE_GPU=mesh turns the missing SDK component/Developer Mode condition into a failure. Four explicit SKIPPED lines on each suite (two wave64 reference and two unavailable D3D12 debug-layer paths); no timeout. Thus there is no additional suite failure at this head under this setup, but neither full suite passed.

For an explicit NVIDIA check of the changed Pages path, I used a local test-only fixture on the PR head: cargo test --locked -p xcl --lib two_textures_wait_for_one_batched_mapping_signal -- --test-threads=1 --show-output --nocapture, XCL_ADAPTER=3090, fresh process. It selected adapter=NVIDIA GeForce RTX 3090; two distinct 256×256 four-tile reserved textures were placed before submission; Pages went from dirty=true, targets=2, fence_value=0 to dirty=false, targets=2, fence_value=1; all eight 64 KiB tiles uploaded and read back with zero wrong words. 1/0/0, no skip, timeout or device removal. Test-only source SHA256: vram.rs 6e727e570986f6058e7a7413476c443e73cb1d62b0fa76ce77600988dbc62e29, fixture b6b8d8dbfdd180b9c8b5b6e4ced5abf4106a101b23409c60be497faeed2e31c1, matching Windows copies. The existing large title-texture test ran in the Session 1 suite but internally selects DXGI adapter 0, so I cannot attribute its coverage to the 3090; it skipped in a separate Session 0 run. No retail title, world-churn performance or NO_HAZARD versus NONE timing was measured. The documented unsupported-flag concern in my original comment remains even though this focused GPU-byte test passes.

AI use: Codex (GPT-6) ran the exact-revision Windows comparisons and synthetic 3090 fixture, verified source hashes and logs, and prepared this update.


I checked the exact head 6b5c030c28115d4633ed79caa893ebcd6625c313. In vram.rs, Pages::map selects D3D12_TILE_MAPPING_FLAG_NO_HAZARD for newly created reserved resources (lines 458, 468, 497), and the timing test uses the same flag (line 1416). Microsoft's D3D12_TILE_MAPPING_FLAGS reference explicitly describes D3D12_TILE_MAPPING_FLAG_NO_HAZARD as “Unsupported, do not use.” That makes this part of the optimization unsafe to rely on as documented API behavior, even if a particular driver accepts the call. Please use D3D12_TILE_MAPPING_FLAG_NONE in the production path and remeasure the benchmark with that flag so the allocator and fence batching benefits can be judged independently. This is a source/API-contract finding; I have not observed a GPU failure from the flag.

I am running a separate exact-parent/head Windows RTX 3090 comparison now. The existing placed_title_textures_share_vram_and_preserve_pixels test reported SKIPPED ... this adapter makes no reserved cube with mips in my first exact-head run, so its passing test count is not evidence that the changed shared-page path ran on this machine. I will edit this comment with the full-suite counts when the pair finishes.

AI use: Codex (GPT-6) reviewed the PR call site against the Microsoft reference, inspected the test log, and prepared this comment. The source/API finding was checked before posting.

@raylitebull
raylitebull force-pushed the fix/world-freeze-180s branch from 6b5c030 to 39e5f31 Compare November 24, 2026 20:24
@raylitebull

Copy link
Copy Markdown
Member Author

Thank you for catching the D3D12_TILE_MAPPING_FLAG_NO_HAZARD API-contract issue!

Updated in commit 39e5f31e9b67f328755dc4ee99a2fd85a6b17dc5 (rebased onto main 4178e88):

  • Replaced D3D12_TILE_MAPPING_FLAG_NO_HAZARD with D3D12_TILE_MAPPING_FLAG_NONE in both Pages::map and churn_update_tile_mappings_timing, and removed the unused no_hazard parameter.
  • Remeasured hle::d3d12x::vram::tests::churn_update_tile_mappings_timing on AMD Radeon RX 9070 XT with D3D12_TILE_MAPPING_FLAG_NONE in both arms (10/10 hle::d3d12x::vram::tests passing):
    • Before (256 x 2 MiB, 8,192 UpdateTileMappings + 256 Signals): submit = 756.82 ms, gpu_done = 781.07 ms
    • After (256 x 2 MiB, 256 UpdateTileMappings + 1 Signal, FLAG_NONE): submit = 34.72 ms (21.8x faster), gpu_done = 43.89 ms (17.8x faster)
  • Updated the PR description and Regression run block for 39e5f31.

@ivall

ivall commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Test report for 6b5c030c2 (on main b9b6ea6): one test of the suite fails with this PR; cause and a small fix below. The rest looks good, and the speed-up holds here.

39e5f31 was pushed while I tested. I have read its delta but not rerun the test on it: it changes only the mapping flag, and the deferred Signal that causes the failure is still there, so I expect the same result. I'll edit this comment once I have run it.

Tested: AMD RDNA4, Windows, DXC 1.8.2502.11, debug, adapter default.

1. The failure. tests/e2e.rs test_title_draws_with_a_root_signature_under_the_debug_layer, three runs each, same folder:

tree result
main b9b6ea6 3 of 3 pass
#1748 0b64aa04c alone 3 of 3 pass
this PR alone 3 of 3 fail

Our own test title ends with 0x87d, from the D3D12 debug layer:

D3D12 debug layer (error, id 921): ID3D12Resource3::<final-release>: CORRUPTION: An ID3D12Resource object is referenced by GPU operations in-flight on Command Queue ('xcl vram tile-mapping queue'). It is not safe to final-release objects that may have GPU operations pending.

The test is skipped where d3d12SDKLayers.dll (Graphics Tools) is missing, and CI has no GPU, so it does not show there.

2. Cause. The Signal is now deferred to the next before_execute. A texture that is mapped and then released before that has UpdateTileMappings work in flight which nothing has signalled.

3. Fix checked here: signal after each mapping again (as main does), and keep everything else: the per-heap TilePool, the trimmed ranges, and resource creation outside the lock. With it the test passes 3 of 3 (6b5c030c2 + the fix, so still with NO_HAZARD; FLAG_NONE as in 39e5f31 is right).

-        self.dirty = true;       // in map() and in unmap()
+        self.signal();
+    unsafe fn signal(&mut self) {
+        self.value += 1;
+        let _ = self.queue.Signal(&self.fence, self.value);
+    }

plus removing dirty and the flush in before_execute.

4. It costs almost nothing. churn_update_tile_mappings_timing, one run each, at 6b5c030c2 (so with NO_HAZARD in the two new rows); the last row is your new pattern with the Signal moved inside the loop:

submit gpu_done
before 445.4 ms 450.8 ms
this PR (1 Signal) 8.5 ms 15.6 ms
this PR's pattern, a Signal per texture 13.4 ms 14.8 ms

So the gain comes from one heap per texture and fewer UpdateTileMappings calls, not from batching the fence.

5. Whole suite (cargo test --workspace --no-fail-fast -- --test-threads=4), this PR merged with #1748: 891 passed, 1 failed (the test above), 43 ignored. With the fix: 892 passed, 0 failed, 43 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).

I also read the whole diff. reservable() depends only on the format and the sample count, so the cache key is right, and a failed take_batch gives its tiles back before any page's user count changes.

Not tested: 39e5f31, the suite on this PR alone (only the test above), NVIDIA, Intel, and a title under streaming load.

AI use: Claude Code (Claude Opus 5.5) ran the tests, found the cause, wrote the fix and this report.

@frenziedcoder

Copy link
Copy Markdown

NVIDIA test report for 39e5f31 (the FLAG_NONE head): the churn timing is 45–80x faster on an RTX 5080, more than on the RX 9070 XT; full suite green; clean smoke pair.

Tested

  • NVIDIA GeForce RTX 5080 16 GB (driver 617.14, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11. Exact head 39e5f31e9b67f328755dc4ee99a2fd85a6b17dc5, no local changes.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 (debug): 892 passed, 0 failed, 43 ignored. All vram::tests pass, including tile_pool_keeps_churned_allocations_in_single_heap_and_contiguous and reservable_agrees_with_the_driver. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • About @ivall's failure above: test_title_draws_with_a_root_signature_under_the_debug_layer reports ok here, but that says nothing. This machine has no D3D12 debug layer (debug layer requested but unavailable … (0x887A002D) in the test's log), so the test ran without it and never hit the deferred Signal it catches. It is not a data point for 39e5f31.
  • cargo test -p xcl --lib -- --ignored --exact hle::d3d12x::vram::tests::churn_update_tile_mappings_timing --nocapture, 3 runs (both paths with D3D12_TILE_MAPPING_FLAG_NONE, as in this head):
run BEFORE submit / gpu_done (8,192 UpdateTileMappings + 256 Signal) AFTER submit / gpu_done (256 + 1)
1 1,208.7 ms / 1,217.7 ms 14.8 ms / 24.1 ms
2 1,244.7 ms / 1,253.9 ms 20.2 ms / 29.8 ms
3 1,218.5 ms / 1,226.2 ms 17.4 ms / 26.7 ms

So the submit is 60–82x and gpu_done 42–51x faster here (29.4x / 17.4x in the description on the RX 9070 XT). The old path is slower on this driver to begin with (1.2 s vs 0.78 s).

Regression run (scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen; XCL_PSO_PRELOAD=0 for both builds, because this machine's preload list holds the program of #1307)

base (4178e88, this PR's base):

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: NVIDIA GeForce RTX 5080
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14604 MB

this PR:

xcl-smoke v1
commit: 39e5f31e9b67f328755dc4ee99a2fd85a6b17dc5
gpu: NVIDIA GeForce RTX 5080
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1633 (PresentX 1633)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14604 MB

Not tested: the world load (where placed textures churn the most), so no in-game timing of the change; AMD; the earlier NO_HAZARD head.

AI use: Claude Code (Claude Opus 5.5) built and ran the tests, the timing test and the smoke runs on my machine and wrote this report; I checked it.

@KarolKurzyna

Copy link
Copy Markdown

Independent Windows 11 + NVIDIA GeForce RTX 3070 Ti (8 GB VRAM, wave32) A/B verification of exact PR head 39e5f31e9b67f328755dc4ee99a2fd85a6b17dc5 vs exact parent 4178e888c0b5be50a2887eda45cdb832763b68a4 (unmodified, clean trees).

Short summary: the tile-pool and signal-batching speedups replicate strongly on 8 GB NVIDIA (45.0x faster submit, 29.7x faster gpu_done in churn_update_tile_mappings_timing), and the 60 s retail smoke window passes cleanly (1660 frames, 0 crashes), but 39e5f31 introduces a deterministic D3D12 debug-layer corruption failure (id 921 / 0x87d) in tests\e2e.rs::test_title_draws_with_a_root_signature_under_the_debug_layer (PASS on 4178e88, FAIL 2/2 on 39e5f31).

Debug-layer regression (e2e)

  • Exact parent 4178e88: cargo test -p xcl --test e2e test_title_draws_with_a_root_signature_under_the_debug_layer -- --nocapture --test-threads=1 → 1 passed, 0 failed.
  • PR head 39e5f31: fails deterministically (2/2 runs) at crates\xcl\tests\e2e.rs:268:5 (Game exited with code 0x87d right after [PASS] D3D12.X: descriptor heaps still in window 0 after an 8 GiB+ graphics reservation).
  • xcl.log shows the exact trigger when xcl_testtitle executes committed_textures_leave_room_for_readback (tests/testtitle/src/gpu.rs:1770) and drops kept (drop(kept)) without submitting any command list (before_execute never runs to Signal Pages::queue):
    D3D12 debug layer (error, id 921): ID3D12Resource3::<final-release>: CORRUPTION: An ID3D12Resource object (0x0000000061809040:'Unnamed Object') is referenced by GPU operations in-flight on Command Queue (0x000000004BDABF00:'xcl vram tile-mapping queue').  It is not safe to final-release objects that may have GPU operations pending.  This can result in application instability.
    
  • Because Pages::map and Pages::unmap defer self.queue.Signal(&self.fence, self.value) until before_execute without retaining COM references or waiting/flushing before resource release, releasing tiled resources while UpdateTileMappings is still pending/in-flight on xcl vram tile-mapping queue causes a debug-layer corruption exception (0x87d) even when no GPU work was submitted on a title queue.

Tested

  • Hardware / toolchain: Windows 11 26H2 (26300.9974), Intel Core i5-14600K, NVIDIA GeForce RTX 3070 Ti (8017 MiB VRAM, driver 621.24 / 32.0.16.2124, SM 6.6, wave32), rustc 1.100.0 (stable-x86_64-pc-windows-msvc), dxcompiler 1.9.2602.17 (21d28f72) / dxil 1.9.2602.17 (Windows SDK 10.0.26100.0), XCL_HEAP_WINDOWS and XCL_DIRECT_DXIL unset.
  • vram::tests on 39e5f31: cargo test -p xcl --lib hle::d3d12x::vram::tests -- --nocapture --test-threads=1 → 10 passed, 0 failed, 1 ignored (churn_update_tile_mappings_timing), 0 SKIPPED.
  • placed_title_textures_share_vram_and_preserve_pixels: ran cleanly on RTX 3070 Ti (0 SKIPPED) → 1 passed, 0 failed on both 4178e88 and 39e5f31.
  • churn_update_tile_mappings_timing (--release, 39e5f31):
    • BEFORE (256 x 2MiB textures, 8192 UpdateTileMappings + 256 Signals): submit = 536.7984 ms, gpu_done = 540.5626 ms
    • AFTER (256 x 2MiB textures, 256 UpdateTileMappings + 1 Signal): submit = 11.918 ms (45.0x faster), gpu_done = 18.1938 ms (29.7x faster)
  • .\scripts\test.ps1 on 39e5f31: unittests src\lib.rs passed (843 passed, 0 failed, 23 ignored, 2 wave64 skips + 1 Developer Mode skip for pso_measurement_compiles_an_exact_synthetic_record), and 5 small test targets passed before halting on the e2e failure above (test result: FAILED. 2 passed; 1 failed; 0 ignored in tests\e2e.rs).

Regression run (60 s scripts/smoke.ps1, --release)

Parent (4178e88):

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: NVIDIA GeForce RTX 3070 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1635 (PresentX 1635)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14594 MB

PR #1747 (39e5f31):

xcl-smoke v1
commit: 39e5f31e9b67f328755dc4ee99a2fd85a6b17dc5
gpu: NVIDIA GeForce RTX 3070 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1660 (PresentX 1660)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14586 MB

Not tested

  • AMD / Intel GPUs, Linux / Wine, XCL_HEAP_WINDOWS=1, XCL_DIRECT_DXIL=1, XCL_SAMPLE_* suites, or extended world streaming past 60 s.

AI use

  • Google Antigravity (Gemini 4 Neon) ran the A/B builds, tests, benchmark, log inspection, and smoke runs locally and drafted this report from the captured outputs.

@raylitebull
raylitebull force-pushed the fix/world-freeze-180s branch from 39e5f31 to 3bc7143 Compare November 24, 2026 21:14
@raylitebull

Copy link
Copy Markdown
Member Author

Thank you both (@ivall and @KarolKurzyna) for tracking down the id 921 debug-layer resource-lifetime failure in test_title_draws_with_a_root_signature_under_the_debug_layer!

Updated in commit 3bc7143a8dbc5a2326345d6e734604c56a9e3266 (rebased onto main 7f7e768):

  • Restored immediate self.queue.Signal(&self.fence, self.value) in Pages::map and Pages::unmap and removed the deferred dirty flush from before_execute, keeping the per-heap TilePool, trimmed ranges, D3D12_TILE_MAPPING_FLAG_NONE, and CreateReservedResource / GetResourceTiling outside PAGES.lock().
  • Re-verified on AMD Radeon RX 9070 XT:
    • cargo test -p xcl --test e2e test_title_draws_with_a_root_signature_under_the_debug_layer -- --test-threads=1: 3/3 passed (2.89 s, 1.88 s, 2.15 s; 0 D3D12 debug-layer errors).
    • cargo test -p xcl --lib hle::d3d12x::vram::tests -- --test-threads=1: 10/10 passed (2.30 s).
    • churn_update_tile_mappings_timing (--release, FLAG_NONE + 256 Signals): submit = 951.18 ms -> 43.54 ms (21.8x faster), gpu_done = 987.70 ms -> 69.03 ms (14.3x faster).
  • Updated the PR description and Regression run blocks for 3bc7143.

@raylitebull
raylitebull merged commit c4d37be into xcl-dev:main Nov 24, 2026
2 of 3 checks passed
@thehollowedone

Copy link
Copy Markdown

Tested

I checked the final merge c4d37be on an RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC release. The 10 stock VRAM tests passed, and test_title_draws_with_a_root_signature_under_the_debug_layer passed with Graphics Tools enabled. No runtime skips were reported.

I ran the ignored churn_update_tile_mappings_timing test separately three times with cargo test --offline --locked --release -p xcl --lib -- --ignored --exact hle::d3d12x::vram::tests::churn_update_tile_mappings_timing --nocapture. With the same 256 textures and 256 signals in each arm, 8,192 mapping calls took 730–739 ms to submit and 735–745 ms to complete on the GPU. The 256-call arm took 13–15 ms to submit and 23–24 ms to complete. All three runs passed.

Not tested

This covers texture mapping churn and the synthetic D3D12 debug-layer title. Retail world loading was outside this check.

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

anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
…v#1791, xcl-dev#605, xcl-dev#1806, xcl-dev#1745)

Merges 60 upstream commits through c4d37be, incorporating:
- PR xcl-dev#1747 (raylitebull): eliminate multi-heap UpdateTileMappings and per-texture Signal stalls in vram::Pages via contiguous TilePool
- PR xcl-dev#1791 (wondercrash): D3D12.X an ExecuteIndirect reads arguments written before it
- PR xcl-dev#605 (0x6461726B): promote R9G9B9E5_SHAREDEXP render/UAV targets to R11G11B10_FLOAT
- PR xcl-dev#1806 (bmjask): Direct DXIL image_get_lod accepts static samplers
- PR xcl-dev#1745 (gefydev): direct per-lane DXIL recompiler lowering backend

Assisted-by: Antigravity
wondercrash added a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
Conflicts:
- build.rs: upstream's per-lane source hash kept; integ's second copy of the
  /HIGHENTROPYVA:NO link argument dropped (upstream's xcl-dev#631 copy at the top of
  main() stays).
- gpu/recomp/mod.rs: integ's loop budget kept next to upstream's xcl-dev#1321
  fallback, then xcl-dev#1321 left out: integ's one skip variable (c70c9f0)
  removes the quadratic guards it bounds. With it, no retail program comes
  near 128 B per byte (95cc13288a27a96e: 18.9 MB structured), and the bound
  would only move memory-dense programs (S_BUFFER_LOAD / BUFFER_LOAD runs at
  4 windows: 250-300 B per byte, structured no larger than the pc form) to
  the pc form. Its test is left out with it; c70c9f0's
  crossing_forward_jumps_keep_the_guards_short covers that layout.
- hle/d3d12x/bind.rs: xcl-dev#1791 is upstream's copy of d2d8c93 / 923c3f8:
  integ's call sites (gpu_profile, breadcrumbs, XCL_SKIP_SHADERS) kept
  around upstream's identical fresh_indirect_arguments; the test that both
  sides added is kept once, at upstream's place.
- hle/d3d12x/vram.rs: xcl-dev#1747 as ported on try-1747 (11a9069): the PR's side
  of place_on_pages, with integ's pages() at its two PAGES.lock() sites so
  releases deferred while PAGES was held still run.

Assisted-by: omp (Claude Opus 5.5)
rrrarrra9 added a commit to rrrarrra9/xcl that referenced this pull request Nov 24, 2026
Keep the per-heap batching, rollback, and mapping fences from xcl-dev#1747. Pass the per-device heap properties to the new pool allocation and verify that a two-tile batch uses the selected heap and returns its tiles after unmapping.

Assisted-by: OpenAI Codex (gpt-6.2-sol)
mastrr9 added a commit to mastrr9/xcl that referenced this pull request Nov 24, 2026
Brings xcl-dev#1747, xcl-dev#1791, xcl-dev#605, xcl-dev#1679, xcl-dev#1806, xcl-dev#1745, xcl-dev#1307, xcl-dev#1321 among others.

Resolutions:
- dxil/kernel.rs: upstream's Lw::new / Lw::finish; the safe s_barrier state
  and policy and xcl-dev#1741's single-wave bounded exchange move into Lw::new, with
  a safe_barrier flag (false for the per-lane lowering).
- dxil/lower.rs: VAR_BAR_DEAD moves to VAR_BUDGET + 6 (+5 is VAR_F32_MODE).
- TRANSLATOR_VERSION 9.
- d3d12x/bind.rs: the bounded ExecuteIndirect call runs inside
  fresh_indirect_arguments.
- d3d12x/list_x.rs: tracked_list_type, and transition (pub(super)) over the
  batched transitions.
- recomp/mod.rs: compact backend and per-lane modules both kept; the
  oversized-structured-code fallback applies to translate after prepare.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Filip722

Filip722 commented Nov 24, 2026 •

Copy link
Copy Markdown

NVIDIA/Proton result on merged main 689f2db477c3c062cf162649781640ef8a977c18 (RTX 5060 Laptop GPU, 8 GB, Bazzite 44, NVIDIA 615.78.08, Proton Experimental 11.0-20261112, vkd3d-proton 4522cc1a8b1347f+ with local allocation changes).

The Windows MSVC release library tests filtered to hle::d3d12x::vram::tests reported 10 passed, 0 failed and 1 ignored. I ran the ignored churn_update_tile_mappings_timing test separately with --exact --ignored --nocapture --test-threads=1. It passed. Its two arms in the same binary measured 4.3364 ms submit / 145.8408 ms GPU done for 8,192 mapping calls, and 0.2284 ms / 13.9941 ms for 256 mapping calls. Each arm submitted 256 signals. This is a synthetic measurement on one laptop.

A separate offline Series X run on the same build reached loading artwork. The final report recorded 2,321 shown frames and 2,321 PresentX calls. Activity samples recorded 62,502 DirectStorage requests and zero failures. The run ended at the title watchdog with no logged D3D12 device removal or NVIDIA Xid. The host had 16 GiB of RAM and 32 GiB of NVMe swap plus zram. World entry remains unverified on this configuration.

OpenAI Codex (GPT-6.2-astra) built the Windows target, ran the tests under Proton, and prepared this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@tatazildo

Copy link
Copy Markdown

Independent NVIDIA Ampere benchmark

Tested the merged implementation on commit 689f2db.

Hardware and environment:

  • CPU: Intel Core i9-13900K
  • GPU: NVIDIA GeForce RTX 3080 Ti (12 GB, Ampere)
  • Driver: 621.24
  • RAM: 64 GB DDR4
  • OS: Windows 11 Pro, build 26300

Ran the following benchmark:

cargo test --locked --release -p xcl churn_update_tile_mappings_timing -- --ignored --test-threads=1 --nocapture

Results

256 x 2 MiB textures:

Metric Before After Speedup
CPU submission 579.3994 ms 15.8626 ms 36.5x
GPU completion 583.3308 ms 24.6638 ms 23.7x
UpdateTileMappings calls 8,192 256 32x fewer
Signal calls 256 256 Unchanged

Test result: 1 passed, 0 failed (0.93s).

The complete sequential workspace test suite also completed successfully on this commit:

  • Library: 926 passed, 0 failed, 25 ignored.
  • Entire workspace: 975 passed, 0 failed, 45 ignored.
  • Some hardware-dependent and optional cases were internally skipped.

The contiguous tile allocation and sparse VRAM descriptor/buffer tests also passed.

This provides independent synthetic validation of the optimization on NVIDIA Ampere. No device hangs or device removal errors were observed during this benchmark.

AI disclosure: ChatGPT assisted with diagnostic analysis and preparation of this comment.

@qcdaark

qcdaark commented Nov 25, 2026

Copy link
Copy Markdown

A possible regression after this PR, for whoever owns vram::Pages now: on main 6567c5f (has this PR), 2 of 4 runs of the retail title from #675 ended in a Copy Engine page fault on a tiled title texture. I didn't see this in ~10 runs the same evening on trees based on c160d86, which doesn't have this PR. Not bisected, so treat it as a lead, not a verdict.

Setup: RTX 3070 Ti 8 GB, driver 621.24, Ryzen 9 7900X, 32 GB, Windows 11 26300, release main 6567c5f, no other PRs. Env: XCL_PSO_WAIT_MS=50 XCL_ACTIVITY=1 XCL_NETWORK=0 XCL_PRESS_A_AT=25 XCL_PSO_TRACE=1. Nsight Aftermath on.

Both runs, from the Aftermath dump:

run 1 run 2
device removed 69.7 s 64.9 s
device state Error_DMA_PageFault Error_DMA_PageFault
fault Write, client/engine Copy Engine, "Failed to translate the virtual address" same
resource BC7_UNORM 1024×1024, 9 mips, 1,441,792 B, not placed, not destroyed BC7_UNORM_SRGB 1024×1024, same size, not placed, not destroyed
fault offset in the resource 0x120000 (tile 18) 0x60000 (tile 6)
first error in xcl.log title texture: upload failed: texture copy: D3D12 device removed (0x887a0006 …) same

So a copy into a reserved title texture writes to a 64 KiB tile in its range that has no mapping at that moment. That could be from the trimmed mapped ranges, or from tiles taken back to the pool / cooling before a copy that still targets them was done. The other 2 runs on the same build got further and ended in the usual split-wave64 hang from #675 instead.

Logs (user name removed) are runs G and H in the zip on #675 (gta6-hbo.zip). I can run a build with extra logging on this card if that would help.

AI use: Claude Code (Claude Opus 5.5) read the Aftermath dumps and logs and wrote this; I checked it before posting.

rrrarrra9 added a commit to rrrarrra9/xcl that referenced this pull request Nov 25, 2026
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)
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.

10 participants