Skip to content

[upstream #1743] Tests: the draw harness puts the memory windows in its heap - #385

Open
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1743
Open

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1743

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner

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 xcl-dev#680 test runs did not show this.

Part of xcl-dev#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


Mirror of xcl-dev#1743 (auto-synced, do not edit).

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

2 participants