Commit Graph

4 Commits

Author SHA1 Message Date
73fdc2a4c6 rdna2spirv: enable FTZ32/fmulz and per-load NonWritable SMEM with outlined slow paths
Enable DenormFlushToZero 32 alongside DenormPreserve 16 (with --no-ftz32
override and fmulz fusion), add sound per-load NonWritable scalar memory
analysis for descriptor/read-only SMEM loads, and outline wide s_buffer_load
partial-OOB slow paths into shared helper functions.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 21:13:24 -05:00
18f1fbe089 rdna2spirv: --fma exact keeps the sign of an underflowing product plus zero
With normal x and y and z = +-0, the exact x*y + z is x*y. The split path
scaled a tiny product by 2^96, and when it still underflowed p rounded to
-0 and th = p + z1 gave -0 + +0 = +0 where the exact result is -0. That
case now selects the single-rounded x*y (reported by sovljanskii in the
PR thread). Denormal factors keep the split path, which follows the
driver's denormal mode as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:58:05 +00:00
b628d0dc8d rdna2spirv: --fma exact keeps a tiny addend's tie-break and an infinite addend
Gen.fma_exact (SHADER-497) had two inputs where it was not the single-rounded
f32 FMA it claims to be:

- A product of at least 2^126 takes the 2^-64 scaling, which turned an addend
  with 0 < |z| < 2^-62 into 0 (or a denormal a flushing driver drops). When
  x*y lies exactly on a rounding tie, z's sign is what breaks it, so
  (1 + 2^-12)^2 * 2^126 + 2^-100 gave 0x7e801000 instead of 0x7e801001.
  Such a z now becomes a signed 2^-126, as v_div_fmas_f32 does for its own
  pre-scaling.
- Infinite operands take the plain Fma. On a driver that splits it, a finite
  x*y beyond FLT_MAX rounds to an infinity first, and with z the other
  infinity the result was a NaN. Finite x and y with an infinite z now give z.

--fma glsl and --fma khr translate as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:54:32 +00:00
04c99b0825 Translator: --fma exact, a single-rounded f32 FMA without VK_KHR_shader_fma (SHADER-497) 2026-11-22 22:07:33 +02:00