Skip to content

Tests: the draw harness puts the memory windows in its heap - #1743

Open
Retried wants to merge 1 commit into
xcl-dev:mainfrom
Retried:tests/draw-heap-window-views
Open

Retried wants to merge 1 commit into
xcl-dev:mainfrom
Retried:tests/draw-heap-window-views

Conversation

@Retried

@Retried Retried commented Nov 24, 2026

Copy link
Copy Markdown

With XCL_HEAP_WINDOWS=1, three retail tests in gpu_pso_e2e fail on any GPU: retail_vs_ps_through_the_pso_hook_render_and_read_back, retail_pipelines_built_in_the_background_behind_a_stand_in and retail_textured_ps_decoded_descriptors_and_a_descriptor_change_between_draws. Each image comes back as the clear colour. The cause is the test harness, not the heap form. A pipeline built by the backend's hook reads memory window k through ResourceDescriptorHeap[MEM_HEAP_BASE + k]. The console heap keeps those slots for the window views, and the title's views come after them. runner::draw_on / draw_on_multi instead bound a heap of their own with no window views and the textures at 2·i, so the VS read an empty slot and drew nothing. The compute runner already fills the window slots (dispatch_with); the graphics path did not. The tests need XCL_SAMPLE_RPF, which is probably why the #680 test runs did not show this.

Part of #680 (heap windows on by default needs the whole suite green in both forms).

What is in it

  • Tests: the draw harness puts the memory windows in its heap:
    • crates/xcl/src/gpu/recomp/runner.rs: bind_views puts a raw UAV of mem in every window slot (MEM_HEAP_BASE..) and the textures from the new VIEW_HEAP_BASE (MEM_HEAP_BASE + MAX_WINDOWS, where the console heap's views start). Every draw goes through it.
    • The three textured tests use VIEW_HEAP_BASE as their texture index: crates/xcl/tests/gpu_pso_e2e.rs, crates/xcl/src/gpu/recomp/tests.rs, crates/xcl/src/gpu/dxil/graphics_tests.rs.

Tested

  • NVIDIA GeForce RTX 2070 SUPER (driver 621.35), Ryzen 7 5800X3D, 32 GB, Windows build 26300, rustc 1.100.0, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), debug
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_SAMPLE_RPF set) on 0e89e2c (this PR on 6c89285):
    • XCL_HEAP_WINDOWS unset: 863 passed, 0 failed, 42 ignored
    • XCL_HEAP_WINDOWS=1: 863 passed, 0 failed, 42 ignored. The first run of this form had 862 passed and 1 failed: test_title_draws_with_a_root_signature_under_the_debug_layer, where the test title hung after its triangle check. That test then passed alone 5 times out of 5, on 6c89285 and on this PR, about 2.7 s each. The draw harness is not on its path, and no runtime code calls it.
  • Before the rebase, on c160d86: with this PR, 858 passed, 0 failed, 42 ignored in both forms; without it, with XCL_HEAP_WINDOWS=1, 855 passed and 3 failed (the three tests above).
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64); with XCL_HEAP_WINDOWS unset also heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)

Regression run

The diff changes only test code (no runtime code calls the draw harness), but runner.rs lives in crates/xcl/src. Same title, same 60 s, XCL_TRANSLATED_CACHE=0, an empty XCL_DXIL_CACHE for each run; main ran first. This PR: 99.0 % of main's frames, 99.96 % of its peak commit, no device removal or crash.

xcl-smoke v1
commit: 6c89285b8b529bde59cd17a26b911c39912fb677
gpu: NVIDIA GeForce RTX 2070 SUPER
title: hehe
seconds: 60
exit: 0x0
frames shown: 1086 (PresentX 1087)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15592 MB
xcl-smoke v1
commit: 0e89e2c887159acd7f90c582bfcaeeb2c3f93ea6
gpu: NVIDIA GeForce RTX 2070 SUPER
title: hehe
seconds: 60
exit: 0x0
frames shown: 1075 (PresentX 1075)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15586 MB

Before the rebase onto 6c89285, one head run (01ed927) reached only 553 frames: after loading it held 28 presents per 2 s where main had 60. Three reruns in a row (head 1094, main 1057, head 1062 frames) all held 60.

Not tested

AI use

  • Claude Code, Claude Opus 5.5: found the cause, wrote the change and this description, ran the tests and the smoke runs. I reviewed the diff.

🤖 Generated with Claude Code

With XCL_HEAP_WINDOWS=1 a pipeline built by the backend's hook reads
memory window k through ResourceDescriptorHeap[MEM_HEAP_BASE + k], as
the console heap lays it out (window views first, the title's views
after them). runner::draw_on / draw_on_multi bound a heap of their own
with the textures at 2*i and no window views, so the retail VS/PS of
gpu_pso_e2e read an empty slot, drew nothing and left the clear colour:
three tests failed only in the heap form. The compute runner already
fills the window slots; the graphics one did not.

bind_views now puts a raw UAV of `mem` in every window slot and the
textures from VIEW_HEAP_BASE (MEM_HEAP_BASE + MAX_WINDOWS) on, and every
draw goes through it; the three textured tests use that index.

RTX 2070 SUPER (driver 621.35), DXC 1.9.2602.17,
cargo test --workspace --no-fail-fast -- --test-threads=4:
- XCL_HEAP_WINDOWS unset: 858 passed, 0 failed, 42 ignored
- XCL_HEAP_WINDOWS=1: 858 passed, 0 failed, 42 ignored
  (before: 855 passed, 3 failed: retail_vs_ps_through_the_pso_hook_*,
  retail_pipelines_built_in_the_background_*, retail_textured_ps_*)

Assisted-by: Claude Code (Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Retried
Retried marked this pull request as ready for review November 24, 2026 20:09
@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 0e89e2c (on its base 6c89285).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 862 passed, 0 failed, 42 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • No new #[test] functions in the diff.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 863 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not set XCL_REQUIRE_GPU, so there both just print SKIPPED.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@Retried

Retried commented Nov 24, 2026

Copy link
Copy Markdown
Author

I am not going to follow this PR up any further. It is finished as described, and maintainers can edit the branch, take it over or close it.

If #1695 or #1669 lands first, the draw harness has to follow the new heap layout. That means VIEW_HEAP_BASE = MEM_HEAP_NULL + 1 in runner.rs and the null view in bind_views, as the description says under Not tested.

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

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

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants