Recompiler: split-form geometry keeps the ES and GS phases apart in programs with branches #1689
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!1689
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1689/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?
@bmjask on GitHub · 2026-11-24 19:18 UTC · original
bmjask:recomp/split-geometry-fix→main· +68 −6 · 2 files · 1 commits · merged 2026-11-24 20:03 UTCIn the split wave64 form of geometry mode (GPUs with 32-lane waves only, e.g. NVIDIA), the ES and GS run as two phases of one body on the guarded block chain:
pcstarts at 0 for the ES and atgs_startfor the GS.structured_spancould pick a structured stretch that ran across the ES'ss_setpc_b64, becauseterm()does not treat it as a branch. So in any geometry program with a branch, the ES phase fell through into the GS code, and the GS phase had noif (pc == gs_start)entry. The GS phase then ran nothing and the records came out empty.What is in it
crates/xcl/src/gpu/recomp/mod.rs: in the split form (phase_split),structured_spannow stops at the ES'ss_setpc_b64. The ES phase ends there (pc = select(xcl_es_phase, 0xFFFFFFFFu, gs_start)) and the GS phase enters atgs_start. The native wave64 form does not take this path, so its output is unchanged.crates/xcl/src/gpu/recomp/tests.rs: the program fromgpu_geometry_mode_es_gs_stripis now built by a helper and has a variant with branches: an ES forward branch, a GS EXEC-zero skip and a GS scalar loop. It keeps the cut and the partial last group (25 triangles = 21 + 4).gpu_geometry_mode_es_gs_strip_with_branches: on the GPU, checks every record vertex by vertex and the strip triangles.geometry_split_phases_with_branches_have_entry_and_exit: checks the HLSL shape (each phase's entry and exit) without a GPU, and that the native form still translates completely.Tested
group 0: vertices / trianglesare 0/0). After the fix both pass, and so does the existing strip test.cargo test -p xcl --lib gpu::recomp: 196 passed, 0 failed, 18 ignored.cargo test --workspace -- --test-threads=4: 807 passed, 4 failed, 22 ignored (SKIPPED GPU tests:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware, no wave64).title_texturesx2,vram::d32s8_targets...,dstorage::a_destination_page_filled_in_after_enqueue) while other cargo jobs were running on the machine.Regression run
main:
PR:
Performance: frames 100.3 % of main, peak commit 99.1 % of main. I expected no change: only split-form geometry programs with branches compile differently.
Not tested
AI use
🤖 Generated with Claude Code
@Aniseto on GitHub · 2026-11-24 19:30 UTC · original
Ran the geometry tests at
87d421b:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
This adapter has no native wave64, so console ES+GS programs run in the split form; the two new tests are exactly that path and pass here:
geometry_split_phases_with_branches_have_entry_and_exitgpu_geometry_mode_es_gs_strip_with_branchestogether with the existing geometry tests in the same filter (6 passed).
Not tested: native wave64, RDNA2/RDNA4 and Intel GPUs, Wine, release profile, retail titles.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; no local changes were made.
@MatyEjsr on GitHub · 2026-11-24 20:12 UTC · original
Verified PR #1689 at head commit
87d421b4a966cb01e3f1225ee6d871f03007c408on an NVIDIA wave32-only GPU: the fix works as described and the full workspace test suite passes cleanly with zero failures.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), debug build, DXCdxcompiler 1.9.2602.17/dxil 1.9.2602.17cargo build --workspace -j 8: succeeded in 12.25scargo test -p xcl --lib geometry -j 8 -- --nocapture: 5 passed, 1 SKIPPED (gpu_geometry_wave32_prefix_count_over_a_mask: no wave64), 0 failed, 0 ignored (0.29s); bothgpu_geometry_mode_es_gs_strip_with_branchesandgeometry_split_phases_with_branches_have_entry_and_exitran and passed on the RTX 3090cargo test -p xcl --lib gpu::recomp -j 8 -- --test-threads=8: 194 passed, 2 SKIPPED (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware: no wave64), 0 failed, 18 ignored (4.05s)cargo test --workspace -j 8 -- --test-threads=8: 857 passed, 3 SKIPPED (gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware: no wave64;heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows), 0 failed, 42 ignored (860 reported passed by cargo; lib suite 14.26s)Review notes (confirmed on
87d421b)Two related edge cases in
crates/xcl/src/gpu/recomp/mod.rsremain worth considering (either here or as a follow-up):term()only treatsF_TERMINATORasTerm::Other, whereasS_SETPC_B64hasflags = 5(F_BRANCH | F_INDIRECT, noF_TERMINATOR). As a result, unresolvedS_SETPC_B64still returnsTerm::Next(despiteTerm::Other's comment mentionings_setpc). Because the new break instructured_spanis gated onc.phase_split, a native wave64 (split_wave64: false) ES with an earlys_setpc_b64(for example two branches each ending ins_setpc_b64) still merges the firsts_setpc_b64intostructured_spanand lets that branch fall through into the second ES branch instead of jumping togs_start. ReturningTerm::Otherfor unresolvedS_SETPC_B64interm()would handle both split and native forms without needing thephase_splitflag.structured_span,entered_insideonly checksc.edges(fromrdna2::branch_target), which does not includegs_start. If any block withoutS_SETPC_B64sits between the ES'ss_setpc_b64andgs_start(confirmed with a synthetic ES ending ins_setpc_b64followed bys_nop 0ors_code_endpadding beforegs_start),structured_spanstarting at that intervening block still merges acrossgs_startand omitsif (pc == <gs_start>u). Treatinggs_startas an entry boundary instructured_span(stopping beforegs_startwhenj > i, or recording it as an entry target) closes this case as well.Not tested
AI use
87d421b, and drafted this report.@DavidM1911 on GitHub · 2026-11-24 21:47 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@bmjask on GitHub · 2026-11-24 22:28 UTC · original
@MatyEjsr thanks for the verification on the RTX 3090 and for the two edge cases. Both were real. In native wave64, an early
s_setpc_b64on one ES branch fell through into the other branch, and padding beforegs_startcould lose its entry. Both are fixed in #1873 (draft, smoke pair pending), with a regression test for each that fails onmain. I made the change instructured_spanrather than interm(), so non-geometry programs keep their current lowering. If you can, please re-check your synthetic cases against #1873.AI use: Claude Code (Claude Opus 5.5) wrote this comment for @bmjask.