You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dxil: refuse wave64 VS/PS with upper-lane reads in 32-lane mode (#1895) - #2252
What is in it
Fixes the remaining item (item 1) of #1895 (item 2, XCL_DXIL_NO_OPT, was already merged in #2013):
crates/xcl/src/gpu/dxil/kernel.rs: in translate_on_this_thread, when lowering a Vertex or Pixel entry with o.wave64 && o.split (32-lane hardware waves such as NVIDIA), run upper_lanes::analyze(&cfg.insts) and refuse the shader ("wave64 VS / PS in 32-lane waves: a read of lanes 32–63") if any read is non-Native (matching recomp::lower::lower_graphics).
crates/xcl/src/gpu/recomp/pso.rs: pass split_wave64 from compile_console_shader into direct_graphics and set split: wave64 && split_wave64 in KernelOptions instead of hardcoding split: false, so XCL_DIRECT_DXIL=all falls back to the HLSL upper_lanes path instead of caching broken wave64-only DXIL under the split=1 disk cache key. Modifying kernel.rs also advances XCL_DIRECT_DXIL_SOURCE_ID automatically so stale XCL_DIRECT_DXIL=all cache entries are invalidated.
crates/xcl/src/gpu/dxil/coverage.rs: stop overriding split: false for Mode::Vertex / Mode::Pixel in translate_mode so --direct --split 1 accurately reports 32-lane graphics refusals.
crates/xcl/src/gpu/dxil/core_tests.rs: add wave64_graphics_with_upper_lane_reads_refused_in_32_lane_mode covering translate_vertex, translate_pixel, and coverage::translate_mode for both split: true and split: false, with and without upper-lane reads.
Impact on a 2,000-program sample (--direct --sample 2000 --max-bytes 0, seed 1):
--split 1 (32-lane waves): 50 of 874 pixel shaders (5.7%) that read lanes 32–63 are now cleanly refused (wave64 VS / PS in 32-lane waves: a read of lanes 32–63) instead of silently emitting broken wave64-only DXIL; the remaining 824 PS and 178/178 VS still translate directly (1950 / 2000 total, 0 panics).
--split 0 (native wave64): 2000 / 2000 (100.0%) still translate directly (no change on native wave64).
Antigravity (Gemini 4 Neon) assisted with implementing the upper_lanes guard in kernel.rs, threading split_wave64 through pso.rs and coverage.rs, writing the unit test, and running the sweeps and smoke test.
The AMD native wave64 run listed as untested, plus an RTX 3060, paired against main with the direct translator on for the whole GPU suite. On native wave64 hardware the new refusal must not kick in, and nothing that ran before is refused now.
Head 2a6d713 applied on main426a5a7, debug, Windows 11 Pro 26200, XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4, on main and on this PR for each card:
Per-test comparison: on both cards the only difference is the new wave64_graphics_with_upper_lane_reads_refused_in_32_lane_mode (ok). No existing test changes result, and the SKIPPED lines are identical, so no graphics program that ran before is refused now on either card. The RX 9070 XT failures are on main too: gpu_image_get_resinfo_past_last_level (reported on #2054) and the fuzz seeds tracked in #2115.
Not tested: a title with XCL_DIRECT_DXIL=1, RDNA2/RDNA3.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is in it
Fixes the remaining item (item 1) of #1895 (item 2,
XCL_DXIL_NO_OPT, was already merged in #2013):crates/xcl/src/gpu/dxil/kernel.rs: intranslate_on_this_thread, when lowering aVertexorPixelentry witho.wave64 && o.split(32-lane hardware waves such as NVIDIA), runupper_lanes::analyze(&cfg.insts)and refuse the shader ("wave64 VS / PS in 32-lane waves: a read of lanes 32–63") if any read is non-Native(matchingrecomp::lower::lower_graphics).crates/xcl/src/gpu/recomp/pso.rs: passsplit_wave64fromcompile_console_shaderintodirect_graphicsand setsplit: wave64 && split_wave64inKernelOptionsinstead of hardcodingsplit: false, soXCL_DIRECT_DXIL=allfalls back to the HLSLupper_lanespath instead of caching broken wave64-only DXIL under thesplit=1disk cache key. Modifyingkernel.rsalso advancesXCL_DIRECT_DXIL_SOURCE_IDautomatically so staleXCL_DIRECT_DXIL=allcache entries are invalidated.crates/xcl/src/gpu/dxil/coverage.rs: stop overridingsplit: falseforMode::Vertex/Mode::Pixelintranslate_modeso--direct --split 1accurately reports 32-lane graphics refusals.crates/xcl/src/gpu/dxil/core_tests.rs: addwave64_graphics_with_upper_lane_reads_refused_in_32_lane_modecoveringtranslate_vertex,translate_pixel, andcoverage::translate_modefor bothsplit: trueandsplit: false, with and without upper-lane reads.Impact on a 2,000-program sample (
--direct --sample 2000 --max-bytes 0, seed 1):--split 1(32-lane waves): 50 of 874 pixel shaders (5.7%) that read lanes 32–63 are now cleanly refused (wave64 VS / PS in 32-lane waves: a read of lanes 32–63) instead of silently emitting broken wave64-only DXIL; the remaining 824 PS and 178/178 VS still translate directly (1950 / 2000 total, 0 panics).--split 0(native wave64): 2000 / 2000 (100.0%) still translate directly (no change on native wave64).Fixes #1895.
Tested
rustc 1.100.0, DXC /dxil.dll1.9.2602.17, debug & release builds.cargo test -p xcl --lib gpu::dxil::core_tests: 16 passed, 0 failed, 1 ignored (including newwave64_graphics_with_upper_lane_reads_refused_in_32_lane_mode).cargo test -p xcl --lib gpu::dxil::coverage: 5 passed, 0 failed.xcl shaders <pack> --direct --split 1 --sample 2000 --max-bytes 0: 1950 / 2000 translated, 50 PS refused forlanes 32–63, 0 panics.xcl shaders <pack> --direct --split 0 --sample 2000 --max-bytes 0: 2000 / 2000 translated, 0 panics.Regression run
Baseline (
main568e7db):PR (
2a6d713):Not tested
--split 0translation coverage verified locally on NVIDIA).cargo test --workspaceonf087b99(currentmainhas 2 pre-existing unrelated unit-test failures indevice_x.rs— tracked by Tests: align device_x UAV strip and pso cache marker tests with main #2233 — andpso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translator).AI use
upper_lanesguard inkernel.rs, threadingsplit_wave64throughpso.rsandcoverage.rs, writing the unit test, and running the sweeps and smoke test.