Recompiler: direct DXIL geometry shaders read ES inputs from window 0's heap view #2254
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2254
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2254/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@joeypercia on GitHub · 2026-11-25 11:28 UTC · original
joeypercia:dxil-gs-heap-window-inputs→main· +25 −1 · 2 files · 1 commits · closed without mergingWith the memory windows in the descriptor heap (
XCL_HEAP_WINDOWS=1, the setting #2057 runs with), the direct DXIL translator refuses 158 of the newer retail title's 390 geometry shaders, and they fall back to the HLSL route (direct_fallback). The GS entry (geom_init) loads the ES outputs it reads (v9..) throughlw.mems[0]. In heap mode that's a placeholder whose handle is the constant0(kernel::mem_windows: "memsthen only counts them"), so the raw load gets ani32as its handle. The DXIL builder refuses that:function dx.op.rawBufferLoad.i32 redeclared with another type. Window 0 now comes from the heap (MEM_HEAP_BASE), as every other access in this mode takes it.Part of #1269 (fewer programs off the direct route).
What is in it
crates/xcl/src/gpu/dxil/kernel.rs:geom_inittakes window 0's raw view from the descriptor heap whenheap_memis set, andmems[0]otherwise (unchanged).crates/xcl/src/gpu/dxil/geometry_tests.rs:geometry_inputs_with_heap_windows_validate, the test program ofgeometry_forms_validatereading one ES input (v9), translated with 1 window, 4 root windows and 4 heap windows, wave64 and split. Without the change it fails with the error above, forwindows 0x104.Tested
XCL_ADAPTER=Radeon; Windows 11 Pro 26200; Rust 1.100.0 MSVC; DXC 1.8.2502.11; debug for the tests, release for the runs.cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4onc1e6807:main9633138on each adapter (run with the same filter):shader_cache_tests::rerouted_disk_entries_follow_the_direct_translatoranddevice_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaaon both, plusrecomp::tests::gpu_image_get_resinfo_past_last_levelandfuzz_tests::fuzz_validate_and_gpu_1on RDNA2.SKIPPED: RTX 4070 Ti: the wave64 cases of thelower/lower_dxilGPU tests,gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64). RDNA2: the mesh-shader tests,gpu_geometry_direct_recordsamong them. Both:heap_window_out_of_memory_falls_back_to_the_switch_form,pso_measurement_compiles_an_exact_synthetic_record(no Developer Mode),test_title_draws_with_a_root_signature_under_the_debug_layer,uploads_start_from_each_subresources_state, and thelower_dxilf16 / f32 cases the direct backend refuses.xcl shaders shaders.rpf --direct --sample 0 --windows 260 --validate:main: GS 232 of 390 translated (158 refused with the error above). CS 2689 / 2689, MS 9282 / 9282, PS 12101 / 12101 and VS 2236 / 2236.Regression run
RTX 4070 Ti (driver 621.40), release builds, 60 s each,
scripts/smoke.ps1 -Game <folder> -Title retail-titleon the newer retail title, run one after the other from the same shell, with the same settings. The runs stay on the menus, so they're a regression check only: they don't show a heap-window geometry shader being translated.main9633138(this PR's base) and this PR's head (no uncommitted changes):main:
PR:
Not tested
gpu_geometry_direct_records) runs one window only, and its program reads no inputs. This change only affects heap mode.AI use
With the memory windows in the descriptor heap (XCL_HEAP_WINDOWS=1), `mems` holds placeholders whose handle is the constant 0, and only counts the windows. The GS entry (`geom_init`) loaded the ES outputs it reads (v9..) through `mems[0]` directly, so the raw load took an i32 as its handle. The DXIL builder refuses that ("function dx.op.rawBufferLoad.i32 redeclared with another type"), and the direct route gives up on the shader. On the newer retail title's shader pack that is 158 of its 390 geometry shaders (`xcl shaders <pack> --direct --sample 0 --windows 260`): 232 translated before, 390 now, all of them validating. Window 0 now comes from the heap (`MEM_HEAP_BASE`), as every other access takes it in this mode.@itsSio on GitHub · 2026-11-25 12:07 UTC · original
Tested
Independent Windows verification on clean
c1e6807941d8951c111900b14cce7cef2c2543c6. Windows 11 Pro build 26200, x64 MSVC, unoptimized dev/test profiles with debug info off.cargo build --workspace --lockedexited 0 on both PCs.cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocaptureexited 101 on both:SKIPPED32.0.16.108832.0.16.1088On both PCs the failures were
rerouted_disk_entries_follow_the_direct_translator(68 vs 1) andpc_resource_desc_strips_uav_on_unsupported_formats_and_msaa(format 85, got 28). These match the assertions reproduced on an earlier main revision, not an exact-parent rerun for this PR. Both workspace results remain failing. The RTX 2080 SUPER logged two additional skips for the unavailable D3D12 debug layer.cargo test -p xcl --lib --locked gpu::dxil::geometry_tests:: -- --test-threads=1 --nocapture: 3 passed / 0 failed / 0 ignored, no runtime skips, on each RTX card and the Radeon RDNA2 iGPU (driver32.0.21043.5001, on the same Ryzen 7 system).geometry_inputs_with_heap_windows_validatepassed DXIL validation with heap-window inputs on both DXIL validator versions.gpu_geometry_direct_recordspassed separately; it is a one-window smoke and does not validate GPU output for heap-window inputs.Not tested
Heap-window geometry GPU readback with inputs, the exact parent, full AMD workspace, Intel, and retail smoke or performance.
AI use
Ran via Samaritan:
openai/gpt-6.2-sol): scoped and ran the Windows verification, checked both PCs' logs, and wrote this report. No subagents contributed to this check.@nnonno91 on GitHub · 2026-11-25 15:24 UTC · original
Independent Windows check of
c1e6807941d8951c111900b14cce7cef2c2543c6. The geometry translation tests passed, and the new heap-window test caught the original builder failure with the parent implementation.Tested
cargo test --locked -p xcl --lib gpu::dxil::geometry_tests -- --nocapture --test-threads=1on each selected adapter: 3 passed, 0 failed, 0 ignored, no logged skips per adapter. The new fixture checked translation with one window, four root windows, and four heap windows, in both native and split forms. The separate GPU test matched the expected geometry records on both adapters, using one window.kernel.rsfrom parent963313835813f475037b3a9f5fcc3cb591696928with the PR's test source.cargo test --locked -p xcl --lib geometry_inputs_with_heap_windows_validate -- --nocapture --test-threads=1: 0 passed, 1 failed, 0 ignored, no logged skips. For native translation with windows0x104, the old code rejected the shader withdx.op.rawBufferLoad.i32 redeclared with another type. Restored the clean checkout.Not tested
GPU execution of the heap-window fixture, retail titles, or the full workspace suite.
AI use
OpenAI Codex (GPT-6.2 Sol) prepared and ran the tests, verified the results, and wrote this report.
@oni-swr on GitHub · 2026-11-25 16:06 UTC · original
amd-win test report for head
c1e6807941d8951c111900b14cce7cef2c2543c6(exact PR head, not a merge; its merge-base withmainis96331383).Hardware: AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 26200, Rust 1.100.0, debug for tests, release for the smoke runs.
Focused test
cargo test -p xcl --lib geometry_inputs_with_heap_windows_validate: 1 passed, 0 failedcargo test -p xcl --lib gpu::dxil::: 147 passed, 1 failed (fuzz_validate_and_gpu_1, see below), 3 ignoredFull suite:
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4: 1240 passed, 4 failed, 46 ignored.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1,gpu::recomp::pso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translator,gpu::recomp::tests::gpu_image_get_resinfo_past_last_levelandhle::d3d12x::device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa. All 4 fail the same way on the merge-base96331383on this machine, so none is caused by this PR.f16_programs_on_the_gpuandf32_programs_on_the_gpu(several forms, "unsupported V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32"),heap_window_out_of_memory_falls_back_to_the_switch_form("no heap windows").Regression run (retail title, 60 s,
scripts/smoke.ps1 -Seconds 60, release builds of96331383and of the PR head; one run each, so run-to-run noise applies). These are not pastedxcl-smokeblocks: the script stamps the checkout's HEAD, and I ran both binaries from one checkout, so I quote the numbers instead.96331383(main)PR head is 97 % of main's frames, and its peak commit is 98 % of main's.
Not tested: NVIDIA, wave32-only GPUs, runs longer than 60 s, any title other than the one above. The change is to GS translation (ES inputs read from the heap view); I did not check whether the smoke run's title uses a direct-DXIL geometry shader, so the run is a regression check only.
AI use: this report was run and written by Claude Code (Claude Sonnet 5.5).
@DavidM1911 on GitHub · 2026-11-25 16:58 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.Thanks!
@throny on GitHub · 2026-11-25 18:29 UTC · original
Two contributors checked independently and found that this PR makes the same change as #2383: #1607, group D108. They suggest keeping #2383. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@raylitebull on GitHub · 2026-11-25 18:40 UTC · original
Diff review, green CI, and AMD/NVIDIA verification look good, though holding merge per the
#1607triage note (groupD108) preferring#2383because#2383also exercises live GPU execution (geometry_es_inputs_validate_and_run_with_heap_windows), unless there is a specific reason to take both.@ivall on GitHub · 2026-11-25 19:44 UTC · original
#2383 is merged now (
6d051da5), for the reason in the note above (it also runs the geometry path on the GPU). @joeypercia, does this PR still cover a case that #2383 does not? If so, please rebase down to that; otherwise it can be closed. Thanks for the fix and the tests either way.AI use: Claude Code (Claude Opus 5.5) wrote this on the maintainer's behalf; it did not compare the two diffs line by line.
@Prime1997 on GitHub · 2026-11-26 01:38 UTC · original
Closing because this fix is already on main through #2383 (merge commit
6d051da5). Incrates/xcl/src/gpu/dxil/kernel.rs,geom_initon main takes window 0 from the descriptor heap (heap_raw_buffer_uavatMEM_HEAP_BASE) whenheap_memis set and falls back tomems[0]otherwise, the same as this PR. Main'sgeometry_es_inputs_validate_and_run_with_heap_windowsvalidates the heap-window GS in split and native forms and checks the GPU output. The one case here that main does not test is 4 root windows with an ES input, which runs code this PR does not change.Compared at head
c1e68079against main08db802. Reviewed with Claude Code (Claude Fable 5.2); I checked the comparison before closing.Pull request closed