Skip to content

Shaders: guard wave64 graphics direct DXIL - #1913

Open
mokkamokacaffe wants to merge 1 commit into
xcl-dev:mainfrom
mokkamokacaffe:dxil/guard-wave64-graphics-cache
Open

mokkamokacaffe wants to merge 1 commit into
xcl-dev:mainfrom
mokkamokacaffe:dxil/guard-wave64-graphics-cache

Conversation

@mokkamokacaffe

@mokkamokacaffe mokkamokacaffe commented Nov 24, 2026 •

Copy link
Copy Markdown

Fixes #1895.

Wave64 vertex and pixel shaders can read lanes 32–63 while the selected adapter requires two 32-lane waves. Direct graphics DXIL has no split-wave64 form, so these programs must use the HLSL upper_lanes path instead of producing incorrect direct DXIL or poisoning its cache.

What is in it

  • crates/xcl/src/gpu/recomp/pso.rs: pass the adapter's wave32/split requirement into the live Direct DXIL VS/PS route and refuse programs that need upper-lane emulation, allowing the existing HLSL fallback to take them.
  • crates/xcl/src/gpu/recomp/mod.rs: conservatively classify written/read upper lanes; incomplete or unknown instruction streams require fallback.
  • crates/xcl/src/gpu/dxil/coverage.rs: apply the same refusal to xcl shaders --direct inside its panic boundary, keeping offline coverage consistent with runtime routing.
  • Disable translated shader caches while XCL_DXIL_NO_OPT is set so deliberately unoptimized diagnostic DXIL cannot be reused by later normal runs.
  • Add focused coverage for upper-lane classification, malformed input, offline VS/PS refusal, the live graphics-container route, HLSL fallback compilation, and the cache override.

Tested

  • Required Windows no-GPU CI on exact head cf70b66810cbc16ec312a63389ac6d510970e25d: passed.
  • Windows 11 build 26200.9974, Rust 1.100.0 MSVC, exact clean head cf70b668, CPU fixture with Intel Arc A770 driver installed:
    • cargo test --locked -p xcl --lib gpu::dxil::coverage::tests::split_wave64_graphics_refuses_upper_lane_read -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored, 0 skipped.
  • The current head's focused fixture writes and reads lane 32 and verifies that split-wave64 offline Direct DXIL refuses both VS and PS.
  • Earlier revisions were additionally exercised on RTX 3090/3060 Ti and RX 9070 XT hardware, including focused classifier/cache tests, DXC compilation, native-wave64 tests and workspace runs; those reports remain in the discussion but are not counted as exact-head validation.

Regression run

main:

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1628 (PresentX 1628)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14561 MB

this PR:

xcl-smoke v1
commit: cf70b66810cbc16ec312a63389ac6d510970e25d
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1631 (PresentX 1631)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14818 MB

The PR produced 100% of main's frames and 102% of its peak commit, with no crash or device removal. This regression run does not establish that the title reached the changed routing path.

Not tested

  • A retail wave64 VS/PS that actually reads lanes 32–63 through the live Direct DXIL PSO route on a wave32-only GPU.
  • XCL_SHADER_BACKEND=dxil gameplay past the menus.
  • Final GPU pixels from the synthetic live-container fallback test; it verifies routing and DXC compilation, not a draw.
  • A full GPU workspace suite on exact head cf70b668.

AI use

@mokkamokacaffe
mokkamokacaffe force-pushed the dxil/guard-wave64-graphics-cache branch from e9d23be to 5e89ca2 Compare November 24, 2026 23:10
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026

@Melow-code Melow-code left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Routing is correct — wave64 VS/PS reading lanes 32-63 goes to HLSL upper_lanes. Three points:

  1. needs_upper_lanes stops at the first decode error and returns the partial result. For a guard, the safe answer is true when decode fails before S_ENDPGM.
  2. The new check in coverage.rs runs before catch_unwind. A panic in upper_lanes::analyze stops the whole coverage run. Put it inside the closure.
  3. split stays false — if direct graphics has no split form, a one-line comment would clarify this.

Please run the Rust tests on Windows before merge.

@WebIdentity1

Copy link
Copy Markdown
Contributor

I tested commit e9d23bed39c766d071325f9c63dff8e5d5ff6115 on native Windows 10 19045, RTX 3090 (driver 591.74), Rust 1.98.1 MSVC, DXC 1.8.2502.11. The current head 5e89ca2bf2bb25758d5c2e7eb9cafd2e43f1433c has the identical tree (3a69a738801756a4b5b1908eb8a3513cfd32c2a1) and parent; only the commit object changed. OpenAI Codex (GPT-6) prepared the synthetic test and ran the checks over SSH. Source-only archives were SHA-256 checked before and after each run; no game files were used.

The existing a_whole_wave_reduction_reads_its_identity, shader_cache_bypasses_debug_overrides, gpu_wave64_ps_whole_wave_reductions, gpu_wave64_vs_spill_slots_and_identity, and direct_and_hlsl_graphics_stages_link tests each passed 1/0/0, with no GPU skips. I also added a local test-only overlay to exercise coverage::translate_mode for both VS and PS with a written lane 32. It passed 1/0/0 on this PR; on parent 689f2db477c3c062cf162649781640ef8a977c18, the same test (minus the new needs_upper_lanes assertion, which the parent does not define) failed because direct translation returned Ok. Here is the head-side test to add if useful:

#[test]
fn split_wave64_graphics_refuses_upper_lane_read() {
    let mut code = rdna2::encode("V_WRITELANE_B32", "ENC_VOP3", &[("VDST", 6), ("SRC0", 20), ("SRC1", 128 + 32)], None).expect("encode");
    code.extend(rdna2::encode("V_READLANE_B32", "ENC_VOP3", &[("VDST", 10), ("SRC0", 256 + 6), ("SRC1", 128 + 32)], None).expect("encode"));
    code.extend(rdna2::encode("S_ENDPGM", "ENC_SOPP", &[], None).expect("encode"));
    assert!(crate::gpu::recomp::needs_upper_lanes(&code));
    let o = KernelOptions { wave64: true, split: true, mem_windows: 1, sampler_base: 0 };
    for mode in [Mode::Vertex(Default::default()), Mode::Pixel(Default::default())] {
        let err = translate_mode(&code, &mode, o, false).unwrap_err();
        assert!(err.contains("upper-lane emulation"), "{mode:?}: {err}");
    }
}

I ran cargo test --locked --workspace -- --test-threads=4 on the clean PR head. The xcl library test binary stopped the workspace run: 922 passed, 4 failed, 25 ignored, 0 SKIPPED. The same four failures and 922/4/25 count occurred on the parent with only the regression test overlaid and excluded (--skip split_wave64_graphics_refuses_upper_lane_read): gpu_clamp_and_omod_per_instruction, placed_title_textures_share_vram_and_preserve_pixels, and two lock-poisoned texture/VRAM tests. These failures predate this PR on this machine; the remaining workspace packages did not run after the library failure.

This validates the split-wave refusal at the offline translator and adjacent GPU graphics output. It does not exercise a retail shader container through the live PSO route or satisfy the required paired retail smoke.ps1 gate. I did not run a proprietary title.

@eizispark

Copy link
Copy Markdown

Hardware test report — commit 5e89ca2

Verified 5e89ca2bf2bb25758d5c2e7eb9cafd2e43f1433c (based on 689f2db477c3c062cf162649781640ef8a977c18; clean merge with current main 20cf130): pass (0 new failures vs 689f2db).

Tested

  • Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), 32 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) (stable-x86_64-pc-windows-msvc), debug tests + release smoke
  • cargo test --workspace --no-fail-fast -- --test-threads=4 --skip gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads: 972 passed, 2 failed, 45 ignored (8 skipped), matching 689f2db (972 passed, 2 failed, 45 ignored, 8 skipped) on this adapter:
    • --skip gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads avoids the pre-#1900 RDNA4 amdxc64 crash on base 689f2db, and the 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3) are the pre-existing 689f2db AMD fuzz seeds; 0 new failures
    • 8 skipped: 6 gpu::recomp::lower_dxil::tests f16/f32 direct-DXIL per-lane cases refused where #1426 semantics differ from the console's; shaders::tests::pso_measurement_compiles_an_exact_synthetic_record (Windows Developer Mode required, 0x887A002D); heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
  • gpu::recomp::upper_lanes::tests::a_whole_wave_reduction_reads_its_identity (9/9 upper_lanes::tests), gpu::recomp::pso::shader_cache_tests::shader_cache_bypasses_debug_overrides, and native RDNA4 wave64 GPU tests (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, console_wave64_compute_through_the_pso_hook_dispatch_and_read_back) all passed

Regression run
main (689f2db477c3c062cf162649781640ef8a977c18):

xcl-smoke v1
commit: 689f2db477c3c062cf162649781640ef8a977c18
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1674 (PresentX 1674)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14862 MB

PR (5e89ca2bf2bb25758d5c2e7eb9cafd2e43f1433c):

xcl-smoke v1
commit: 5e89ca2bf2bb25758d5c2e7eb9cafd2e43f1433c
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1679 (PresentX 1679)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14730 MB

Not tested

  • wave32-only GPUs (NVIDIA / Intel) where wave64 graphics shaders hit the needs_upper_lanes direct-DXIL fallback, XCL_SHADER_BACKEND=dxil retail run, gameplay past the menus

AI use

  • Antigravity (Google DeepMind, Gemini 4 Carbon) ran the workspace test suite and 60-second retail smoke check and formatted this report.

@WebIdentity1

Copy link
Copy Markdown
Contributor

I tested a local patch for @ruipedro-pinheiro's three review points on the source tree of 5e89ca2 (identical to tested e9d23be). OpenAI Codex (GPT-6) prepared it and ran the native Windows checks; no code was pushed. The patch below applies to the clean PR tree (git apply --check passed).

The guard now returns true for an unknown instruction, a decoded instruction extending beyond the byte slice, or trailing incomplete bytes. This is conservative even after S_ENDPGM; the direct CFG decoder also rejects unknown instructions, and the extra fallback avoids acting on a partial lane analysis. The offline guard is inside catch_unwind, and the split: false choice is documented at the live graphics call site.

diff --git a/crates/xcl/src/gpu/recomp/mod.rs b/crates/xcl/src/gpu/recomp/mod.rs
--- a/crates/xcl/src/gpu/recomp/mod.rs
+++ b/crates/xcl/src/gpu/recomp/mod.rs
@@ -1200,9 +1200,15 @@
     let mut insts = Vec::new();
     let mut off = 0;
     while off + 4 <= code.len() {
-        let Ok(d) = rdna2::decode(&code[off..], off as u64) else { break };
+        let Ok(d) = rdna2::decode(&code[off..], off as u64) else { return true };
+        if d.len > code.len() - off {
+            return true;
+        }
         off += d.len;
         insts.push(d);
+    }
+    if off != code.len() {
+        return true;
     }
     rdna2::resolve_far_jumps(&mut insts);
     upper_lanes::analyze(&insts).reads.values().any(|&r| r != upper_lanes::Read::Native)
diff --git a/crates/xcl/src/gpu/dxil/coverage.rs b/crates/xcl/src/gpu/dxil/coverage.rs
--- a/crates/xcl/src/gpu/dxil/coverage.rs
+++ b/crates/xcl/src/gpu/dxil/coverage.rs
@@ -248,20 +248,22 @@
 /// own thread) come back as `"panic: …"`; `validate` runs DXC's validator on the result
 /// (the translator itself only validates in debug / test builds).
 pub fn translate_mode(code: &[u8], mode: &Mode, o: KernelOptions, validate: bool) -> Result<Vec<u8>, String> {
-    if o.wave64
-        && o.split
-        && matches!(mode, Mode::Vertex(_) | Mode::Pixel(_))
-        && crate::gpu::recomp::needs_upper_lanes(code)
-    {
-        return Err("wave64 VS / PS in 32-lane waves needs upper-lane emulation".into());
-    }
-    let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| match mode {
-        Mode::Kernel => kernel::translate_full(code, o),
-        Mode::Compute(cs) => kernel::translate_compute(code, o, cs),
-        Mode::Vertex(vs) => kernel::translate_vertex(code, KernelOptions { split: false, ..o }, vs),
-        Mode::Pixel(ps) => kernel::translate_pixel(code, KernelOptions { split: false, ..o }, ps),
-        Mode::Mesh(ms) => kernel::translate_mesh(code, o, ms),
-        Mode::Geometry(g) => kernel::translate_geometry(code, o, g),
+    let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
+        if o.wave64
+            && o.split
+            && matches!(mode, Mode::Vertex(_) | Mode::Pixel(_))
+            && crate::gpu::recomp::needs_upper_lanes(code)
+        {
+            return Err("wave64 VS / PS in 32-lane waves needs upper-lane emulation".into());
+        }
+        match mode {
+            Mode::Kernel => kernel::translate_full(code, o),
+            Mode::Compute(cs) => kernel::translate_compute(code, o, cs),
+            Mode::Vertex(vs) => kernel::translate_vertex(code, KernelOptions { split: false, ..o }, vs),
+            Mode::Pixel(ps) => kernel::translate_pixel(code, KernelOptions { split: false, ..o }, ps),
+            Mode::Mesh(ms) => kernel::translate_mesh(code, o, ms),
+            Mode::Geometry(g) => kernel::translate_geometry(code, o, g),
+        }
     }));
     let k = match r {
         Ok(r) => r?,
diff --git a/crates/xcl/src/gpu/recomp/pso.rs b/crates/xcl/src/gpu/recomp/pso.rs
--- a/crates/xcl/src/gpu/recomp/pso.rs
+++ b/crates/xcl/src/gpu/recomp/pso.rs
@@ -659,6 +659,7 @@
     if wave64 && split_wave64 && super::needs_upper_lanes(code) {
         return Err("wave64 VS / PS in 32-lane waves needs upper-lane emulation".into());
     }
+    // Direct graphics has no split-wave64 form; programs needing upper-lane emulation fell back above.
     let o = crate::gpu::dxil::kernel::KernelOptions { wave64, split: false, mem_windows: windows, sampler_base };
     let k = match (&mode, stage) {
         (Mode::Vertex(vs), Stage::Vertex) => crate::gpu::dxil::kernel::translate_vertex(code, o, vs)?,

I also added this focused test alongside the written-lane-32 test from my previous comment; it failed on the original PR code and passed with the patch:

#[test]
fn split_wave64_graphics_refuses_incomplete_decode() {
    let unknown = 0x0000_003fu32.to_le_bytes();
    let mut truncated = rdna2::encode("S_NOP", "ENC_SOPP", &[("SIMM16", 0)], None).expect("encode");
    truncated.extend([1, 2]);
    let o = KernelOptions { wave64: true, split: true, mem_windows: 1, sampler_base: 0 };
    for code in [&unknown[..], &truncated[..]] {
        assert!(crate::gpu::recomp::needs_upper_lanes(code));
        for mode in [Mode::Vertex(Default::default()), Mode::Pixel(Default::default())] {
            let err = translate_mode(code, &mode, o, false).unwrap_err();
            assert!(err.contains("upper-lane emulation"), "{mode:?}: {err}");
        }
    }
}

Tested: Native Windows 10 19045, RTX 3090 driver 591.74, Rust 1.98.1 MSVC, DXC 1.8.2502.11; 310 source files per snapshot matched SHA-256 manifests before/after. cargo test --locked -p xcl --lib split_wave64_graphics_refuses_incomplete_decode -- --test-threads=1 --show-output: original PR plus test 0/1/0 (expected negative); patched PR 1/0/0. The written-lane-32 guard, classifier, cache, and two wave64 graphics output tests each passed 1/0/0 on the patched PR, no focused GPU skips.

Paired cargo test --locked --workspace --no-fail-fast -- --test-threads=4: clean PR tree 970 passed / 5 failed / 45 ignored, patch plus two tests 972 / 5 / 45 across 20 targets. Both runs had the same five failures (gpu_clamp_and_omod_per_instruction, placed_title_textures_share_vram_and_preserve_pixels, two poisoned texture/VRAM tests, test_title_runs_and_game_folder_is_untouched) and the same 23 explicit GPU skip notices. Cargo recompiled XCL in both runs. This is a same-tree comparison, not a claim that the pre-existing failures are fixed.

Not tested: Paired retail smoke.ps1 with this local patch, AMD, or a retail wave64 VS/PS through the live direct-DXIL PSO route. The other tester's retail smoke covered the unpatched PR head.

anoyarou pushed a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
@mokkamokacaffe
mokkamokacaffe force-pushed the dxil/guard-wave64-graphics-cache branch 2 times, most recently from 34eb8d4 to 74822df Compare November 24, 2026 23:30
@WebIdentity1

Copy link
Copy Markdown
Contributor

One additional test closes part of the live graphics container coverage gap. It uses the repository's existing synthetic xbox::tests::{fssm, sample} helpers, calls pso::direct_graphics with split_wave64=true for both VS and PS, checks the upper-lane refusal, then checks that console_translation produces complete HLSL and DXC compiles it. It does not set global environment variables or need game data. This test-only patch applies to the clean current PR tree:

diff --git a/crates/xcl/src/gpu/recomp/pso.rs b/crates/xcl/src/gpu/recomp/pso.rs
--- a/crates/xcl/src/gpu/recomp/pso.rs
+++ b/crates/xcl/src/gpu/recomp/pso.rs
@@ -915,6 +915,27 @@
 #[cfg(test)]
 mod shader_cache_tests {
     use super::*;
+
+    #[test]
+    fn direct_graphics_routes_written_upper_lane_to_hlsl() {
+        use crate::gpu::{rdna2, xbox::tests::{fssm, sample}};
+
+        let mut code = rdna2::encode("V_WRITELANE_B32", "ENC_VOP3", &[("VDST", 6), ("SRC0", 20), ("SRC1", 128 + 32)], None).unwrap();
+        code.extend(rdna2::encode("V_READLANE_B32", "ENC_VOP3", &[("VDST", 10), ("SRC0", 256 + 6), ("SRC1", 128 + 32)], None).unwrap());
+        code.extend(rdna2::encode("S_ENDPGM", "ENC_SOPP", &[], None).unwrap());
+        for (kind, hw, api, stage) in [(1, 4, 0, Stage::Vertex), (0, 5, 1, Stage::Pixel)] {
+            let blob = sample(kind, &[fssm(&code, &[(hw, api)])]);
+            let err = match direct_graphics(&blob, stage, 0, 1, true) {
+                Err(e) => e,
+                Ok(_) => panic!("{stage:?}: direct graphics accepted a written upper lane"),
+            };
+            assert!(err.contains("upper-lane emulation"), "{stage:?}: {err}");
+            let (hlsl, profile) = console_translation(&blob, stage, 0, 1, true).unwrap();
+            assert!(hlsl.complete(), "{stage:?}: {:?}", hlsl.unsupported_why);
+            let dxil = dxc::compile(&hlsl.hlsl, "main", profile, &[]).unwrap();
+            assert!(!dxil.is_empty(), "{stage:?}: DXC produced no DXIL");
+        }
+    }
 
     #[test]
     fn translated_identity_tracks_sources_and_dxc() {

Tested: OpenAI Codex (GPT-6) ran cargo test --locked -p xcl --lib direct_graphics_routes_written_upper_lane_to_hlsl -- --test-threads=1 --show-output on native Windows 10 19045 with RTX 3090 driver 591.74, Rust 1.98.1 MSVC and DXC 1.8.2502.11. 1 passed / 0 failed / 0 ignored. The test uses DXC but does not execute the GPU. The 310-file source archive was the unchanged PR tree plus this test only and matched its SHA-256 manifest before/after; Cargo recompiled XCL. I also ran it successfully on the candidate with my earlier review fixes, but the unchanged-tree result is the one relevant to adoption.

This checks container parsing, the direct graphics guard and DXC compilation of the fallback. It does not execute a draw, prove final GPU pixels, exercise XCL_DIRECT_DXIL=all dispatch through compile_console_shader, or replace the paired retail smoke gate. No code was pushed.

@mokkamokacaffe
mokkamokacaffe force-pushed the dxil/guard-wave64-graphics-cache branch from 74822df to 51738bb Compare November 24, 2026 23:36
anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 25, 2026
Brings main to full parity with upstream/main (80f4819):
- xcl-dev#1836: cache direct-DXIL mesh shaders, coalesce shader builds,
  make MS/GS lazy, and cache two-pass/graphics PSO blobs

Conflict in crates/xcl/src/gpu/recomp/pso.rs resolved by keeping both xcl-dev#1836's
Vertex|Pixel stage check + dxc::defer() guard and xcl-dev#1913's split_wave64 argument
to direct_graphics.

Assisted-by: Antigravity (Gemini 4)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 25, 2026
Pulls in xcl-dev#1836 (graphics and two-pass PSO disk cache + lazy MS/GS + shader build coalescing), xcl-dev#1930 (DXIL CSE across discard), xcl-dev#1900, xcl-dev#1005, xcl-dev#1053, xcl-dev#1864, xcl-dev#1866, xcl-dev#1869, xcl-dev#1876, and xcl-dev#1898 while keeping our RDNA4 MSAA clamp (xcl-dev#1908), wave64 graphics Direct DXIL guard (xcl-dev#1913), atomic writable-range tracking, static-sampler cache keys, and 4M-group indirect dispatch clamp.
@Melow-code

Copy link
Copy Markdown

The three points look addressed: the alias-key behaviour is now pinned by the live-graphics-container test (a direct graphics PSO with split_wave64 for VS and PS exercises the CSE path my first point asked a core test for), and the other two were notes, not blockers. Nothing else from my side. Thanks for the clean follow-up. (Reply written with DeepSeek V4 Pro, OpenCode.)

@mokkamokacaffe
mokkamokacaffe force-pushed the dxil/guard-wave64-graphics-cache branch from 51738bb to cf70b66 Compare November 25, 2026 01:16
@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@JJAutoCompare

Copy link
Copy Markdown

PR #1913 — split-wave64 graphics compatibility
#1913

Tested

  • Exact clean commit cf70b66810cbc16ec312a63389ac6d510970e25d. GitHub showed the PR open at that SHA before and after testing. The final discussion had six comments and one review, with no equivalent exact-head report.
  • Windows 11 Enterprise Evaluation x64 build 26200.9974, AMD Ryzen 7 3800X (6 cores and 12 logical processors exposed), Intel Arc A770 driver 32.0.101.9175 installed on the host. The test ran on the CPU.
  • Rust 1.100.0 (0ef1bc386 2026-11-09), host x86_64-pc-windows-msvc, Cargo 1.100.0 (3acc79c0c 2026-11-05), unoptimized test profile. DXC and DXIL file versions 1.9.2609.5. XCL_ADAPTER=A770 and XCL_DXC_DIR=C:\Users\ljensen\AppData\Local\XclTooling\dxc-1.9.2609\bin\x64 were set for the process. The fixture did not use the adapter or DXC.
  • CARGO_BUILD_JOBS=2, CARGO_INCREMENTAL=0, CARGO_PROFILE_DEV_DEBUG=0, CARGO_PROFILE_TEST_DEBUG=0, CARGO_TARGET_DIR=L:/XclTooling/pr2014-1c971de6/target. TEMP and TMP pointed to the run's temp directory.
cargo test --locked -p xcl --lib gpu::dxil::coverage::tests::split_wave64_graphics_refuses_upper_lane_read -- --exact --test-threads=1 --nocapture

Result — 1 passed, 0 failed, 0 ignored, 0 skipped, 1,066 filtered out. Cargo exited 0.

The checked-in fixture writes and reads lane 32 of a valid synthetic wave64 program. It confirms that the classifier requires upper-lane emulation and that split-wave64 offline direct DXIL translation returns the expected upper-lane emulation error for both VS and PS. With direct graphics DXIL enabled and wave64 splitting required, the expected live route is to refuse direct DXIL and continue through HLSL upper-lane emulation. The fixture stops at the offline guard with validate=false, before generating or compiling shader code or running the DXIL validator. It has no built-in direct DXIL positive control.

Not tested

Live PSO routing, HLSL fallback compilation, successful direct DXIL emission, DXIL validation, GPU execution or pixel output, malformed inputs, cache behavior, the workspace suite, and retail-title smoke.

AI use

T3 Code / Codex (gpt-6.2-sol) verified the exact head and discussion, ran the checked-in fixture, and wrote this report.

@Melow-code Melow-code left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The routing change is correct. A wave64 VS or PS in 32-lane waves can read lanes 32 to 63 in a way that is not native. Such a shader now goes to the HLSL upper_lanes form. The XCL_DXIL_NO_OPT cache bypass is also correct. Three points:

  1. Decode errors. needs_upper_lanes stops at the first decode error and returns the result for the part before it. For a guard, the safe answer is true when the decode fails before S_ENDPGM.
  2. translate_mode in coverage.rs. The new check runs before catch_unwind. A panic in upper_lanes::analyze then stops the whole coverage run, where other panics come back as "panic: ...". Put the check inside the closure.
  3. split stays false. direct_graphics now takes split_wave64, but it still passes split: false to KernelOptions. If the direct translator has no split form for graphics, add a short comment that says so.

The PR says that nobody ran the Rust tests, the DXIL validation or a GPU run yet. Please run the tests on Windows once before merge, with the new needs_upper_lanes test.

@Toons29

Toons29 commented Nov 25, 2026

Copy link
Copy Markdown

Regression run of cf70b668 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 1a0bbe3a, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1628 (PresentX 1628)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14561 MB
xcl-smoke v1
commit: cf70b66810cbc16ec312a63389ac6d510970e25d
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1631 (PresentX 1631)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14818 MB

Against the limits in CONTRIBUTING.md: 100 % of main's frames, 102 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.

@throny

throny commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Two contributors checked independently and found that #2252 solves the same problem (for #1895) in a different way: #1607, group D74. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 25, 2026
…1860, xcl-dev#1913, xcl-dev#2192, xcl-dev#1946, xcl-dev#2237

Integrates XG CopyFromSubresource 7-arg ABI (xcl-dev#684), DirectStorage physical-page list re-read (xcl-dev#1405), vkd3d-proton in-place vtable patching with UnadoptGuard composition (xcl-dev#1395), single-back-edge Direct DXIL CFG (xcl-dev#1860), wave64 graphics Direct DXIL guard (xcl-dev#1913), and AMD RDNA2-4 DXIL fuzz fixes (xcl-dev#2192, xcl-dev#1946, xcl-dev#2237).
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.

Shaders: XCL_DIRECT_DXIL=all ignores split_wave64 / upper_lanes for wave64 VS/PS (poisoning split=1 cache), and XCL_DXIL_NO_OPT bypasses cache_allowed()

8 participants