Skip to content

Recompiler: honor MSG_GS_DONE emit and cut ops in Direct DXIL and HLSL - #2485

Open
fixgep wants to merge 1 commit into
xcl-dev:mainfrom
fixgep:fix/dxil-msg-gs-done-emit-cut
Open

fixgep wants to merge 1 commit into
xcl-dev:mainfrom
fixgep:fix/dxil-msg-gs-done-emit-cut

Conversation

@fixgep

@fixgep fixgep commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Honor s_sendmsg MSG_GS_DONE (msg == 3) emit and cut operations on stream 0 in both the Direct DXIL and HLSL geometry lowering paths, instead of only handling MSG_GS (msg == 2). Shader compilers fold the final vertex emit/cut into MSG_GS_DONE, which previously dropped the final emitted vertex and its strip triangle(s). Fixes #2412.

What is in it

  • Handle msg == 2 || msg == 3 with op != 0 && stream == 0 in s_sendmsg (crates/xcl/src/gpu/dxil/lower_geom.rs)
  • Handle msg == 2 | 3 on stream == 0 in s_sendmsg for Mode::Geometry (crates/xcl/src/gpu/recomp/emit.rs)
  • Add synthetic DXIL/HLSL validation, HLSL emission, and GPU mesh-draw tests covering MSG_GS_DONE emit (0x23), cut (0x13), emit+cut (0x33), nop (0x03), and non-zero stream (0x123) (crates/xcl/src/gpu/dxil/geometry_tests.rs)

Tested

  • hardware: NVIDIA GeForce RTX 3060 (driver 32.0.15.9144), AMD Ryzen 5 7500F 6-Core Processor, Windows 11 (10.0.26200.0), rustc 1.100.0 (0ef1bc386 2026-11-09), debug (tests) / release (smoke)
  • cargo build --workspace (45e70181): 0 errors, 0 new warnings
  • cargo test -p xcl --lib dxil::geometry_tests -- --test-threads=4 (45e70181): 7 passed, 0 failed, 0 ignored
  • cargo test -p xcl --lib geometry -- --test-threads=4 (45e70181): 14 passed, 0 failed, 0 ignored (1 SKIPPED GPU test: gpu_geometry_wave32_prefix_count_over_a_mask: no wave64)
  • XCL_ADAPTER=warp cargo test -p xcl --lib geometry -- --test-threads=4 (45e70181): 14 passed, 0 failed, 0 ignored (6 SKIPPED GPU tests on WARP)
  • cargo test -p xcl --lib recomp -- --test-threads=4 (45e70181 code): 400 passed, 1 failed (pre-existing gpu::recomp::tests::gpu_clamp_and_omod_per_instruction on v_pk_add_i16 clamp), 20 ignored (23 SKIPPED GPU lines: 20 no wave64, 3 refused (unsupported ...) in lower_dxil::tests)
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (45e70181): xcl --lib 1311 passed, 1 failed (pre-existing gpu::recomp::tests::gpu_clamp_and_omod_per_instruction), 27 ignored (25 SKIPPED GPU lines: 21 no wave64, 3 refused (unsupported ...) in lower_dxil::tests, 1 cannot disable the driver cache); integration (xcl --test '*') 126 passed, 0 failed, 20 ignored (1 SKIPPED GPU test: no heap windows)

Regression run


xcl-smoke v1
commit: 889ef3e8aa7f267323ab4879e735e65da6bcef10
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 964 (PresentX 965)
presents per 2 s (last 3): 59 61 59
device removals: 0
crashes: 0
peak commit: 14836 MB


xcl-smoke v1
commit: 45e7018140f8163e20814a0b7af52099f86fdccd
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1605 (PresentX 1605)
presents per 2 s (last 3): 60 62 60
device removals: 0
crashes: 0
peak commit: 13971 MB

Not tested

  • AMD or Intel GPUs, wave64-native hardware (21 no wave64 GPU skips on this adapter), and retail geometry shaders using MSG_GS_DONE emit/cut (the smoke title does not confirm hitting this path)

AI use

@fixgep
fixgep force-pushed the fix/dxil-msg-gs-done-emit-cut branch from 91dcf99 to c256c7e Compare November 25, 2026 20:14

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking Direct-DXIL correctness defect found. The GS_DONE handling is consistent with the supported AMD message operations, and the new tests cover emit/cut/NOP plus stream filtering. Nonblocking coverage gap: the new GPU case only runs split-wave64 lowering; please add a native-wave64 run when supported. Separately, the HLSL backend still treats GS_DONE as a no-op; that appears to be a pre-existing parity follow-up rather than a defect in this PR.

@DarkPanda69

DarkPanda69 commented Nov 25, 2026 •

Copy link
Copy Markdown

Update for head 45e7018: it now applies to main b49be18, so this rerun is paired against main, with XCL_DIRECT_DXIL=1, same cards. On both, the only result changes are gpu_geometry_msg_gs_done_records, msg_gs_done_emits_in_dxil and msg_gs_done_emits_and_cuts_in_hlsl, all ok, with no new skips. RX 9070 XT: 708 → 711 passed, 2 failed (#2115, the same on main), 6 SKIPPED. RTX 3060: 710 → 713 passed, 0 failed, 24 SKIPPED.

AMD native wave64 run (listed as untested), plus an RTX 3060: the new GPU test passes on both, with the direct translator on.

Head c256c7e as is (on main 6d12f58), debug, Windows 11 Pro 26200, XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4:

Not tested: retail geometry shaders that use MSG_GS_DONE.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@ahmetbagci8

Copy link
Copy Markdown

Tested

  • Commit: c256c7ea96ce14db6d165e30ba0360cfcdf3c0db
  • Hardware / OS: Intel Core i7-11800H, NVIDIA GeForce RTX 3070 Laptop GPU (driver 32.0.16.1714), Windows 11 Pro (Build 26300), DXC v1.9.2609
  • cargo test -j 2 -p xcl --lib geometry -- --test-threads=4: 13 passed; 0 failed; 0 ignored (5.55s)

Not tested

  • Full workspace suite and scripts/smoke.ps1 (no unpacked title locally).

AI use

  • Antigravity harness (Gemini 4 Neon) ran the targeted unit tests on this commit and drafted this report; the author reviewed it before posting.

@emirduran707

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) test report on exact head c256c7ea96ce14db6d165e30ba0360cfcdf3c0db (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1423 passed, 2 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.
    • Both PR tests passed (no skips): gpu::dxil::geometry_tests::msg_gs_done_emits_in_dxil and gpu_geometry_msg_gs_done_records.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722 and fuzz_validate_and_gpu_3 seed 1599) are pre-existing on unmodified main on this GPU.

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release)

xcl-smoke v1
commit: c256c7ea96ce14db6d165e30ba0360cfcdf3c0db
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1611 (PresentX 1612)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14100 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.

@Oliwettoo

Copy link
Copy Markdown

Heads-up: #2485, #2494 and #2509 make the same change (MSG_GS_DONE runs its emit/cut op like MSG_GS, #2412). Read from the diffs (c256c7e, 3da50b0, 4bc111d), not run:

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 26, 2026
…ev#2446, xcl-dev#2503

Integrates direct DXIL graphics shader flags (xcl-dev#2451), PS live-lane
v_readfirstlane/SCC (xcl-dev#2501), MSG_GS_DONE emit/cut (xcl-dev#2485), VS/PS scalar
reload CSE (xcl-dev#2446), and per-lane V_CMP EXEC masking (xcl-dev#2503).

Assisted-by: Antigravity (Gemini 4 Neon)
@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

In RDNA2 geometry shaders, s_sendmsg MSG_GS_DONE (msg == 3) shares the same op (0 = nop, 1 = cut, 2 = emit, 3 = emit + cut) and stream fields as MSG_GS (msg == 2), and shader compilers fold the final vertex emit/cut into MSG_GS_DONE. Both lower_geom.rs and recomp/emit.rs previously checked only msg == 2, dropping the final vertex and its strip triangle(s).

Fixes xcl-dev#2412
Assisted-by: Antigravity (Gemini 4 Hydrogen)
@fixgep
fixgep force-pushed the fix/dxil-msg-gs-done-emit-cut branch from c256c7e to 45e7018 Compare November 26, 2026 04:32
@fixgep fixgep changed the title Recompiler: honor MSG_GS_DONE emit and cut ops in Direct DXIL Recompiler: honor MSG_GS_DONE emit and cut ops in Direct DXIL and HLSL Nov 26, 2026
@fixgep

fixgep commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Oliwettoo Thanks for flagging the HLSL gap. Updated 45e70181 (rebased onto main) so crates/xcl/src/gpu/recomp/emit.rs also honors MSG_GS_DONE (msg == 3) emit and cut ops on stream 0, alongside synthetic HLSL emission tests (msg_gs_done_emits_and_cuts_in_hlsl) and GPU mesh_draw coverage for both Direct DXIL and HLSL in gpu_geometry_msg_gs_done_records.

@oni-swr

oni-swr commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Independent native AMD test report for #2485 (issue #2412) on exact head 45e7018140f8163e20814a0b7af52099f86fdccd, against its exact parent b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 (main). Both were clean detached checkouts with no local changes. This is a test report only, not a source review.

Tested

  • Hardware and software: AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 build 26200, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.8.2502.11 from Windows SDK 10.0.26100.0, debug build. The suite log names AMD Radeon RX 7800 XT as the adapter.
  • The GPU was idle for the run: no other project process was using it, and the suite was the only GPU work.
  • Whole suite, head: cargo test -j 4 --workspace --no-fail-fast -- --test-threads=4: 1437 passed, 1 failed, 47 ignored. The failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, seed 722: res[30] = 0x1, CPU 0x7fffffff.
  • Whole suite, parent (same command): 1431 passed, 4 failed, 47 ignored. The seed-722 failure is the same, so it is a baseline AMD failure and not caused by the PR. The other 3 parent failures were cross_queue_wait64_before_signal_does_not_deadlock_submit_thread, placed_title_textures_share_vram_and_preserve_pixels and fine_timer_makes_short_sleeps_short. That run took 241 s against 38 s for the head's lib run, and the 3 passed when I reran them alone with --test-threads=1 (3 passed, 0 failed). I take them as load-dependent timing failures, not a PR effect.
  • SKIPPED lines (identical on head and parent, 7 each): 6 f16_programs_on_the_gpu / f32_programs_on_the_gpu cases (refused ... its #1426 semantics differ), and heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows. None of them is a geometry test.
  • cargo test -j 4 -p xcl --lib geometry -- --test-threads=1: 14 passed, 0 failed. This includes gpu_geometry_msg_gs_done_records, msg_gs_done_emits_in_dxil and msg_gs_done_emits_and_cuts_in_hlsl. The GPU test ran and was not skipped.
  • gpu_geometry_msg_gs_done_records runs both lowering paths (Direct DXIL and HLSL) through runner::mesh_draw on this adapter and checks vertex and triangle counts and record contents:
    • emit 0x23 and emit+cut 0x33: 3 vertices and 1 triangle per primitive, on both paths.
    • nop 0x03 and nonzero stream 0x123: 2 vertices and 0 triangles, on both paths.
  • Cut 0x13 is covered only by the string-level HLSL test (xcl_strip = 0u;). I did not measure it on the GPU.
  • Control: I ran the head's geometry_tests.rs against the parent's source, and all 3 new tests fail there. The GPU test fails with direct simm=0x23: vertex count.

Regression run

  • Not run. I ran no scripts/smoke.ps1 and used no title or game data.

Not tested

  • NVIDIA and Intel, wave32-only adapters, release builds, XCL_DIRECT_DXIL combinations beyond what the tests set, and retail titles.

AI use

  • The test run and this report were written by Claude Code (Claude Sonnet 5.5), coordinated by Codex (gpt-6.2-sol). The commands and counts above come from the runs in the logs.

🤖 Generated with Claude Code

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.

Direct DXIL: s_sendmsg MSG_GS_DONE (msg == 3) silently drops emit/cut ops

8 participants