Skip to content

Tests: bind both descriptor heaps before the arena root signature - #2978

Draft
luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/runner-arena-sampler-heap
Draft

luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/runner-arena-sampler-heap

Conversation

@luckyteagirl

Copy link
Copy Markdown
Contributor

The GPU arena test runner bound only its resource descriptor heap before setting a root signature with direct indexing enabled for both resource and sampler heaps. An earlier RX 6800M debugger run stopped in SetComputeRootSignature, before dispatch. Binding a shader-visible sampler heap alongside the resource heap makes the existing one-window and four-window regression tests pass when run in isolation.

The binding order follows the Shader Model 6.6 dynamic resource specification. This follows up on the RX 6800M report in #42.

What is in it

  • crates/xcl/src/gpu/recomp/runner.rs creates and binds a one-entry sampler heap in the arena test runner and retains it through GPU completion.

Tested

  • AMD Radeon RX 6800M, driver 30.0.13002.13003, Ryzen 9 5980HX, Windows 11 build 26200.9711, Rust 1.99.0 x64 MSVC, debug, SDK DXC/DXIL 1.8.2502.11.
  • With XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=1, XCL_NETWORK=0, CARGO_INCREMENTAL=0, and a separate DXIL cache path per run, tested gpu::dxil::core_tests::raw_loads_in_root_windows_respect_exec_and_bounds using cargo test --offline --locked -p xcl --lib -j 1 <test> -- --exact --nocapture --test-threads=1. Tested gpu::recomp::tests::gpu_unified_memory_arena by running the built libtest executable with the same test flags.
  • Clean main c2ee10e4 aborted both invocations with 0xc0000005 before libtest produced counts. Clean candidate 833ebaec passed both, 2 passed, 0 failed, 0 ignored, 0 capability skips across the two invocations. git diff --check passed.
  • On clean candidate 833ebaec, cargo +stable build --workspace --locked -j2 passed. cargo +stable test --workspace --locked -j2 --no-fail-fast -- --test-threads=4 completed all 38 targets with 1,259 passed, 197 failed, 47 ignored, and 12 explicit skips. The 12 skip reports comprised six no-GPU or device-unavailable reports, three unavailable debug-layer reports, and one each for native 16-bit operations, 64-bit heap atomics, and heap windows.
  • The four-window raw-load test passed in the workspace run. All failures were in the lib target. The first reported fuzz failure returned 0x887A0005 from CreateComputePipelineState, and later tests reported the same suspended-device failure. A fresh process running only gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 with --exact --nocapture --test-threads=1 returned the same device-removal error, with 0 passed, 1 failed, 0 ignored, and 0 skips.
  • The same isolated fuzz shard with the integrated AMD Radeon(TM) Graphics adapter selected validated 500 modules and performed 0 GPU comparisons. Its libtest status was 1 passed, 0 failed, and 0 ignored.

Not tested

  • GPU execution on another adapter or driver and retail titles were not verified. The changed function is only used by tests in this tree. This diff can use the maintainer's test-only approval for the smoke check.

AI use

  • OpenAI Codex (GPT-6.2 Sol) inspected the failure logs and source, implemented the binding change, ran the comparisons, and drafted this description.

The shared compute ABI root signature requests direct indexing for both descriptor heap types. The arena harness bound only the resource heap, violating the root-signature binding contract and reproducing a driver access violation on RX 6800M.

Assisted-by: OpenAI Codex (GPT-6.2 Sol)
@luckyteagirl

Copy link
Copy Markdown
Contributor Author

Could a maintainer review this one-file diff for the test-only label? The changed run_in_region path is called only through run_in_arena from #[cfg(test)] modules (tests, heap_window_tests, and link_tests). The runtime-file path makes the PR description check request paired retail smoke, but a retail run cannot exercise this test runner. I have left the PR as a draft and reported the exact full-suite failures separately in Tested; the label would waive only the smoke requirement, not those test failures.

AI use: OpenAI Codex (GPT-6, exact serving variant unavailable) checked the current call sites and drafted this request.

@SzczepanGrela

Copy link
Copy Markdown

RX 9070 / RADV / Wine verification of exact head 833ebaeca1cc84121a473f88c09fa718dc9581d1 against its parent and the main used at test start, c2ee10e4e905eb736e56953c52b749e18bcc7ede.

Tested

  • RX 9070 16 GB, RADV GFX1201 / Mesa 26.3.1-arch3.5, Ryzen 7 7700, CachyOS 7.3.0-5-cachyos. Windows GNU release executables, Rust 1.97.1, GE-Proton11-12 / Wine 11.0 Staging, native DXGI/D3D12 through vkd3d-proton 8293130ebe370b1+ (local asserts-disabled build), DXC/DXIL 1.9.2602.17.
  • Separate main/head source copies. The parent is exactly the tested main, so the only upstream delta is the sampler-heap binding. Original tests, shader paths and assertions preserved. Test-only passive captures record the actual SetDescriptorHeaps arguments, execution phases, registers and complete committed-window memory before and after completion.
  • Build each: cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics.
  • Original filters: gpu::recomp::tests::gpu_unified_memory_arena and gpu::dxil::core_tests::raw_loads_in_root_windows_respect_exec_and_bounds, each isolated with --exact --nocapture --test-threads=1, separately with XCL_DIRECT_DXIL=0 and =1.

On both main and head, all eight isolated invocations report 1 passed, 0 failed. Each source also runs both filters together with --test-threads=4, once per environment setting: all four group invocations report 2 passed, 0 failed. The one-window test exercises HLSL/direct native wave64; the four-window test explicitly runs direct native wave32, native wave64 and split wave64.

The baseline already works on this Wine/RADV stack. These runs do not reproduce the Windows RX 6800M SetComputeRootSignature crash. Captures show the intended argument change: main passes only the resource heap; head passes the resource heap and a shader-visible sampler heap with one descriptor, before setting the same root signature. Every recorded arena call reaches dispatch, fence completion and readback.

Additional owned filter <unit.exe> gpu::recomp::tests::workflow_bound_windows::workflow_bound_arena_matrix --exact --nocapture --test-threads=1, three fresh processes per source: 1 passed, 0 failed in all six runs. Each process has 72 arena dispatches:

  • 1/4 committed windows with root-UAV options, and 1/4/8/16 with heap-window options, 64 KiB per window.
  • HLSL/DXC and direct DXIL; native wave32, native wave64 and split wave64; full and partial EXEC masks.
  • Scalar loads from the last window, vector two-dword loads and stores between different windows, distinct per-window data, inactive result sentinels, 16 SGPR and 16 VGPR guards, and preserved SCC.

All scalar/vector readbacks and CPU-visible stores match independent references. The complete before/after memory images contain only the expected active-lane stores; unchanged regions and inactive destinations agree. Shader containers and targeted data repeat across sources and fresh processes.

Across the original and owned tests: 464 arena GPU dispatches, 232 per source, plus 12 separate physical-width probes: 476 captured GPU dispatches, including 166 physical native-wave64 dispatches. Actual heap-argument arrays and phase order were checked on every arena call. Independently recomputed 514 MiB of complete CPU-visible before/after snapshots, plus register, guard and width readbacks. The owned RDNA2 program was independently re-encoded from the public ISA tables. 0 ignored, 0 skipped, no device-removal markers.

Inherited XCL_* cleared; XCL_NETWORK=0, RX 9070 selected, XCL_REQUIRE_GPU=wave64, XCL_DXC_THREADS=1; private enabled caches per process.

Not tested

The native-Windows RX 6800M crash, actual texture/sampler reads, all other arena callers, full suite, graphics/guest execution, other GPUs, retail workload, scripts/smoke.ps1, timing or FPS. Main advanced to 83b008188efbf954b846667f48d75e3fa9310a01 during final review; its complete two-file delta adds the XCL_PREPARE=0 startup switch, its CPU test and README text, and does not touch this arena path. That newer main was reviewed but was not built or GPU-tested here; XCL_PREPARE was unset in these runs.

AI use

OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the owned test-only matrix and passive captures, ran comparisons, independently verified heap arguments, memory/register results, guards, wave widths and source/executable provenance, and drafted this report. Publication authorized by the account owner.

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 27, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 833ebae

No open or merged PR makes this change. Main's runner.rs::run_in_region still calls SetDescriptorHeaps with only the CBV/SRV/UAV heap. The root signature from pso.rs sets both CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED and SAMPLER_HEAP_DIRECTLY_INDEXED, and SM 6.6 requires both heaps to be bound before the root signature is set, so binding a one-entry sampler heap is correct. The other runner paths (bind_resources, bind_views) already bind both heaps. #2518 does the same kind of fix for console_list in the runtime, which is a different code path. The PR conflicts with main now; the failing check is the PR description check.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

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.

3 participants