Repository navigation
Recompiler: drop redundant IsNaN checks in direct DXIL cvt_u32 and f16_rtz - #2289
ramon-victor wants to merge 1 commit into
Conversation
|
The AMD native wave64 run listed as untested, plus an RTX 3060: passes on both. I checked this one closely on AMD because #2258 (removing NaN guards from float compares) fails there; here, with the NaN checks dropped from Head
Not tested: a title with |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Diff review, CI, and both AMD and NVIDIA checks passed on |
|
No open or merged PR makes the same change. Main's AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
Removes redundant explicit
dx.op.isSpecialFloat(IsNaN)guards in two hot direct DXIL float-conversion helpers (Lw::cvt_u32andLw::f16_rtz):Lw::cvt_u32(v_cvt_u32_f32): replacesisnan(f) || (f <=o 0.0)(3 ops) with a single unorderedfcmp ule float %f, 0.0(Pred::FULe, 1 op), which already evaluates totruefor bothNaNandf <= 0.0.Lw::f16_rtz(v_cvt_pkrtz_f16_f32): drops!isnan(f)from(!isnan(f)) && nz && (abs(back) >o abs(f))(3 ops removed per half, 6 perv_cvt_pkrtz_f16_f32), because orderedfcmp ogt(Pred::FOGt) already evaluates tofalsewhenf(and thereforeabs(f)) isNaN.Part of #1269.
What is in it
crates/xcl/src/gpu/dxil/prelude.rs:Lw::cvt_u32toPred::FULeandLw::f16_rtztoself.land(nz, gt)(+5/-8lines in production code).cvt_isnan_tests::gpu_direct_cvt_u32_and_pkrtz_drop_isnan_and_match_isaverifying DXIL validation, disassembly (zerodx.op.isSpecialFloatcalls,fcmp ule floatemitted), and GPU execution across±0.0, negative values, rounding boundaries,>= 2^32,±Inf,qNaN, andsNaN.On a seeded 600-program sample (
xcl shaders <archive> --direct --sample 600 --seed 3 --max-bytes 40000 --validate --threads 8, 573 programs within the cap), all 573/573 validate cleanly (0validator failures):41,323,736 B -> 41,224,580 B(-99,156 B,-0.24%)263.12 ms -> 255.59 ms(-2.9%)Tested
621.24, wave32), AMD Ryzen 7 5700X, Windows 11 Pro26300,rustc 1.99.0(x86_64-pc-windows-msvc), DXC/DXIL1.8.2502.11(Windows SDK10.0.26100.0).cargo test -p xcl --lib gpu::dxil::prelude::cvt_isnan_tests(debug):1 passed; 0 failed(DXIL validation, disassembly check, and RTX 3070 GPU verification)..\scripts\test.ps1(debug, full workspace):1251 passed; 0 failed; 46 ignored(25 GPU sub-checks skipped on this wave32 adapter: 21no wave64, 1no heap windows, 3 per-lane#1426refusals).cargo build --release -p xcl+ direct DXIL validation sweep on 573 sampled retail shader programs:573/573translated anddxil.dll-validated (0failures).Regression run
Not tested
XCL_SAMPLE_*env vars unset).AI use
Lw::cvt_u32andLw::f16_rtzinprelude.rs, added DXIL disassembly and GPU execution tests, and ran the workspace test suite, 573-shader validation benchmark, and 60 s smoke regression run.