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

Closed
kotekompotek wants to merge 1 commit from upstream-pr/2509 into main
kotekompotek commented 2026-11-25 21:09:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by kotekompotek on 2026-11-25T21:09:20Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:5499218635 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2509). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T21:09:20Z. --- 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.
SlopTart commented 2026-11-25 22:06:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T21:21:55Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7174978086 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7174978086). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-25T21:21:55Z. --- `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.
DavidM1911 commented 2026-11-25 22:06:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T21:23:59Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7175024126 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7175024126). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T21:23:59Z. --- 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!
emirduran707 commented 2026-11-25 22:06:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T21:42:07Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7175427250 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7175427250). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-25T21:42:07Z. --- 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.
Oliwettoo commented 2026-11-25 23:09:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Oliwettoo on 2026-11-25T22:20:07Z.


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).
<!-- greyfinch-sync:ivall/xcl:comment:7176233329 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7176233329). Originally posted by [Oliwettoo](https://github.com/Oliwettoo) on 2026-11-25T22:20:07Z. --- 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).
ahmetbagci8 commented 2026-11-25 23:09:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ahmetbagci8 on 2026-11-25T22:22:16Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7176277557 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7176277557). Originally posted by [ahmetbagci8](https://github.com/ahmetbagci8) on 2026-11-25T22:22:16Z. --- ### 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.
raylitebull commented 2026-11-28 21:13:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-28T21:13:17Z.


Closing as a duplicate of #2485 (confirmed by 2+ contributors in #1607, group D114). Thanks for the contribution — feel free to comment if this covers something #2485 does not.

<!-- greyfinch-sync:ivall/xcl:comment:7245859512 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2509#issuecomment-7245859512). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-28T21:13:17Z. --- Closing as a duplicate of #2485 (confirmed by 2+ contributors in #1607, group D114). Thanks for the contribution — feel free to comment if this covers something #2485 does not.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2499
No description provided.