"""In DPP with bound_ctrl:1, src0 float modifiers apply after the invalid-lane zero. Hardware measurement on AMD RDNA3 (RX 7800 XT, HW-DPP-NEG-INVALID-LANE, Issue #1608): An invalid source lane under bound_ctrl:1 produces 0, and the ALU input modifier stage applies after: - `-src0` yields `-0.0f` (0x80000000) - `|src0|` yields `+0.0f` (0x00000000) - `-|src0|` yields `-0.0f` (0x80000000) Standard library only; no GPU, LLVM or retail game files. """ import os import re import struct import sys import unittest HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, HERE) import support # noqa: E402 import spirv_wave_interp as wi # noqa: E402 def f2u(f): return struct.unpack("= 1, "OpSelect against %c0 must be emitted") sel_res = matches[-1][0] # The src0 select is the last one against %c0 # Bitcast to float then FAbs m_cast = re.search(rf"(%\w+) = OpBitcast %float {re.escape(sel_res)}", spv_abs) self.assertIsNotNone(m_cast, f"OpBitcast %float {sel_res} must follow select") cast_res = m_cast.group(1) self.assertIn(f"OpExtInst %float %glsl FAbs {cast_res}", spv_abs, "FAbs must operate on the select result") lines_neg_abs = [ "v_mov_b32_dpp v2, -|v1| row_shr:1 row_mask:0xf bank_mask:0xf bound_ctrl:1", "s_endpgm", ] spv_neg_abs = support.translate_lines("vs_dpp_neg_abs", lines_neg_abs) self.assertIn("FAbs", spv_neg_abs) self.assertIn("OpFNegate", spv_neg_abs) if __name__ == "__main__": unittest.main()