Repository navigation
Conversation
Measured on RDNA2 gfx1036: v_div_fixup_f64 with a NaN quotient (S0), qNaN or sNaN, either sign, any payload (including 0xFFFFFFFFFFFFFFF0), returns copysign(inf, sign(S1) ^ sign(S2)), the same as priority (7) of the f32 row. A normal 0.5 control passes through. The translator kept the NaN payload. f64 NaN(S0) now selects +-inf in the "otherwise" slot, so NaN(S2), NaN(S1), 0/0, inf/inf, x/inf, 0/y, x/0, inf/y and underflow still win. The f16 path is unchanged (not measured). docs/design.md and the semantic test follow. AI-assisted (OpenBot team). Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
|
Replying to @iurysf. Verified the priority of the new NaN(S0) case in translated Vulkan on Linux RTX 5090 (595.99.02), head With finite, nonzero S1 and S2, the quiet-NaN quotient case changed from The other six readbacks matched bit for bit across revisions. With NaN(S0) present, S2’s NaN payload won over S1’s, S1’s signaling NaN was quieted when S2 was finite, zero/zero gave the canonical NaN, finite divided by negative infinity gave negative zero, and underflow gave positive zero. The ordinary 0.5 control passed through. These checks cover the translation; the native gfx1036 measurement is @sperm’s. AI-assisted. |
|
Tested What I ran:
Code review:
|
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 2bac9c30 on Windows 11: python -I tests/semantic/test_alu_div_fixup.py -> 8 tests, OK; git diff --check clean.
The f64 branch now folds NaN(S0) into the b_inf select as b_inf_or_nan0, after every earlier case (NaN(S1), NaN(S2), 0/0, underflow), so those still win, and f16 keeps copysign(S0, sign_out) with its payload. I cannot re-run the gfx1036 measurement; the CPU/interpreter cases and the structure match the documented rule. No blocking issue.
Flyander
left a comment
There was a problem hiding this comment.
Reviewed the measured f64 NaN(S0) lowering, its priority ordering, and coverage for signs, payloads, and unchanged f16 behavior. No additional issue found in this pass.
whattheflop
left a comment
There was a problem hiding this comment.
AI-assisted independent Windows CPU check of 2bac9c30 and parent d0835dd9, uv CPython 3.12.13. A 19-case f64 and six-case f16 matrix per revision matched every hand-derived result. All 50 modules passed Vulkan 1.2 spirv-val before interpretation.
At the exponent-difference boundary with NaN(S0), −1075 still selects −0 on both revisions. At −1074 the parent returns a signed NaN and the PR returns −∞. The finite-operand case also changed for signaling payload bits confined to either 32-bit word. Distinct S2/S1 NaN payloads retained the higher-priority source, and all six f16 modules were byte-identical across revisions, including preservation of the destination's upper half. This checks the translated behavior alongside the gfx1036 measurement and the RTX 5090 priority report.
|
Tested 2bac9c3 merged with main d0835dd (already up to date) on Linux (WSL2) Python 3.12.16: concern (one interaction with another open PR; the PR itself passes).
|
|
@kapitche thanks, yes, that is expected: both PRs are mine. #4536 keeps AI-assisted (OpenBot team). |
|
Closing as superseded: #2477 landed on AI-assisted (OpenBot team). |
…Rexed#2477 is on main ItsNotRexed#2477 (48a1a98) makes the translator return signed infinity for v_div_fixup_f64 with NaN(S0), as measured on RDNA2 gfx1036, which is what the reference already modelled. The case is no longer a known divergence (as TreXito's review of ItsNotRexed#4536 observed: two tests fail on main because they expect the old divergence). - Remove the div-fixup-nan-s0 entry, its reference skip and its dedicated --known program; NaN(S0) programs are compared like any other. - Add a positive test that the reference and the translator give +-inf for qNaN, -qNaN and sNaN with both output signs. - Rework the two --known tests so they no longer depend on div_fixup: the three remaining forms are excluded with a reason by default, run with --known, and a planted clamp-only translator error exits 1 and prints the shrunk program. - docs/shader_validation.md no longer lists the div_fixup case. Same change as 41525870 (prepared for ItsNotRexed#4586, which ItsNotRexed#2477 made redundant). AI-assisted (OpenBot team). Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
TEST-983, claimed in #4421 (comment), from the finding in #4421 (comment).
Depends on: none.
Files:
tools/rdna2spirv.py,docs/design.md,tests/semantic/test_alu_div_fixup.py.Measurement (by @sperm, #4421 (comment),
tools/hw_oracleon gfx1036):v_div_fixup_f64with a NaN quotient (S0), qNaN or sNaN, either sign, any payload (including0xFFFFFFFFFFFFFFF0), returnscopysign(inf, sign(S1) ^ sign(S2)), the same as priority (7) of the measuredv_div_fixup_f32row. A 0.5 control passes through.mainkept the NaN payload (copysign(S0, sign_out)).Change:
tools/rdna2spirv.py: the f64 path selects +-inf for NaN(S0) in the "otherwise" slot, so NaN(S2), NaN(S1), 0/0, inf/inf, x/inf, 0/y, x/0, inf/y and underflow keep their priority. The f16 path is unchanged (not measured).docs/design.md: thev_div_fixup_f16/f64row now gives +-inf for f64 NaN(S0), marked as measured on gfx1036; f16 stays "not measured".tests/semantic/test_alu_div_fixup.py:nan_quot_signed_passthroughbecomes +-inf, with qNaN/sNaN, both signs, a payload, and bothsign_outvalues; f16 keeps its current expectation.Tests (Windows 11,
python -I):tests/semantic/test_alu_div_fixup.py: 8 OK. Negative control: reverting only the translator fails the new cases; restoring gives 8 OK.tests/semantic/test_alu_*: OK. Docs gates andgit diff --check: clean.tools/f64_diff.py, temporary copy, not part of this PR):--knowngoes from exit 1 (div-fixup-nan-s0: expected00000000 7ff00000, got00000000 7ff80000) to a match; CPU seeds 1-5 and 7 and an NVIDIA RTX 4070 (driver 621.01)--oracle gpurun give 0 mismatches. The RTX 4070 only shows the SPIR-V implements the rule; the rule itself comes from the RDNA2 measurement.Overlap: #2477 (@JavierBlanco23) touches the same three files. It is based on an older
main(f847748c); against currentmainit also changes the f64 NaN(S1)/NaN(S2) quieting, the overflow case and the underflow cutoff (-1074 to -1075), which this PR leaves as they are; this PR changes only NaN(S0). This PR conflicts with it textually; whichever lands first, I am happy to help rebase. When this lands, #4536 will dropdiv-fixup-nan-s0from its known divergences.No game files. AI-assisted (OpenBot team).