Repository navigation
Translator: v_frexp_mant_f32, v_frexp_exp_i32_f32, v_ldexp_f32 (SHADER-89) - #1328
Conversation
|
Tested c9fd097 on Linux (WSL2 Ubuntu), Python 3.12, CPU only: pass.
|
|
Tested c9fd097 on Windows 11 x64 (Python 3.14.6, CPU): pass
|
|
Tested c9fd097 on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass, no regression. The PR's diff applied cleanly to
|
|
Tested I assembled six synthetic wave32 compute shaders that directly execute All 48 words matched, including minimum and maximum normals, signed zero, the negative subnormal input, signed underflow and overflow, extreme signed scale operands, negative infinity and quiet/signaling NaN payloads. The negative subnormal followed the implemented signed-zero rule. The two NaNs retained their input bits and returned exponent zero. Six modules passed SPIR-V validation and all 11 focused semantic tests passed. Linux 7.0.0-43-generic, llvm-mc 21.1.8 and SPIRV-Tools 2026.1. This verifies the Vulkan translation on NVIDIA. Native RDNA denormal handling and NaN payload behavior remain open. AI-assisted verification. |
|
Two separate red checks here, and neither is a defect in your translator change.
That is the test that made
|
|
Tested c9fd097 on RTX 4090 (driver 621.14, 32-wide subgroups), Windows 11 26200: pass
The totals are below No game files used. AI-assisted run (Claude Code). |
|
Tested All 516 GPU result words matched bit for bit against an independent Python reference, with 172/172 matches each for As a negative control, I replaced only This adds direct GPU coverage of the three instructions on Windows Ampere alongside the RTX 3090 stock-suite run and the RTX 5090 Linux shader test. AI-assisted testing with synthetic data. |
Claimed in the coordination issue as: SHADER-89 (#1218, listed as claimed by @dev-ewann; status posted in #1218)
What and why
v_frexp_mant_f32,v_frexp_exp_i32_f32andv_ldexp_f32were rejected asUnsupportedbytools/rdna2spirv.py. They are now translated bit-exactly on the binary32 word (no float arithmetic, so no dependence on the driver'sLdexp/Frexpextended instructions):v_frexp_mant_f32sets the exponent field to 126 (mantissa in [0.5, 1), sign kept);v_frexp_exp_i32_f32returns the biased exponent minus 126.v_ldexp_f32is S0 × 2^S1, S1 a signed integer: clamped to [-512, 512] and added to the exponent field; above 254 the result is ±infinity, at 0 or below it is ±0 (no denormal results); zero, infinities and NaNs ignore S1.clampand the output multipliers apply as on other float ops (not to the integer exponent result).The rule is in the contract table of
docs/design.md(new row after Float-to-int saturation). Source: the RDNA 2 ISA reference pseudocode. Not measured on hardware: the denormal input and result handling (the f32 denormal mode is not modelled) and the NaN payload are the translator's choice, and the row says so.Tested
AI-assisted (Claude). CPU only, no GPU, no game files, not run on the shader corpus.
tests/semantic/test_alu_frexp_ldexp.py(11 tests): known values, 60 random normals checked againstmath.frexp/math.ldexp, round tripmant × 2^exp == input, zero/inf/NaN, overflow and underflow saturation (including INT_MIN and INT_MAX exponents), neg/abs/clamp/mul:2.python3 -I -B -m unittest discover -s tests/semanticon top of main (c0ac5fd): 1182 tests, OK (1 skipped).python3 -m compileall -q make_game.py tools tests: ok.Checklist
docs/design.md, with how it was confirmed.