Repository navigation
Conversation
cmp_class read its source through src_f, so the VOP3 neg/abs modifiers went through modify()'s float OpFNegate / FAbs before the class test read the bits. Those float ops need not keep a signalling NaN signalling (the semantic interpreter quiets it), while RDNA2 (gfx1036) keeps it: on hardware -sNaN tests as sNaN. The class test now loads the raw bits and applies abs as & 0x7fffffff and neg as ^ 0x80000000, as the hardware's sign-bit operations. tests/semantic/test_valu_f32_class_rndne: the source-modifier cases gain -(+sNaN), |-sNaN| and -|-sNaN| (sNaN set, qNaN clear); 4 of them failed before this change. The docstring's sNaN exclusion is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I ran the same independent GPU probe on #2539 (
Each cell checks 2,048 class words and 2,048 EXEC/VCC slots. The two PRs returned byte-identical GPU readbacks within each wave configuration. All six modules passed Vulkan 1.2 SPIR-V validation. The 18 tests in #2539's class/rounding suite and five in #2542's dedicated class-modifiers suite passed locally. |
|
Closing in favour of @Faterek's #2542: they claimed SHADER-457 first (17:17, #2516), and #2542 makes the same raw-bit change backed by a native RDNA2 measurement (672/672 across values × modifiers × class bits), with its own tests and the docs row. My four sNaN cases in |
|
Tested 7c0ec14 on an RTX 5090 (driver 616.92), Windows 11, Vulkan SDK 1.4.363. The GPU test programs were built from the same tree:
AI-assisted (Claude Code). |
Claimed on #2300: #2300 (comment)
What and why
Gen.cmp_classread its source throughsrc_f, so the VOP3neg/absmodifiers went throughmodify()'s floatOpFNegate/FAbsbefore the class test read the bits. Those float ops need not keep a signalling NaN signalling, and the semantic interpreter quiets it. RDNA2 (gfx1036) keeps it, so on hardware-sNaNtests as sNaN. Since the class test is about those bits, the float path can give the wrong class.The change (
tools/rdna2spirv.py)The class test loads the source's raw bits without the modifiers, then applies
absas& 0x7fffffffandnegas^ 0x80000000, in the same order asmodify(). These are the hardware's sign-bit operations, and they keep the payload and the quiet bit. The mask source is unchanged.Tests
tests/semantic/test_valu_f32_class_rndne.py: the source-modifier cases gain-(+sNaN)(sNaN set, qNaN clear),|-sNaN|and-|-sNaN|(payload0x3fffffkept). 4 of these failed before the change. The docstring's old "sNaN is tested without float modifiers" exclusion is updated.test_valu_f32_class_rndne.py+test_vop3_const_mods.py: 28 passed, 313 subtests.tests/test_translate.py+tests/test_shader_checks.py: 588 passed.cs_cmpx_class_f32passes native and withLEONIDA_W64_EMULATE=1.Disclosure: written with an AI assistant (Claude Code). I reviewed it and ran the tests above.
🤖 Generated with Claude Code