Skip to content

D3D12.X: an exhausted hosted view heap maps to the null pair, not 2*k (#2380) - #2405

Open
Creaa wants to merge 1 commit into
xcl-dev:mainfrom
Creaa:d3d12x/hosted-view-overflow-null
Open

Creaa wants to merge 1 commit into
xcl-dev:mainfrom
Creaa:d3d12x/hosted-view-overflow-null

Conversation

@Creaa

@Creaa Creaa commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

console_heap::slot already maps a hosted sampler heap's slots past the shared range to reserved slot 0 (sampler_unmapped_index), but a hosted CBV/SRV/UAV heap fell back to index 2 * k of the shared heap. There that can be another heap's views or the memory windows' raw views at MEM_HEAP_BASE, which hang the GPU when read as a texture (zero_tsharp_does_not_reach_window_views). A hosted view heap now takes the null SRV / UAV pair at 0 / 1 (null_views); unhosted heaps keep their own pair at 2 * k. Fixes #2380.

What is in it

  • crates/xcl/src/hle/d3d12x/console_heap.rs: view_unmapped_index(hosted, k) beside sampler_unmapped_index, used for the view fallback in slot; test hosted_view_slots_past_the_shared_range_take_the_null_pair.

Tested

  • RTX 4070 12 GB (driver 617.14), i7-13700F, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0; debug for the tests, release for the smoke runs.
  • cargo build --workspace succeeded. cargo test --workspace --no-fail-fast -- --test-threads=4 on 7118151 reported 1414 passed, 0 failed, 46 ignored. The 29 SKIPPED messages covered unsupported wave64 and direct-DXIL cases, unavailable heap windows and D3D12 debug layers, and the driver cache setting that requires Developer Mode. Skipped cases are included in the harness pass count. The hosted-view regression test and the split-mask barrier test reported by DavidM1911 both ran and passed.

Regression run

main:

xcl-smoke v1
commit: 06055a7a0fb43c5f83f55e7a2ce201417de171e9
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1564 (PresentX 1564)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16956 MB

this PR:

xcl-smoke v1
commit: 7118151c1b7b367f75418703b33064f1b3adcfdc
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1574 (PresentX 1575)
presents per 2 s (last 3): 60 43 55
device removals: 0
crashes: 0
peak commit: 18084 MB

Not tested

  • A run that exhausts the shared view heap: the fallback is reached only when it is full, which the smoke run does not do; the index choice is covered by the unit test.
  • AMD, other NVIDIA GPUs and drivers.

AI use

  • Claude Code (Claude Opus 5.5) wrote the change and the test, ran them and the smoke pair on my machine, and drafted this description; I checked it.
  • OpenAI Codex (GPT-6) rebased the unchanged patch, built and tested this head, ran both smoke checks, and updated the results.

🤖 Generated with Claude Code

hint: if you need to wait for this pull request to be reviewed, merged, or closed before continuing, use this instead of polling:
gh event listen --resource #2405 --event com.github.pull_request.review.submitted.v1,com.github.pull_request.state.changed.v1

  • It prints the first event as a JSON line on stdout and exits; run it again to wait for the next one.
  • Add --timeout to stop waiting after a while, for example --timeout 30m; it then exits with status 8.
  • Events carry no details; read the pull request to see what changed.
  • It misses changes made before it starts, so read the pull request once it is running.
  • See gh event listen --help for other event types.
  • Event subscriptions are in preview and may not be enabled for your account.

@emirduran707

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) test report on exact head b21afe2d655dd5c34076405fca6e9a76b53739e6 (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1288 passed, 3 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.
    • The PR's test passed: hle::d3d12x::console_heap::tests::hosted_view_slots_past_the_shared_range_take_the_null_pair.
    • The 3 failures are pre-existing on unmodified main 68a284a: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722) and fuzz_validate_and_gpu_3 (seed 1599) on this GPU, plus gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier (from 50a9fde / Recompiler: a bridged mask write in the split form meets no barrier #2074).

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release)

xcl-smoke v1
commit: b21afe2d655dd5c34076405fca6e9a76b53739e6
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1616 (PresentX 1616)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13956 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.

@Creaa
Creaa force-pushed the d3d12x/hosted-view-overflow-null branch from b21afe2 to 698e755 Compare November 25, 2026 18:37
@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib: 1 real failure, deterministic (also fails --test-threads=1, 1219/1):
gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier
  assertion failed: group barriers in the program (lower_dxil.rs:1155)

The lowered program is missing an expected group barrier (or emits one where none is expected). Needs a fix before merge.

— Devin

…xcl-dev#2380)

`slot` already maps a hosted sampler heap's slots past the shared range to
reserved slot 0, but a hosted CBV/SRV/UAV heap fell back to index 2*k of the
shared heap: another heap's views, or the memory windows' raw views at
MEM_HEAP_BASE, which hang the GPU when read as a texture. A hosted view heap
now takes the null SRV / UAV pair at 0 / 1 (`null_views`); unhosted heaps
keep their own pair at 2*k.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Creaa
Creaa force-pushed the d3d12x/hosted-view-overflow-null branch from 698e755 to 7118151 Compare November 25, 2026 19:34
@ahmetbagci8

Copy link
Copy Markdown

Tested

  • Commit: 7118151c1b7b367f75418703b33064f1b3adcfdc
  • Hardware / OS: Intel Core i7-11800H, NVIDIA GeForce RTX 3070 Laptop GPU (driver 32.0.16.1714), Windows 11 Pro (Build 26300), DXC v1.9.2609
  • cargo test -j 2 -p xcl --lib console_heap -- --test-threads=4: 13 passed; 0 failed; 0 ignored (0.07s)

Not tested

  • Full workspace suite and scripts/smoke.ps1 (no unpacked title locally).

AI use

  • Antigravity harness (Gemini 4 Neon) ran the targeted unit tests on this commit and drafted this report; the author reviewed it before posting.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 25, 2026
…#2404, xcl-dev#2405

Integrates VRAM top-mip pressure shedding (xcl-dev#2385), DXC wanted-compile
prioritization & worker headroom (xcl-dev#2423), inline split pipeline foreground
path (xcl-dev#2424), ExecuteIndirect split program dispatch (xcl-dev#2404), and hosted
view heap exhaustion null-pair fallback (xcl-dev#2405).

Assisted-by: Antigravity (Gemini 4 Neon)
@Creaa

Creaa commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@DavidM1911 Thanks for checking this on the 3060 Ti. I rebased the PR onto main with #2420, which narrowed the barrier assertion to the divergent part of the program. On the current head 7118151c1b7b367f75418703b33064f1b3adcfdc, I reran your failing test on an RTX 4070 with one test thread:

cargo test -p xcl --lib gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier -- --exact --test-threads=1

1 passed, 0 failed, 0 ignored. The full workspace run also finished with zero failures, and Windows CI passed on this head.

AI use: OpenAI Codex (GPT-6) ran the checks and drafted this reply.

@thehollowedone

Copy link
Copy Markdown

Independent Windows check of #2405 head 7118151, plus a clean local integration with main 6d12f58 after #2368 merged. The integration was uncommitted, conflict-free, and produced tree 8fcb1d762aea5469bbcefd0bf95cac38c75914c7; git diff --check passed.

Tested: RTX 3080 Ti (NVIDIA 621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, SDK DXC/DXIL 1.8.2502.11. Offline Cargo, XCL_NETWORK=0, XCL_ADAPTER=RTX 3080 Ti, SDK XCL_DXC_DIR, no optional D3D12 debug layer or sample data.

  • Exact head: cargo build --offline --locked --workspace --jobs 6 passed; cargo test --offline --locked -p xcl --lib console_heap --jobs 6 -- --test-threads=1 --nocapture passed 13/0/0, including hosted_view_slots_past_the_shared_range_take_the_null_pair and zero_tsharp_does_not_reach_window_views. The latter also passed individually 1/0/0. cargo test --offline --locked --workspace --no-fail-fast --jobs 6 -- --test-threads=4 --nocapture reported 1,414 passed, 0 failed, 46 ignored, with 26 runtime GPU skip notices.
  • Integration with main 6d12f58: the same workspace build passed; the same full-suite command reported 1,424 passed, 0 failed, 46 ignored, with 26 runtime GPU skip notices.

Not tested: actual exhaustion of a hosted descriptor heap during GPU execution or a retail smoke pair on this hardware. The focused tests check the fallback index and null-view layout with synthetic inputs; they do not demonstrate that a real GPU hang is resolved. AI-assisted. Codex (GPT-6, exact variant unavailable) reviewed the focused test coverage, ran the checks, and drafted this report.

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

No concrete source-level defect found. Hosted exhaustion maps index 0/1 to the reserved null SRV/UAV pair and skips publication, while unhosted behavior remains unchanged; current CI is green. Nonblocking coverage gap: the test calls view_unmapped_index directly rather than inducing hosted page_of exhaustion and asserting the slot/SRV/UAV hook path. An end-to-end exhaustion test would strengthen confidence.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 25, 2026
…#2404, xcl-dev#2405

Integrates VRAM top-mip pressure shedding (xcl-dev#2385), DXC wanted-compile
prioritization & worker headroom (xcl-dev#2423), inline split pipeline foreground
path (xcl-dev#2424), ExecuteIndirect split program dispatch (xcl-dev#2404), and hosted
view heap exhaustion null-pair fallback (xcl-dev#2405).

Assisted-by: Antigravity (Gemini 4 Neon)
@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
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.

D3D12.X: hosted view heap exhaustion aliases 2*k into GLOBAL (and MEM_HEAP_BASE) instead of slot 0

6 participants