Recompiler: run a s_sendmsg GS_DONE's emit/cut op like MSG_GS #2509

Open
github-bot wants to merge 1 commit from github-bot/gh-2509 into main AGit
Owner

@⁠kotekompotek on GitHub · 2026-11-25 21:09 UTC · original
kotekompotek:fix/gs-done-emit-cut → main · +159 −12 · 3 files · 1 commits · open

Fixes #2412.

s_sendmsg MSG_GS_DONE (msg 3) carries the same GS op field as MSG_GS (msg 2) — SIMM16[5:4]: 1 cut, 2 emit, 3 emit+cut, stream at [9:8] — and also marks the shader done. Both translators ran the op only for MSG_GS and silently dropped it on GS_DONE, so a geometry program that folds its final emit/cut into GS_DONE loses those records.

What is in it

  • gpu/dxil/lower_geom.rs (direct DXIL lowering) and gpu/recomp/emit.rs (HLSL backend, which even said "GS_DONE (3) – nothing to do") now run a GS_DONE's emit/cut op like MSG_GS's — stream 0, op != NOP.
  • geometry_tests.rs: a done_program whose only emit/cut rides MSG_GS_DONE; geometry_forms_validate / geometry_done_emit_cut_lowers see the op reach the DXIL and the emitted HLSL; gpu_geometry_done_emit_cut_records compares the produced records against the MSG_GS form's model (skips without a GPU).

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce GTX 1050 (driver supports up to SM 6.5, no mesh shaders), DXC 1.8.2502.11 (10.0.26100.0), rustc 1.98.1 stable-x86_64-pc-windows-msvc; debug tests, release smoke builds
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1352 passed, 7 failed, 46 ignored (SKIPPED GPU tests: 343 — this adapter has no SM 6.6 / mesh shaders)
  • the same seven lib tests fail on upstream main's release build on this machine (GPU/driver HRESULTs, no SM 6.6, a DXC barrier-count diff): gpu_raw_window_view_reaches_its_top, a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, execute_indirect_reads_the_arguments_written_before_it, origin_events_issue_tokens_and_flips_have_statistics, statistics_name_each_frames_origin_and_rescheduled_handles_outlive_the_clock_tick, gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark, stale_blob_cannot_bypass_the_offline_pipeline_cap — not caused by this change
  • geometry_done_emit_cut_lowers and the new geometry_forms_validate case fail when the fix is reverted (checked by restoring the old condition in each translator)

Regression run

main:

xcl-smoke v1
commit: 3f2777019544c0ada2cd294aa792d3c378ff0df8
gpu: NVIDIA GeForce GTX 1050
title: gta6
seconds: 0
exit: 0x0
frames shown: 0 (PresentX 0)
presents per 2 s (last 3): 
device removals: 0
crashes: 0
peak commit: n/a MB

PR:

xcl-smoke v1
commit: 4bc111d1f3924437b8bf6353c8e1195960b43f68
gpu: NVIDIA GeForce GTX 1050
title: gta6
seconds: 0
exit: 0x0
frames shown: 0 (PresentX 0)
presents per 2 s (last 3): 
device removals: 0
crashes: 0
peak commit: n/a MB

Not tested

  • The only available title cannot reach its own code on this adapter: ~2 s into its init it raises a breakpoint the same way on main and on this PR (with -Seconds 1–8 the log shows unhandled exception 0x80000003 then process ends with status 0x80000003). The blocks above end it through XCL_RUN_SECONDS=0 before that point — they cover host boot, game loading and shutdown, no frames, no shaders.
  • No SM 6.6 / mesh-shader GPU: every GPU-bound test skipped, including the new gpu_geometry_done_emit_cut_records; the emit/cut correctness is verified only at the DXIL/HLSL text level.
  • The wave64 variant of GS_DONE handling on a real RDNA2 console program (the test here is a hand-encoded stream-0 program).

AI use

  • Devin (SWE-2 High): root-cause analysis, the change in both translators, the new test program and assertions, the revert-checks, the smoke runs and this PR.
**@⁠kotekompotek** on GitHub · 2026-11-25 21:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/2509) `kotekompotek:fix/gs-done-emit-cut` → `main` · +159 −12 · 3 files · 1 commits · open Fixes #2412. `s_sendmsg MSG_GS_DONE` (msg 3) carries the same GS op field as `MSG_GS` (msg 2) — SIMM16[5:4]: 1 cut, 2 emit, 3 emit+cut, stream at [9:8] — and also marks the shader done. Both translators ran the op only for `MSG_GS` and silently dropped it on `GS_DONE`, so a geometry program that folds its final emit/cut into `GS_DONE` loses those records. **What is in it** - `gpu/dxil/lower_geom.rs` (direct DXIL lowering) and `gpu/recomp/emit.rs` (HLSL backend, which even said "GS_DONE (3) – nothing to do") now run a `GS_DONE`'s emit/cut op like `MSG_GS`'s — stream 0, op != NOP. - `geometry_tests.rs`: a `done_program` whose only emit/cut rides `MSG_GS_DONE`; `geometry_forms_validate` / `geometry_done_emit_cut_lowers` see the op reach the DXIL and the emitted HLSL; `gpu_geometry_done_emit_cut_records` compares the produced records against the `MSG_GS` form's model (skips without a GPU). **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce GTX 1050 (driver supports up to SM 6.5, no mesh shaders), DXC 1.8.2502.11 (10.0.26100.0), rustc 1.98.1 stable-x86_64-pc-windows-msvc; debug tests, release smoke builds - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1352 passed, 7 failed, 46 ignored (SKIPPED GPU tests: 343 — this adapter has no SM 6.6 / mesh shaders) - the same seven lib tests fail on upstream main's release build on this machine (GPU/driver HRESULTs, no SM 6.6, a DXC barrier-count diff): `gpu_raw_window_view_reaches_its_top`, `a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier`, `execute_indirect_reads_the_arguments_written_before_it`, `origin_events_issue_tokens_and_flips_have_statistics`, `statistics_name_each_frames_origin_and_rescheduled_handles_outlive_the_clock_tick`, `gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark`, `stale_blob_cannot_bypass_the_offline_pipeline_cap` — not caused by this change - `geometry_done_emit_cut_lowers` and the new `geometry_forms_validate` case fail when the fix is reverted (checked by restoring the old condition in each translator) **Regression run** main: ``` xcl-smoke v1 commit: 3f2777019544c0ada2cd294aa792d3c378ff0df8 gpu: NVIDIA GeForce GTX 1050 title: gta6 seconds: 0 exit: 0x0 frames shown: 0 (PresentX 0) presents per 2 s (last 3): device removals: 0 crashes: 0 peak commit: n/a MB ``` PR: ``` xcl-smoke v1 commit: 4bc111d1f3924437b8bf6353c8e1195960b43f68 gpu: NVIDIA GeForce GTX 1050 title: gta6 seconds: 0 exit: 0x0 frames shown: 0 (PresentX 0) presents per 2 s (last 3): device removals: 0 crashes: 0 peak commit: n/a MB ``` **Not tested** - The only available title cannot reach its own code on this adapter: ~2 s into its init it raises a breakpoint the same way on main and on this PR (with `-Seconds` 1–8 the log shows `unhandled exception 0x80000003` then `process ends with status 0x80000003`). The blocks above end it through `XCL_RUN_SECONDS=0` before that point — they cover host boot, game loading and shutdown, no frames, no shaders. - No SM 6.6 / mesh-shader GPU: every GPU-bound test skipped, including the new `gpu_geometry_done_emit_cut_records`; the emit/cut correctness is verified only at the DXIL/HLSL text level. - The wave64 variant of `GS_DONE` handling on a real RDNA2 console program (the test here is a hand-encoded stream-0 program). **AI use** - Devin (SWE-2 High): root-cause analysis, the change in both translators, the new test program and assertions, the revert-checks, the smoke runs and this PR.
MSG_GS_DONE (msg 3) carries the same GS_OP field as MSG_GS (msg 2): the
final emit, cut or emit+cut of a GS is routinely folded into it. Both
translators only ran the op for msg 2, so a GS_DONE carrying an op lost
its last vertex and the strip triangle it closes.

Assisted-by: Devin (SWE-2 High)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:32:29 +00:00
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 21:21 UTC · original

gpu_ suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
No new test functions in the diff; the suite exercises the GS_DONE production change end to end through the existing geometry tests, all clean here.

**@⁠SlopTart** on GitHub · 2026-11-25 21:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7174978086) `gpu_` suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. No new test functions in the diff; the suite exercises the GS_DONE production change end to end through the existing geometry tests, all clean here.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 21:23 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!

**@⁠DavidM1911** on GitHub · 2026-11-25 21:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7175024126) 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!
Author
Owner

@⁠emirduran707 on GitHub · 2026-11-25 21:42 UTC · original

Independent AMD RDNA4 (native wave64) test report on exact head 4bc111d1f3924437b8bf6353c8e1195960b43f68 (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: 1356 passed, 3 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::geometry_done_emit_cut_lowers and gpu_geometry_done_emit_cut_records.
    • The 3 failures are pre-existing on the PR's base main: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722) and fuzz_validate_and_gpu_3 (seed 1599) on this GPU, plus gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier (from 50a9fde / #2074, fixed later on main in #2420).

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

xcl-smoke v1
commit: 4bc111d1f3924437b8bf6353c8e1195960b43f68
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1596 (PresentX 1596)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14386 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.
**@⁠emirduran707** on GitHub · 2026-11-25 21:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7175427250) Independent AMD RDNA4 (native wave64) test report on exact head `4bc111d1f3924437b8bf6353c8e1195960b43f68` (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`: **1356 passed, 3 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::geometry_done_emit_cut_lowers` and `gpu_geometry_done_emit_cut_records`. - The 3 failures are pre-existing on the PR's base `main`: `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` (seed 722) and `fuzz_validate_and_gpu_3` (seed 1599) on this GPU, plus `gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier` (from `50a9fde` / #2074, fixed later on `main` in #2420). **Regression run** (60 s retail-title smoke, `XCL_NETWORK=0`, release) ``` xcl-smoke v1 commit: 4bc111d1f3924437b8bf6353c8e1195960b43f68 gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1596 (PresentX 1596) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14386 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.
Author
Owner

@⁠Oliwettoo on GitHub · 2026-11-25 22:20 UTC · original

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:

  • #2494 and #2509 change both the HLSL path (emit.rs) and Direct DXIL (lower_geom.rs). #2485 changes only Direct DXIL, so with it the HLSL path still drops GS_DONE's emit/cut.
  • The op != 0 / 1..=3 guards in #2494 and #2485 change nothing. gs_emit_cut and the HLSL arm only act on op & 1 / op & 2, so op 0 is already a no-op in #2509 too.
  • The diffs are otherwise equivalent. Merging one (#2494 is the earliest that covers both paths) and closing the other two saves duplicate review work (#1607).
**@⁠Oliwettoo** on GitHub · 2026-11-25 22:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7176233329) 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: - #2494 and #2509 change both the HLSL path (`emit.rs`) and Direct DXIL (`lower_geom.rs`). #2485 changes only Direct DXIL, so with it the HLSL path still drops `GS_DONE`'s emit/cut. - The `op != 0` / `1..=3` guards in #2494 and #2485 change nothing. `gs_emit_cut` and the HLSL arm only act on `op & 1` / `op & 2`, so op 0 is already a no-op in #2509 too. - The diffs are otherwise equivalent. Merging one (#2494 is the earliest that covers both paths) and closing the other two saves duplicate review work (#1607).
Author
Owner

@⁠ahmetbagci8 on GitHub · 2026-11-25 22:22 UTC · original

Tested

  • Commit: 4bc111d1f3924437b8bf6353c8e1195960b43f68
  • 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: 12 passed; 0 failed; 0 ignored (2.96s)

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.
**@⁠ahmetbagci8** on GitHub · 2026-11-25 22:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7176277557) ### Tested - **Commit:** `4bc111d1f3924437b8bf6353c8e1195960b43f68` - **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`: `12 passed; 0 failed; 0 ignored (2.96s)` ### 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2509/head:github-bot/gh-2509'
git switch 'github-bot/gh-2509'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2509'
git switch 'github-bot/gh-2509'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2509'
git switch 'github-bot/gh-2509'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2509'
git switch 'main'
git merge --squash 'github-bot/gh-2509'
git switch 'main'
git merge --ff-only 'github-bot/gh-2509'
git switch 'main'
git merge 'github-bot/gh-2509'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.