Repository navigation
Translator: constant and ordered/unordered VOPC compares (v_cmp_f/t/tru/o/u) - #620
Conversation
|
Tested I tested the f16 and f32 VOPC comparisons through the PR translator and Vulkan harness. Each fragment shader wrote the four predicate results (always false, always true, ordered, unordered) to separate framebuffer channels via VCC. I supplied eight operand pairs per width at draw time, including zero, one, infinity, the smallest positive subnormal bit pattern, and quiet and signaling NaN bit patterns in either operand. All 16 draws matched the expected four-channel words in all 4,096 pixels each. Ordered was true for every non-NaN pair and unordered was true for every pair containing a NaN input. The two fragment modules and shared vertex module passed Vulkan 1.2 SPIR-V validation. This probe covers the float VCC path; integer comparisons, explicit scalar mask destinations, and EXEC-writing cmpx forms were outside the run. AI-assisted verification. |
|
Tested 68b7993 on two GPUs, Linux 7.3.5 (CachyOS): pass.
|
IAmNotSiob
left a comment
There was a problem hiding this comment.
nice, f/t/tru/o/u done right and t only exists for int and tru for float. tests pass with main (810) :) AI-assisted review (Claude Code).
|
Tested |
v_cmp(x)_f_* / v_cmp(x)_t_* on integers and v_cmp(x)_f / _tru / _o / _u on f32 and f16 raised Unsupported. f is always false, t and tru always true; o is true when neither source is NaN (OpIsNan), u when either is. The result goes through the existing compare path (VCC, an SGPR mask, or EXEC for v_cmpx; off lanes give 0). tests/semantic/test_vopc_const_ordered.py checks them against a plain-Python reference, including NaN, infinity and signalling-NaN inputs.
68b7993 to
403273a
Compare
main pins 48557ea again since the ItsNotRexed#666-ItsNotRexed#698 merge round, while tools/rpf9dump/Program.cs (3816356) already uses ArchiveEntry.ResourceDrawableOffset from 917e9b9, so the Windows 'check' job fails to compile rpf9dump on every PR. Same one-line change as ItsNotRexed#713 / ItsNotRexed#732; whichever lands first, this merges cleanly.
|
CI note: the Windows |
tools/rdna2spirv.py'scompare()raisesUnsupportedon the VOPC conditions that aren't relations:v_cmp_f_*/v_cmp_t_*on integersv_cmp_f_*,v_cmp_tru_*,v_cmp_o_*andv_cmp_u_*on f32 and f16v_cmpxformsThey aren't in the translated corpus, so this is future-proofing. Claimed in #374.
Change
tools/rdna2spirv.py, incompare():fis always false, andt/truare always true.o(ordered) is true when neither source is NaN, andu(unordered) is true when either one is, usingOpIsNan.v_cmpx. Off lanes give 0.Unsupported.tests/semantic/test_vopc_const_ordered.py(new, stdlibunittest) checks lane 0's bit against a plain-Python reference:f/ton u32 and i32s10and leaving VCC alonev_cmpxkeeping or switching off the laneTested
python -I -m unittest discover -s tests/semantic: all pass. Without the translator change, the new file has errors (Unsupported).python -m compileall -q tools testspasses. Not run on a GPU, and no game files used.AI-assisted (Claude Code): it wrote the change and the tests, and ran the checks listed above.