Skip to content

Tests: fix 4 geometry tests broken on main by split-ES safe-barrier and no-store epilogue merges - #3411

Merged
throny merged 1 commit into
xcl-dev:mainfrom
Kalmarv:samplers/fix-main-geometry-tests
Nov 29, 2026
Merged

throny merged 1 commit into
xcl-dev:mainfrom
Kalmarv:samplers/fix-main-geometry-tests

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

What is in it

  • Fixes 4 geometry tests currently failing on main (3b6a91ed) due to the merge interaction between #2485, #2419, #2102, and commit 685cf9cb (which refuses split-wave64 Direct DXIL geometry passes that have an ES phase while safe_barrier_wanted() is active):
    • crates/xcl/src/gpu/dxil/geometry_tests.rs:
      • msg_gs_done_program: remove the unused 4-byte S_SETPC_B64 ES prefix and set gs_start: Some(0) (GS-only) so gpu_geometry_msg_gs_done_records runs both Direct DXIL and HLSL on wave32 GPUs instead of failing with the split-ES safe-barrier refusal.
      • msg_gs_done_emits_in_dxil: add a GS-phase DS_WRITE_B32 (since #2419 gates emitted on has = a GS-phase LDS store having happened) and inspect the first dx.op.waveActiveOp.i32(i32 119, ...) (tv emitted-vertex sum) to verify it is non-zero iff expect_emit (since #2419's triangle-straddle loop places the second waveActiveOp in a separate block so the two calls no longer CSE to 1).
    • crates/xcl/src/gpu/dxil/lower_geom.rs:
      • gpu_epilogue_filters_oob_triangles_and_no_store_emits: remove the unused 4-byte S_SETPC_B64 ES prefix and use gs_iface(mvc, 0) (GS-only) so Direct DXIL lower_geom::geom_epilogue continues to be exercised directly on split wave64 (split = true) on wave32 GPUs.
    • crates/xcl/src/gpu/dxil/lower_mem.rs:
      • stage_guard_tests::geometry_export_rejected: expect the split-ES safe-barrier refusal (split wave64 geometry: the ES phase exchanges at group barriers) for (gs_start: None, split: true) when safe_barrier_wanted() is true, and "export target" for all other combinations ((Some(0), false), (Some(0), true), (None, false), and XCL_SAFE_BARRIER=0).

Tested

  • Verified all 4 tests failed on origin/main (3b6a91ed) before this change and pass after:
    cargo test -p xcl --lib -- msg_gs_done_emits_in_dxil gpu_geometry_msg_gs_done_records geometry_export_rejected gpu_epilogue_filters_oob_triangles_and_no_store_emits (4 passed, 0 failed; DXC 1.9.2609.5 + RTX 5070 Ti).
  • Full workspace suite (XCL_DXC_DIR set to DXC 1.9.2609.5): cargo test --workspace -j 2 -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip uma_driver::tests:: — 41 test binaries, 2715 passed, 0 failed, 49 ignored, 9 filtered; 27 runtime SKIPPED (22 no wave64 on wave32 RTX 5070 Ti, 3 refused #1426 per-lane f16/f32 forms, 2 no heap windows opt-in).

Regression run

xcl-smoke v1
commit: f0e8fdd5c3942ddd399d5ee11384c8595c5aacff
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 1695 (PresentX 1695)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 31546 MB
xcl-smoke v1
commit: 468190c23ff1ea19b9c606b3296d3c59bb77fda3
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 1628 (PresentX 1628)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 33602 MB

Not tested

  • Wave64-native hardware (split = false GPU paths of the geometry tests) and XCL_SAFE_BARRIER=0 env override.
  • test_title_runs_and_game_folder_is_untouched and uma_driver::tests:: (skipped during workspace test run).

AI use

  • Drafted and verified with an AI coding assistant; all test updates, failing-before / passing-after runs, full workspace tests, and smoke runs were executed and reviewed locally.

@github-actions github-actions Bot added area:recompiler RDNA2 decoder, HLSL/direct-DXIL recompiler, wave64/wave32 area:tests Unit, integration, e2e tests, or testtitle gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test) labels Nov 29, 2026
@Kalmarv Kalmarv closed this Nov 29, 2026
@Kalmarv Kalmarv reopened this Nov 29, 2026
@fromthemoonx

fromthemoonx commented Nov 29, 2026 •

Copy link
Copy Markdown

merge-check
base: 3b6a91e
head: 468190c
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2724 passed, 0 failed, 49 ignored; SKIPPED: 29 (mostly "no wave64", plus "no heap windows", "no GPU_UPLOAD heaps", "no build ahead"); failing: none. On the base 3b6a91e alone the 4 tests fail here too: gpu_epilogue_filters_oob_triangles_and_no_store_emits, gpu_geometry_msg_gs_done_records and geometry_export_rejected with "split wave64 geometry: the ES phase exchanges at group barriers", and msg_gs_done_emits_in_dxil on its waveActiveOp count. Each fails from its own PR's merge commit on (#2419 e872f23, #2485 ca9baa6, #2102 848be4c).
review: none blocking, after reading the whole diff (test-only: geometry_tests.rs, lower_geom.rs, lower_mem.rs). The 4 tests pass 3/3 here on wave32 (split wave64), and the 2 GPU ones ran (not SKIPPED). One coverage point: the MSG_GS_DONE and OOB-epilogue tests now drop the ES jump on every GPU, so the ES + GS form these PRs added is no longer exercised even with native wave64 (AMD), where translate_geometry still accepts it. Other tests in geometry_tests.rs keep the ES phase and accept SPLIT_ES_REFUSED only in the split form, which would keep that coverage. geometry_export_rejected accepts the refusal only for split + ES + safe_barrier_wanted(), which matches kernel.rs. CI: Build and test on this head failed once (14:29Z) and was running again when I checked; I did not look into that run.
performance: none (tests only).
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug / Claude Code (Claude Opus 5.5)

@andrewDoing

Copy link
Copy Markdown
Contributor

I tried the ES+GS coverage point from the merge check on 468190c2. The attached small test-only patch keeps the GS-only fixture and reruns the same MSG_GS_DONE record assertions with the original ES prefix. On a wave32 device with safe barriers enabled, the fixture asserts the specific Direct DXIL refusal and executes the HLSL fallback. On a native wave64 device it can exercise Direct DXIL for ES+GS as well.

On RTX 5070 / 616.92, Ryzen 7 5700X3D, Rust 1.100.0, DXC 1.8.2502.11, the four regressions from this PR and the new ES+GS test passed (5 passed, 0 failed, 0 skipped). The ES+GS fallback produced the expected vertex and triangle records for all four message variants. A fresh run of the CPU-only geometry_export_rejected test with XCL_SAFE_BARRIER=0 also passed (1 passed, 0 skipped). Native wave64 execution and retail behavior remain unmeasured.

Apply-checked coverage patch
--- a/crates/xcl/src/gpu/dxil/geometry_tests.rs
+++ b/crates/xcl/src/gpu/dxil/geometry_tests.rs
@@ -382,6 +382,15 @@
 /// across both Direct DXIL and HLSL geometry lowering.
 #[test]
 fn gpu_geometry_msg_gs_done_records() {
+    check_gpu_geometry_msg_gs_done_records(false);
+}
+
+#[test]
+fn gpu_geometry_msg_gs_done_records_with_es() {
+    check_gpu_geometry_msg_gs_done_records(true);
+}
+
+fn check_gpu_geometry_msg_gs_done_records(with_es: bool) {
     if runner::adapter().is_err() || runner::wave64_programs_supported() != Ok(true) || dxc::location().is_err() || runner::mesh_shaders_supported() != Ok(true) {
         runner::skip_test("no GPU / DXC / mesh shaders");
         return;
@@ -392,17 +401,31 @@
     let mem = vec![0u32; 64];
     let ps_src = "struct V { float4 pos : SV_Position; };\nfloat4 main(V v) : SV_Target0 { return float4(1.0, 0.0, 0.0, 1.0); }\n";
     let ps = dxc::compile(ps_src, "main", "ps_6_6", &[]).unwrap();
+    let split = !with_es || runner::wave64_supported() != Ok(true);
 
     for (simm, verts_per_prim, tris_per_prim) in [(0x23, 3usize, 1usize), (0x33, 3, 1), (0x03, 2, 0), (0x123, 2, 0)] {
-        let (code, g) = msg_gs_done_program(simm);
+        let (mut code, mut g) = msg_gs_done_program(simm);
+        if with_es {
+            let mut es = encode("S_SETPC_B64", "ENC_SOP1", &[("SSRC0", 6)], None).unwrap();
+            g.gs_start = Some(es.len() as u64);
+            es.append(&mut code);
+            code = es;
+        }
         let rec = g.record();
         let msb = dxc::compile(&mesh_passthrough(&rec), "main", "ms_6_6", &[]).unwrap();
-        let direct = translate_geometry(&code, opts(true, 1), &g).unwrap().dxil;
-        let hlsl_tr = hlsl_geometry(&code, g.clone(), true, 1).unwrap();
+        let direct = translate_geometry(&code, opts(split, 1), &g);
+        let hlsl_tr = hlsl_geometry(&code, g.clone(), split, 1).unwrap();
         assert!(hlsl_tr.complete(), "simm={simm:#x}: {:?}", hlsl_tr.unsupported_why);
         let hlsl = dxc::compile(&hlsl_tr.hlsl, "main", "cs_6_6", &[]).unwrap();
-
-        for (backend, cs) in [("direct", direct), ("hlsl", hlsl)] {
+        let mut shaders = vec![("hlsl", hlsl)];
+        if with_es && split && crate::gpu::recomp::emit::safe_barrier_wanted() {
+            let error = direct.err().expect("direct ES+GS must defer with split waves and safe barriers");
+            assert!(error.contains(SPLIT_ES_REFUSED), "{error}");
+        } else {
+            shaders.push(("direct", direct.unwrap().dxil));
+        }
+
+        for (backend, cs) in shaders {
             let (_, got) = runner::mesh_draw(&cs, &msb, &ps, 1, rec.record_dwords(), &io, &mem, 32, [0.0; 4]).unwrap();
 
             let (vd, maxv) = (rec.vert_dwords(), rec.max_vertices as usize);

AI disclosure: OpenAI Codex (GPT-6.2 Sol) drafted and ran the test extension and wrote this report.

@throny

throny commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

merge-check
base: 3b6a91e
head: 468190c
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2724 passed, 0 failed, 49 ignored (28 SKIPPED lines). Base alone at 3b6a91e: 2722 passed, 2 failed (gpu::dxil::geometry_tests::gpu_geometry_msg_gs_done_records, msg_gs_done_emits_in_dxil), 49 ignored.
review: no finding (read by me, test code only, 23 added and 15 removed lines in 3 files). The four tests stop needing an ES phase in a split wave64 program, which translate_geometry refuses since #3203: three build a GS-only program (gs_start 0), and geometry_export_rejected expects the refusal text exactly where the refusal applies (split, an ES phase, safe barrier wanted) and "export target" everywhere else. The no-store test now checks that the first wave sum has a non-constant operand instead of counting wave sums, with a store added so the program is not empty; that still tells the emitting cases from the folded ones. No production code changes. Run alone, the four tests fail on the base (0 passed, 4 failed, three runs); in the whole suite two of them fail on the base, so their result depends on what else runs in the process. I did not run the four alone on this head.
performance: none (tests only).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Nov 29, 2026
@throny
throny merged commit 24d21a4 into xcl-dev:main Nov 29, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:recompiler RDNA2 decoder, HLSL/direct-DXIL recompiler, wave64/wave32 area:tests Unit, integration, e2e tests, or testtitle gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test) ready-to-merge Has 2 independent safe merge-checks on current head (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants