Repository navigation
Conversation
In `crates/xcl/src/gpu/dxil/lanes.rs`, `Lw::ballot` called plain `WaveActiveBallot` even in pixel shaders (`self.gfx` with `ps: Some(_)`). Under SM 6.6, `WaveActiveBallot` excludes helper lanes, whereas `Lw::rla` already uses quad reads for pixel shader helper lanes and the HLSL path uses `ballot_px` / `quad_bits` + `ballot_px_quad` (PR xcl-dev#134 / xcl-dev#105 item 1). After `s_wqm_b32`/`s_wqm_b64`, dropping helper-lane bits from compare masks corrupted `v_cndmask` / `s_and_saveexec` values read via DPP quad derivatives and caused `v_readfirstlane` waterfall loops to spin until the loop budget. Port both parts of xcl-dev#105 item 1 and xcl-dev#134 to the direct DXIL translator: - Split `Lw::ballot_ps_quad(q)` out of `Lw::ballot_ps(cond)` in `crates/xcl/src/gpu/dxil/lanes.rs`: four `WaveActiveBallot` passes spread each quad member's bit `p` from live lanes back to bit `4k + p`, preserving the wave32-in-wave64 `gfx_half` select, constant-false `(0, 0)` short-circuit, and live-lanes-only entry `EXEC` (`setup_pixel` calls `gfx_common_init` before setting `self.gfx`). Non-VOPC PS masks (such as `v_add_co_u32` carries) route through `ballot_ps` -> `ballot_ps_quad`. - In `crates/xcl/src/gpu/dxil/lower_valu.rs`, evaluate plain pixel-shader VOPC compares per quad member (`p in 0..4`) by quad-reading VGPR source operands with `QuadReadLaneAt` (leaving SGPRs such as `v_readfirstlane` results and constants wave-uniform) and feeding the 4-bit quad mask to `Lw::ballot_ps_quad`, avoiding `QuadReadAcross*` on compare predicates that crash AMD RDNA2/3/4 `amdxc64` (xcl-dev#134). Add CPU/DXIL-validator and CI-WARP-safe GPU draw regression tests in `lanes.rs` (384/1024 wrong pixels pre-fix on RTX 4060 -> 0/1024 post-fix for both wave64 and wave32 pixel shaders, with zero `dx.op.quadOp` in VOPC pixel shaders). Part of xcl-dev#1269 Assisted-by: Google Antigravity (Gemini 4 Neon)
XCL PR #2083 fixture verificationTested TestedSTOR-WINLAB ran Windows 11 Enterprise Evaluation 26200.9974 on an AMD Ryzen 7 3800X and Intel Arc A770, driver 32.0.101.9175. Rust was 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), Cargo 1.100.0 (3acc79c0c), and the fixtures logged dxcompiler/dxil 1.9.2609.5 (compiler 01b62ad4) under
Ran the resulting
Total 4 passed, 0 failed, 0 ignored, 0 skipped. Each invocation exited 0 and reported 1,127 filtered out. The three CPU fixtures have no optional GPU path and ran with an unmatched The GPU test ran with Not testedFull workspace suite, title or smoke runs, other GPUs and drivers, and the physical hardware wave width chosen for these pixel shaders. AI useT3 Code / Codex gpt-6.2-sol ran the checked-in fixtures and wrote this report from the local results and fixture source. |
|
Native 64-lane AMD run with live Tested: pass, head
Not tested: the AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report. |
|
I’m checking one remaining AMD compiler shape: a pixel-shader waterfall loop whose V_ADD_CO_U32 carry depends on V_READFIRSTLANE, then feeds EXEC. The current GPU fixture covers VOPC predicates; the non-VOPC carry fixture validates/disassembles but does not draw. I’ll use a synthetic triangle-edge oracle on our AMD iGPU and RTX3090, preserving exact revisions and distinguishing compiler failures from output differences. This is an investigation, not yet a confirmed bug. AI assistance: Codex (GPT-6). |
|
A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, not the native-Windows path: this PR's 4 new tests pass, none skipped. Tested
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
What is in it
Brings the direct DXIL translator's pixel-shader masks to parity with the HLSL path's
ballot_px,quad_bits, andballot_px_quad(PR #134 / #105 item 1):Lw::ballot(crates/xcl/src/gpu/dxil/lanes.rs) always called plainWaveActiveBallot(cond), even when lowering pixel shaders (self.gfxwithps: Some(_)). Under SM 6.6,WaveActiveBallotexcludes helper lanes, whereasLw::rlaalready handles pixel-shader helper lanes via quad reads. Afters_wqm_b32/s_wqm_b64, dropping helper-lane bits from compare masks corruptedv_cndmask/s_and_saveexecvalues read via DPP quad derivatives along triangle edges and preventedv_readfirstlanewaterfall loops from removing helper lanes fromEXEC(spinning until the loop budget and discarding pixels). Moreover, as established in Pixel shaders: masks hold the helper lanes (#105 item 1) #134, quad-reading a compare predicate (QuadReadAcross*on a value derived fromWaveReadLaneAt) crashes AMD RDNA2/3/4amdxc64inCreateGraphicsPipelineState.crates/xcl/src/gpu/dxil/lanes.rs:Lw::ballot_ps_quad(q)to spread a precomputed 4-bit quad maskqacross the wave via fourWaveActiveBallotpasses into bits4k + p, preserving the wave32-in-wave64gfx_halfselect and constant-zero short-circuit.Lw::ballotcalls (self.gfx.as_ref().is_some_and(|g| g.ps.is_some()), covering non-VOPC masks such asv_add_co_u32carries) toLw::ballot_ps, which collects each quad's four bits throughQuadReadAcrossX/Y/Diagonaland delegates toballot_ps_quad. Becausesetup_pixelrunsgfx_common_initbefore assigningself.gfx, entryEXECstays live-lanes-only (WaveActiveBallot(true)), matching HLSLPRELUDE_PIXEL.crates/xcl/src/gpu/dxil/lower_valu.rs:vopc_condandvopc_dstfromLw::vopc/Lw::vopc_write.guard_overrideis unset andopn != "f"), evaluate each quad memberp in 0..4by quad-reading VGPR source operands withQuadReadLaneAtwhile leaving wave-uniform sources (SGPRs such asv_readfirstlaneoutputs, inline constants, literals) untouched, ANDing withlanebit_at(exec_lo, exec_hi, (lane & !3) | p), and passing the 4-bit quad mask toLw::ballot_ps_quad(zerodx.op.quadOpon compare results).ps_ballot_testsincrates/xcl/src/gpu/dxil/lanes.rs):direct_ps_ballot_uses_quad_ops_and_keeps_entry_exec_live_only: CPU +dxil.dllvalidation verifying for bothwave64 = falseandwave64 = truethat:dx.op.quadReadLaneAt.i32and zerodx.op.quadOp;V_CMP_LT_F32(0, v2)PS (with norlacallers) emits exactly 4dx.op.quadReadLaneAt.i32calls and zerodx.op.quadOp;EXEC-only PS emits neitherdx.op.quadOpnordx.op.quadReadLaneAt.direct_ps_constant_false_ballot_skips_quad_ops: CPU +dxil.dllvalidation verifying constant-falseV_CMP_F_F32short-circuits without quad reads.direct_ps_non_vopc_carry_ballot_uses_quad_op: CPU +dxil.dllvalidation verifying non-VOPCV_ADD_CO_U32carry masks useballot_ps(dx.op.quadOp.i32).gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges: CI-WARP-safe (runner::wave64_programs_supported()) GPU draw test on a 32x32 two-triangle diagonal target mirroringrecomp::tests::gpu_ps_masks_hold_helper_lanes_on_triangle_edges(s_wqm,v_cndmask+ DPPddx,s_and_saveexec+ DPPddy, and av_readfirstlanewaterfall loop) for bothwave64 = trueandwave64 = false.Part of #1269
Tested
rustc 1.100.0, DXC1.9.2609.5, release build.cbc296ab):cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1: failed on CPU disassembly check and failed on RTX 4060 GPU draw (wave64 true: 384 pixels wrong (ddx 384, ddy 384, loop 0)).cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1on RTX 4060: 4 passed, 0 failed, 0 ignored, 0 skipped (0 / 1024 wrong pixels for bothwave64 = trueandwave64 = false).XCL_ADAPTER="Microsoft Basic Render Driver" cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1: 4 passed, 0 failed (3 CPU validation tests ran; GPU draw test skipped withno GPU).XCL_ADAPTER=warp cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1: 4 passed, 0 failed (3 CPU validation tests ran; GPU draw test skipped withno wave64).cargo build --release --workspace: exit0.cargo test --release --workspace -- --test-threads=4: 1158 passed, 0 failed, 46 ignored across 21 test binaries, with 25SKIPPEDstderr lines:no wave64(32-lane RTX 4060 hardware)per-lane form: refused(#1426unsupported f16/f32 semantics in per-lane wave32 tests)cannot disable the driver cache (Windows Developer Mode is required)(pso_measurement_compiles_an_exact_synthetic_record)no heap windows(heap_window_out_of_memory_falls_back_to_the_switch_form)Regression run
Paired 60s
scripts/smoke.ps1runs on the same retail title (title: 29640639) and GPU (NVIDIA GeForce RTX 4060):Base (
origin/main,cbc296ab):This PR (
ad281429):No regressions (
1615vs1605frames,14518 MBvs14485 MBpeak commit,60 60 60presents per 2 s,0device removals,0crashes).Not tested
gfx_halfupper-half wave32-in-wave64 hardware path and liveamdxc64PSO compilation on AMD hardware (DXIL disassembly verifies zerodx.op.quadOpin VOPC pixel shaders, matching the Pixel shaders: masks hold the helper lanes (#105 item 1) #134 operand-quad-read shape).XCL_DIRECT_DXIL=allgameplay smoke (the pairedscripts/smoke.ps1runs used the default translator configuration).AI use
ballot_ps_quad/ballot_psimplementation inlanes.rs, the Pixel shaders: masks hold the helper lanes (#105 item 1) #134 operand-quad-read VOPC path inlower_valu.rs, and the regression tests, and ran all build, unit, GPU, WARP, and paired smoke checks.