Repository navigation
Direct DXIL: skip read64 for Wave32 VALU lane-mask sources - #2834
safesearch77 wants to merge 1 commit into
Conversation
In Wave32 (wave64: false), VALU lane-mask operands (OPR_SREG / OPR_VCC with size == 64 on v_cndmask_b32, v_add_co_ci_u32, v_sub_co_ci_u32, v_subrev_co_ci_u32, and v_div_fmas_f32) are single 32-bit scalar sources rather than 64-bit SGPR pairs. Calling Lw::read64 rejected valid 32-bit-only scalar encodings (m0 = 124, exec_hi = 127), decoded inline float constants as f64 low dwords instead of f32 bit patterns, and spuriously touched/loaded s[n+1], vcc_hi (107), s108, or exec_hi (127). Read a single 32-bit source via Lw::read paired with 0 when !self.wave64.
|
Native RX 9070 / Wine check of Tested RX 9070 16 GB, RADV GFX1201 / Mesa Built exact pinned source copies. Copied the new
Three fresh processes per revision per wave size, alternating revision order, gave identical outcomes:
The eight refused cases use Across 16 final harness invocations: 0 ignored, 0 capability skips. The local matrix evaluated 768 cases and performed 696 validated GPU dispatches. An independent Python oracle checked all 33,024 lane results, carry/borrow outputs and checked SGPRs. All 56 valid Wave64 shader containers were byte-identical between revisions, and each case's DXIL repeated byte-identically across its three runs. The initial extra fixture mistakenly asserted untouched output slots. After checking the epilogue contract, explicit scalar reads were added and both revisions were rebuilt and fully rerun; only that rerun is counted above. Initial evidence is retained locally. Not tested Full workspace suite, compute-entry GPU execution in the local matrix, other VALU encodings beyond the original module's CPU checks, native Windows, other adapters, retail data, AI use OpenAI Codex (GPT-6; exact serving variant not exposed) audited the diff, wrote local test-only fixtures/capture, ran both revisions, independently verified raw results/source/executable hashes, and drafted this report. Publication authorized by the account owner. |
|
Independent Wave32 parent/head check on Windows 11 build 26200, Ryzen 7 5800X, RTX 3060 12 GB (NVIDIA 610.88), rustc 1.100.0 MSVC, DXC 1.9.2602.17, debug. With
Zero AI use: Codex (GPT-6.2 Astra) ran the comparison, checked the logs and drafted this report. |
|
Independent Blackwell validation on NVIDIA GeForce RTX 5070, driver 616.92; Ryzen 7 5700X3D; Windows build 26300.10075; Rust 1.100.0 MSVC, debug; SDK DXC/DXIL 1.8.2502.11. Tested PR head With the RTX 5070 selected and a writable workspace DXIL cache, Not tested: the full suite on this PR or a retail title. AI use: OpenAI Codex with GPT-6.2 Astra ran the tests and reported results; Codex coordinated and prepared this summary. |
…RC_SCC tracking, wave32 VALU read64-skip) xcl-dev#2833 (f5a52c3): lane_masks::reads_scc goes pub(super) with SDWA S0/S1 refinement (VSRC 253 only when the S-bit selects the scalar source; v253 VGPR reads excluded), movrels/VOP3-unused-SRC2 exclusions, and implicit-field filtering; lower.rs src_bit/src64 gain the 253 arm (zext(scc) & lane==0), compute_scc_liveness and bridged-SCC input both delegate to lane_masks::reads_scc. Tests: sdwa_and_vop3_src_scc_reads_are_classified_accurately + explicit_src_scc_in_salu_valu_bridge_and_wave_liveness, verbatim. xcl-dev#2834 (653f8f1): Direct DXIL wave32 VALU lane-mask sources skip the 64-bit read (read + 0 instead of read64) for OPR_SREG/OPR_VCC 64-bit operands; 279-line wave32_mask_src_tests module added with one twin delta: #[cfg(all(test, windows))] instead of #[cfg(test)], because validate/runner are Windows-only in this tree until the Phase-D SPIR-V backend lands (same bucket as the other dxil translation test modules in dxil/mod.rs). xcl-dev#2832 (e2ecdfa) triaged SKIP: single-file d3d12x/pso_async.rs need_by_submit wanted-cap change, Windows-only, zero Linux twin. Gates: both checks 0 errors; lib 780/0/1 threads=4 (+2, zero regressions); title e2e 4 passed/1 failed by design, 12 unique FAILs all D3D12.X, 0 non-GPU; retail HOLDS (exit 139 SIGSEGV exe+0x2237320, stubs 20, xgr exactly XAsync/XNetworking/XUser). Lock audit: 0 new lock().
Read a single 32-bit scalar source instead of a 64-bit SGPR pair for Wave32 (
wave64: false) VALU lane-mask operands (OPR_SREGandOPR_VCCwithsize == 64inLw::sources) in the Direct DXIL backend, matching the Wave32saveexec/wrexechandling in #2073.In RDNA2 Wave32, the scalar lane-mask input of
V_CNDMASK_B32,V_ADD_CO_CI_U32,V_SUB_CO_CI_U32,V_SUBREV_CO_CI_U32, andV_DIV_FMAS_F32is one 32-bit scalar operand rather than an SGPR pair. Previously,Lw::sources(crates/xcl/src/gpu/dxil/lower_valu.rs:175-177) unconditionally calledLw::read64, which caused three Wave32 defects:m0(124) andexec_hi(127) failed Direct DXIL translation ("...: op") becauseLw::code64only accepts0..=123 | 126.240..=248, e.g.0.5=240andinv_2pi=248) on Wave32 scalar mask operands emittedf64low dwords (0x00000000for240..=247,0x6DC9C882for248) instead of their 32-bit IEEE-754f32bit patterns (0x3F000000,0x3E22F983).OPR_VCCorOPR_SREGmask consumer spuriously calledself.sreg(code + 1), pollutinginit.touchedwithvcc_hi(107),exec_hi(127),s[n+1], or out-of-ranges108(whenSRC2 = vcc_hi) and emitting an extrarawBufferLoadin Wave32 compute shaders.Part of #1269
What is in it
crates/xcl/src/gpu/dxil/lower_valu.rs: inLw::sources, read"OPR_SREG" | "OPR_VCC" if o.size == 64viaself.read(d, o, false)paired withself.c(0)when!self.wave64, preservingself.read64(d, o, false)forwave64: true(+9 / -1).crates/xcl/src/gpu/dxil/lower_valu.rs(wave32_mask_src_tests):direct_wave32_valu_mask_32bit_only_sources_translate: verifies Wave32 kernel and compute translation ofV_CNDMASK_B32andV_{ADD,SUB,SUBREV}_CO_CI_U32withm0(124) andexec_hi(127), while Wave64 still rejects both.direct_wave32_valu_mask_sources_skip_hi_sgpr_touches_and_loads: checksinit.touchedacross plainENC_VOP2,VOP2_VOP_SDWA,VOP2_VOP_DPP16,ENC_VOP3,VOP3_SDST_ENC, andV_DIV_FMAS_F32(s10,s105,vcc_lo,vcc_hi,exec_lo, andOPR_VCC), Wave64 pair controls, and emittedtranslate_computeDXIL bitcode (iooffset40loaded without44).direct_wave32_valu_mask_inline_float_consts_use_f32_bits: checks emitted Wave32 DXIL bitcode integer constants for inline0.5(0x3F000000) andinv_2pi(0x3E22F983rather than0x6DC9C882).gpu_direct_wave32_valu_mask_sources: matching Wave32 Direct DXIL GPU execution test (skipping viarunner::skip_testwhen no Wave32 GPU is present) coveringVCC,m0,exec_hi,s10, and inline0.5masks plus poisoned high SGPR checks.Tested
x86_64-pc-windows-gnu:cargo check --offline --workspace --testsgave 0 errors and 0 new warnings (only the 3 baseline warnings already on8b957bec, none ingpu/dxil/).rustc --edition 2021 --testharness overgpu::dxil::{lower_valu::wave32_mask_src_tests, lower::saveexec_tests, bitreader_tests}(built fromgit archivewith Windows/GPU/DXC validator plumbing stubbed; no lowering or test code modified):lower_valu.rsproduction code from8b957bec: all 3 CPU tests inwave32_mask_src_testsfail (7 passed; 3 failed:v_cndmask_b32 v2, v0, v1, m0: op,V_CNDMASK_B32/ENC_VOP2touchings107, and missing0x3F000000for inline0.5).653f8f13:10 passed; 0 failed(gpu_direct_wave32_valu_mask_sourcesandgpu_direct_wave32_saveexec_and_wrexecskip cleanly on the Linux CPU host).Regression run
xcl-smokeblocks (8b957becand this head) must be attached from a Windows GPU retail run before marking ready for review.Not tested
cargo test --workspace -- --test-threads=4GPU suite (includinggpu_direct_wave32_valu_mask_sourceson a Wave32 D3D12 device and DXCdxcompiler.dllvalidation) and paired Windowsscripts/smoke.ps1retail runs. Prepared on a Linux CPU host without a Windows GPU or retail title.AI use
Lw::sourcesread64defect, implemented theLw::readWave32 path andwave32_mask_src_tests, ran the Linux hostrustc --testRED-to-GREEN harness andx86_64-pc-windows-gnuworkspace checks, and drafted this PR description.