fix(shader): honor directed round32 in integer to f32 conversions #3039
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3039"
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 boykopovar/AnyPS5. Originally posted by CouchRiv on 2026-10-10T20:55:29Z.
What
v_cvt_f32_i32andv_cvt_f32_u32always used the hostConvertto f32, which rounds to nearest even. On RDNA2 (gfx1036), whenFLOAT_MODEbits 1:0 (round32) are 1, 2 or 3, integers with more than 24 significant bits round toward +inf, −inf or zero. Independent probes that change only bits 3:2 (round16) match every measured row, so onlyround32matters. Nearest-even (round32= 0) and shaders without a known float mode stay as onmain.The directed path builds the f32 bits from the integer magnitude (signed via absolute value, including
INT_MIN), increments when discarded low bits are non-zero and the mode rounds away from zero, and handles significand overflow into the next exponent.Tested
CachyOS Linux, RTX 4070 Ti (NVIDIA) and Radeon 610M (RADV gfx1036), lavapipe (Mesa llvmpipe).
agc_driver_integer_to_f32_roundingpasses on NVIDIA, RADV and lavapipe (each under 1 s).mainper driver, 0 on this branch, 0 regressions. M2–M4 batches for these cases were not present in the sweep; nearest-even coverage is M1.python3 tools/check_conventions.py --base origin/main,git diff --check.Not tested:
clamp/omod/ SDWA with directedround32, gfx1013, denorm fields other than the R/M1 settings above.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T01:35:08Z.
Windows run, since the PR has no Windows results yet: Windows 11, WinLibs GCC 15.2.0 r7, Release, merged onto
maind31b57a4in one build with #3039, #3134, #3175 and #3194, on an RTX 5060 Laptop and the Arrow Lake iGPU (ANYPS5_GPU=Intel).agc_driver_integer_to_f32_roundingpasses on both GPUs.Across all
agc_*tests in that build, the only new failure on either GPU isagc_driver_flat_store, which comes from #3175 alone (reported there). The Intel failures besides it are the known ones from #2114 and #3207.AI-assisted (Claude Code); I ran this on my machine.