dxil: prefer live lanes in PS v_readfirstlane and lane-mask SCC tests #2491
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2501"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-25T20:52:04Z.
Bring the direct DXIL pixel-shader lowering into parity with the HLSL recompiler's live-lane handling for helper lanes under
s_wqm(v_readfirstlaneandVCC/EXEClane-maskSCCchecks). Part of #675. Part of #1401. Part of #1833.What is in it
crates/xcl/src/gpu/dxil/lanes.rs:Lw::is_pixel(reused inballotandrla) andLw::live_lanes, which emitsWaveActiveBallot(true)and selects the active half in wave32-in-64 mode (matching HLSLballot(true)).Lw::first_laneso pixel shaders intersect(lo, hi)withlive_lanes()beforefirstbitlowwhen any live lane bit is set, falling back to raw(lo, hi)when only helper lanes are set (parity with HLSLfirst_lane_live; non-pixel stages unchanged).crates/xcl/src/gpu/dxil/lower.rs:Lw::ps_mask_live_sccmatching pixel-shaderENC_SOP2s_and_b32,s_andn2_b32,s_and_b64, ands_andn2_b64instructions withVCC(106) orEXEC(126) asSSRC0,SSRC1, orSDST.Lw::saluandLw::salu64to mask only theSCCzero-check bylive_lanes()whenps_mask_live_sccholds, leaving the destination register write (write32/write64) unmasked (parity with HLSLmask_live, extended to 64-bit masks).crates/xcl/src/gpu/dxil/lanes.rs(ps_ballot_tests):direct_ps_readfirstlane_filters_exec_by_live_lanes: pure-CPU DXC 1.9 validation and disassembly check for wave32/wave64 PS plus compute negative control.direct_ps_mask_and_scc_counts_live_lanes_only: pure-CPU DXC 1.9 validation and disassembly check for wave32/wave64 PSs_and/s_andn2touchingVCC/EXEC(includingSDST=NULL) plus non-mask PS and compute negative controls.gpu_direct_ps_readfirstlane_and_mask_live_on_triangle_edges: draws two triangles sharing a diagonal (32x32) on wave32 (and wave64 when supported) verifyingv_readfirstlaneselects a live lane (2.0), helper-onlys_andn2setsSCC == 0while preserving helper bits in the destination and live-lanes_andsetsSCC == 1, and a 6-pass march loop exits at6.0on all1024/1024pixels (cleanly skipped on WARP/CI without wave32).Tested
dxil.dll1.9.2609.5, release build.lanes.rs/lower.rsfix (onorigin/maine0d93c8): both new pure-CPU/DXC tests failed (0 passed, 2 failed).cargo test --release -p xcl --lib -- gpu::dxil::lanes::ps_ballot_tests:: --nocapture:7 passed, 0 failed, 0 ignored(0.43 s,0skipped;1024/1024pixels passed for bothwave64 = falseandwave64 = true).XCL_ADAPTER=warp:7 passed, 0 failed, 0 ignored(0.05 s; all 5 pure-CPU/DXC tests passed with0skips; the 2 GPU edge-draw tests cleanly skipped withno wave32/no wave64).cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture(RTX 4060):1424 passed, 0 failed, 46 ignoredacross37test binaries (184/184gpu::dxil::*passed;29pre-existingSKIPPEDGPU/environment checks:21no wave64,3per-lane wave32 refused,3no D3D12 debug layer,1no heap windows,1cannot disable driver cache;0skipped inps_ballot_tests).Regression run
main:
PR:
Not tested
d3d12SDKLayers.dll.AI use
is_pixel/live_lanes/first_laneinlanes.rsandps_mask_live_sccinlower.rs, wrote the DXC-validated and GPU edge tests, ran the test and smoke suites, and drafted this PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T21:03:28Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T21:08:18Z.
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.Targeted run of the new mask/readfirstlane tests (
direct_ps_mask_and_scc_counts_live_lanes_only,direct_ps_readfirstlane_filters_exec_by_live_lanes,gpu_direct_ps_readfirstlane_and_mask_live_on_triangle_edges, helper): 4 passed.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T21:07:31Z.
Correction: the PR test translates its
wave64pass in the native form (wave64: true, split: false), and that pass ran and passed on the RX 9070 XT. Which wave size the driver gives a pixel shader is the driver's choice, though, and the test does not check it, so this report does not show that the pass ran in 64-lane waves.AMD RDNA4 run of the native (
split: false) wave64 pixel-shader form, plus an RTX 3060: all 3 new tests pass on both cards, and nothing else changes.Diff applied on
main6d12f58, debug, Windows 11 Pro 26200,XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4, run onmainand with the PR, card chosen withXCL_ADAPTER:XCL_SPLIT_WAVE64unset):gpu_direct_ps_readfirstlane_and_mask_live_on_triangle_edges,direct_ps_readfirstlane_filters_exec_by_live_lanesanddirect_ps_mask_and_scc_counts_live_lanes_onlyok. 701 passed, 2 failed; the 2 failures are the AMD fuzz seeds tracked in #2115, the same onmain. Same skip count asmain(6).No other test changes result on either card.
Not tested: the D3D12 debug-layer tests (
d3d12SDKLayers.dll), RDNA2/3, retail pixel shaders.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T04:16:35Z.
RX 6800M focused validation on exact PR head
de915b5adb519c9aa342107fb05fbe56540541ff:30.0.13002.13003; Rust 1.99.0 MSVC; DXC 1.9.2609.5.XCL_ADAPTER=6800M,XCL_REQUIRE_GPU=wave64, pinnedXCL_DXC_DIR;cargo test --locked -p xcl --lib gpu::dxil::lanes::ps_ballot_tests::gpu_direct_ps_readfirstlane_and_mask_live_on_triangle_edges -- --exact --test-threads=1 --show-output.The fixture does not print its selected adapter or report the driver's physical pixel-shader wave width. The
XCL_ADAPTERselector and required-GPU mode were set, but this result should not be read as proof that the driver executed 64-lane pixel waves. This was one focused debug test, not a full suite or retail-title run.AI use: Codex (exact model name not exposed to me) with a Luna subagent prepared and ran the test and drafted this report; I checked the exact head and log before posting.
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-27T18:00:49Z.
Tested on AMD / Linux:
de915b5a(RX 9070 16 GB, RDNA4, Mesa 26.3.1 RADV; Ryzen 5 9600X, 32 GB; CachyOS; Proton Experimentalexperimental-11.0-20261112with vkd3d-proton masterec207194plus a local patch dropping thelpVtblchecks of command allocators and lists; DXC 1.9.2609.5; Rust 1.96.0,x86_64-pc-windows-gnudebug build, tests run under Wine)The head as it is (base
e0d93c84), withmainf9a0cb80the same session as the baseline.Tests (
XCL_REQUIRE_GPU=wave64)cargo test -p xcl --lib -- gpu::dxil::lanes:: --test-threads=1: 7 passed, 0 failed, 0 ignored (includesgpu_direct_ps_readfirstlane_and_mask_live_on_triangle_edges, which ran on the GPU in wave64).cargo test --workspace --no-fail-fast -- --test-threads=4with--skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(the first loses the RADV device here, the other two run out of memory under Wine): lib 1290 passed, 8 failed, 26 ignored;mainf9a0cb80lib the same session: 1323 passed, 9 failed, 27 ignored (--test-threads=1and two--test-threads=4runs). All failures are amongmain's. The other binaries fail the same 3 tests as onmainhere (e2e,pls_quota,predication_e2e).d3d12_resource_and_syncended the process, as it does onmainhere.Not tested
AI use
Imported from ivall/xcl. Originally posted by throny on 2026-11-29T00:47:40Z.
merge-check claim
head:
de915b5adbImported from ivall/xcl. Originally posted by throny on 2026-11-29T01:02:11Z.
merge-check
base:
fa204595head:
de915b5adbmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2611 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at
fa204595: 2608 passed, 0 failed, 49 ignored.review: no blocking finding; all hunks read. The filter to live lanes falls back to the unfiltered mask when no lane is live, so a wave of helper lanes behaves as before. One wording point: the comment speaks of parity with the HLSL path, but HLSL filters the condition flag only for the 32-bit and/andn2 forms; this PR also filters the 64-bit ones, so for wave64 pixel shaders the two paths now differ (probably for the better; the comment should say so). The tests match on disassembly text and may be brittle. No interaction with #2128 or #2117 (other path, other files). Open from the thread: nobody has shown a driver really running these pixel shaders in 64-lane waves. The smoke pair in the description is on an old base.
performance: one more wave ballot per pixel-shader first-lane read and per qualifying and/andn2; not measured. Direct-DXIL sources only, but that is the default path for pixel shaders: those entries are translated again once.
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).
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-29T01:18:01Z.
merge-check
base:
fa204595a4head:
de915b5adbmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2611 passed, 0 failed, 49 ignored; SKIPPED: 28 (mostly "no wave64", plus "no heap windows", "no GPU_UPLOAD heaps", "no build ahead"); failing: none (base
fa20459alone here: 2608 passed, 0 failed, 49 ignored)review: none blocking, after reading the whole diff (
dxil/lanes.rs,dxil/lower.rs, the 3 tests).live_lanesisWaveActiveBallot(true), which leaves helper lanes out.first_lanekeeps the unfiltered mask when no lane of it is live.ps_mask_live_sccfiltersscconly for SOP2s_and*/s_andn2*naming VCC or EXEC, so the same op on two other SGPRs holding masks still counts helper bits (a limit, as on the HLSL side). On this card (wave32 only),gpu::dxil::lanes::ps_ballot_tests::(7 tests) passes 3/3, and the GPU draw test ran (not SKIPPED). Two scratch mutations each make the GPU readback test fail: (1) the live filter infirst_lanedisabled, which also failsdirect_ps_readfirstlane_filters_exec_by_live_lanes; (2)ps_mask_live_sccalways false, which also failsdirect_ps_mask_and_scc_counts_live_lanes_only. So this driver does read helper lanes there without the change. Not run: wave64 pixel shaders (none here), a title.performance: default path (direct DXIL is the default for pixel shaders since #3243): one extra wave ballot per PS
v_readfirstlaneand per qualifyings_and*/s_andn2*withsccread. Reasoned, not measured.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)