Skip to content

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

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

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

Conversation

@kotekompotek

Copy link
Copy Markdown

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.

…v#2412)

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)
@SlopTart

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

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

Thanks!

@emirduran707

Copy link
Copy Markdown
Contributor

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.

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

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:

@ahmetbagci8

Copy link
Copy Markdown

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.

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

6 participants