From 389422b9a8ab261e738510f40ecca24d9a262f98 Mon Sep 17 00:00:00 2001 From: rm-NoobInCoding <35840559+rm-NoobInCoding@users.noreply.github.com> Date: Tue, 24 Nov 2026 20:16:15 +0330 Subject: [PATCH 1/3] shader: lower the integer SDWA comparisons v_cmp_*_{i32,u32}_sdwa (eight relations each) and v_cmp_*_{i16,u16}_sdwa (six each; gfx10 has no f/t forms at 16 bits) were refused. Each source is now its selected byte or word field, zero-extended or sign-extended under sext() as for the SDWA integer operations, and the comparison is the e32 one on those words; the 16-bit kinds read the low 16 bits of the selected word. A whole-dword source is read exactly as the e32 form reads it, so DWORD/DWORD selections emit the e32 HLSL. draw-sdwa-int-compare draws the 28 forms in eight programs under five selection configurations on 13 pairs, with 28 negative controls drawn against wrong models (selections ignored, sext() ignored, signedness swapped, whole selected word compared at 16 bits). It runs as pixel_aot_sdwa_int_compare_{hardware,warp} with its own coverage record. --- CMakeLists.txt | 5 + docs/experiments.md | 2 + tests/pixel_aot_check.py | 196 ++++++++++++++++++++++++++++++++++++++- tools/pixel_aot.py | 33 +++++++ 4 files changed, 235 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bd11ced1e..54f38bf43e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6437,6 +6437,11 @@ if(EXISTS "${INTAKE_PYTHON}") "$" ${adapter}) set_tests_properties(pixel_aot_sad_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77 ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_sad_${adapter}.txt") + add_test(NAME pixel_aot_sdwa_int_compare_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-sdwa-int-compare "${DXC_EXECUTABLE}" + "$" ${adapter}) + set_tests_properties(pixel_aot_sdwa_int_compare_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77 + ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_sdwa_int_compare_${adapter}.txt") add_test(NAME pixel_aot_rndne_${adapter} COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/pixel_rndne_check.py" "${DXC_EXECUTABLE}" "$" ${adapter}) diff --git a/docs/experiments.md b/docs/experiments.md index 8772c14b56..d71414d140 100644 --- a/docs/experiments.md +++ b/docs/experiments.md @@ -5759,6 +5759,8 @@ Scalar ALU support also covers the 64-bit SOP1/SOP2 family (`s_cmov_b64`, `s_not The SDWA forms of the 16 `v_cmp_*_f32` predicates are lowered when both `src0_sel` and `src1_sel` are `DWORD`. With whole-dword selections they compare the operands exactly as the e32/e64 forms do; the translator emits identical HLSL for both, and a control asserts it. A byte or word selection would compare a zero-extended field as binary32 and is refused. The predicate draws are repeated with the SDWA compares for all four groups and the same five input pairs, including NaN on either side. A reference that inverts each group's unordered result must report a mismatch. +The integer SDWA comparisons `v_cmp_{f,lt,eq,le,gt,ne,ge,t}_{i32,u32}_sdwa` and `v_cmp_{lt,eq,le,gt,ne,ge}_{i16,u16}_sdwa` (gfx10 has no f/t forms at 16 bits) lower with byte and word selections. Each source is its selected field, zero-extended or sign-extended under `sext()`, as for the SDWA integer operations; the comparison is then the e32 one on those words: signed or unsigned 32-bit for i32 and u32, and the low 16 bits of the selected word, sign- or zero-extended, for i16 and u16. A whole-dword source is read exactly as the e32 form reads it, so a comparison with both selections `DWORD` emits the same HLSL as its e32 spelling, which a control asserts. Sources are registers; inline constants, literals, float modifiers, unbalanced `sext(`, missing selections, `exec` as the destination, the f and t forms at 16 bits and the `v_cmpx` and 64-bit SDWA forms are refused. Eight programs, two per kind, each compare four channels of A (`s44` copied to `v20`) with B (`s45` copied to `v18`) under five selection configurations that cycle across the channels: `BYTE_1` with `sext` against `BYTE_2`, `WORD_1` against `WORD_0` with `sext`, `BYTE_3` with `sext` against `WORD_1`, `WORD_0` with `sext` against `BYTE_0`, and `DWORD` against `BYTE_3` with `sext`. Each result selects 1.0 or 0 through `v_cndmask_b32`. Every program runs on 13 pairs of normal binary32 words or +0.0, chosen so that every relation except f and t takes both answers. For each program, the first pair on which a wrong model gives other channels is drawn against that model's reference and must report `pixel_mismatch`; the models are selections ignored, `sext()` ignored, signedness swapped, and for the 16-bit kinds the whole selected word compared. That is 28 negative controls and 132 draws from 8 compiles. They run as `pixel_aot_sdwa_int_compare_hardware` and `pixel_aot_sdwa_int_compare_warp` (`tests/pixel_aot_check.py draw-sdwa-int-compare`), with their own coverage record listing all 28 forms, and passed on the NVIDIA GeForce RTX 4070 (driver 32.0.16.1714) and on WARP, Windows 11 (build 26300). As a check of the fixture, ignoring `sext()` in the lowering makes the first program mismatch on WARP. The LLVM 15 round trip was not run on that host. They show that the translated shader computes the stated comparisons on desktop GPUs, not that the console does. + Binary32 floating-point vector comparisons (`v_cmp_{f,lt,eq,le,gt,lg,ge,o,u,nge,nlg,ngt,nle,neq,nlt,tru}_f32` in e32, e64, and whole-dword SDWA forms) evaluate the 16 IEEE-754 relations against scalar and vector operands, including subnormals, signed zeroes, infinities, and quiet/signaling NaNs. The e32 (VOPC) encoding requires destination `vcc` or `vcc_lo`; SGPR destinations (`s52`, `s[52:53]`) are accepted on suffix-less and explicit `_e64` (VOP3) encodings. Source modifiers (`neg`, `abs`) are accepted on e64 operands (`-s44`, `|v18|`, `-|s44|`), while `clamp` and `op_sel` remain rejected on comparisons. Rejection controls verify that untracked source registers, SGPR destinations on explicit e32, and sub-dword SDWA selections (`src0_sel:WORD_0`, `src1_sel:BYTE_2`) raise `ValueError`. The synthetic fixture `f32_compares()` verifies all 16 predicates across e32, e64, and whole-dword SDWA, validating them against an exact reference oracle (`f32_compares_reference()`). Mutating predicates or modifiers produces a mismatch. The original [#958](https://github.com/R0Y00/Xbox2Windows/issues/958) report at `0f0c3eb` recorded a strict comparison mismatch on an RX 9070 XT. Predicate bit 18 compares binary32 subnormal `0x00000001` with `-0.0` and should be clear. The hardware readback set it while WARP and the separate denormal-preservation control passed. The strict expectation and predicate mutation controls are unchanged. Reproduce with `ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_(warp|hardware)$' -V`. See the reduced desktop DXIL measurements below and the additional adapter results in #958. diff --git a/tests/pixel_aot_check.py b/tests/pixel_aot_check.py index 73e550cc6c..0e7ddb617b 100644 --- a/tests/pixel_aot_check.py +++ b/tests/pixel_aot_check.py @@ -4251,6 +4251,198 @@ def check_sdwa_predicate_draws(directory, compiler, renderer, backend): raise +# Integer SDWA comparisons (v_cmp_*_{i32,u32,i16,u16}_sdwa). Each channel compares a selected field of A (s44, copied to +# v20) with a selected field of B (s45, copied to v18) and selects 1.0 (s47) or 0 into its channel. The five selection +# configurations are (src0_sel, src0 sext, src1_sel, src1 sext); channels cycle through them so every program mixes byte +# and word fields, sign- and zero-extension, and a whole-dword source. +SDWA_INT_CONFIGS = ( + ("BYTE_1", True, "BYTE_2", False), + ("WORD_1", False, "WORD_0", True), + ("BYTE_3", True, "WORD_1", False), + ("WORD_0", True, "BYTE_0", False), + ("DWORD", False, "BYTE_3", True), +) +SDWA_INT_SEL = {"BYTE_0": (0, 8), "BYTE_1": (8, 8), "BYTE_2": (16, 8), "BYTE_3": (24, 8), + "WORD_0": (0, 16), "WORD_1": (16, 16), "DWORD": (0, 32)} +INT16_PREDICATES = ("lt", "eq", "le", "gt", "ne", "ge") +# Programs by kind: four relations each. gfx10 has no f/t forms at 16 bits, so the second 16-bit program repeats lt +# and gt under other selection configurations. +SDWA_INT_PROGRAMS = { + "i32": (INT_PREDICATES[:4], INT_PREDICATES[4:]), + "u32": (INT_PREDICATES[:4], INT_PREDICATES[4:]), + "i16": (INT16_PREDICATES[:4], (*INT16_PREDICATES[4:], "lt", "gt")), + "u16": (INT16_PREDICATES[:4], (*INT16_PREDICATES[4:], "lt", "gt")), +} +# (A, B) as normal binary32 words or +0.0, so no float move can flush or quiet them. Their byte and halfword fields +# take both signs and equal values under several selections; the last three pairs put the high half of A below and at +# the low half of B and make every field equal, and the last one puts it between B's low half zero-extended and +# sign-extended. In the final pair A's high half equals B's low half as 16 bits but not once that half is +# sign-extended to 32 bits. +SDWA_INT_PAIRS = ( + (0x3f80ff7f, 0xbf8001ff), + (0xc07f8000, 0x40ff7f80), + (0x3fff8001, 0x3fff8001), + (0xbf00807f, 0x3f7f0080), + (0x40017fff, 0xc0018000), + (0x3e80fffe, 0x3e81ffff), + (0xc0ff0040, 0x40400040), + (0x3f7f8080, 0xbf80807f), + (0x3f800000, 0x40007fff), + (0x3f800000, 0x40003f80), + (0x00000000, 0x00000000), + (0xc07f8000, 0x40ff9000), + (0xc07f8000, 0x40ffc07f), +) + + +def sdwa_int_configs(kind, program): + count = len(SDWA_INT_PROGRAMS[kind][program]) + start = 4 * program + return tuple(SDWA_INT_CONFIGS[(start + channel) % len(SDWA_INT_CONFIGS)] for channel in range(count)) + + +def sdwa_int_predicate_group(kind, program): + body = ["v_mov_b32_e32 v18, s45", "v_mov_b32_e32 v19, s47", "v_mov_b32_e32 v20, s44"] + ops = SDWA_INT_PROGRAMS[kind][program] + for channel, (op, (sel0, sext0, sel1, sext1)) in enumerate(zip(ops, sdwa_int_configs(kind, program))): + src0 = "sext(v20)" if sext0 else "v20" + src1 = "sext(v18)" if sext1 else "v18" + body.extend([f"v_cmp_{op}_{kind}_sdwa vcc_lo, {src0}, {src1} src0_sel:{sel0} src1_sel:{sel1}", + f"v_cndmask_b32_e32 v{12 + channel}, 0, v19, vcc_lo"]) + return with_constants(body) + + +def sdwa_int_field(word, sel, sext): + offset, width = SDWA_INT_SEL[sel] + value = (word >> offset) & ((1 << width) - 1) + if sext and width < 32 and value >> (width - 1): + value -= 1 << width + return value & 0xffffffff + + +def sdwa_int_compare_value(word, kind): + if kind in ("i16", "u16"): + word &= 0xffff + return word - 0x10000 if kind == "i16" and word & 0x8000 else word + return word - (1 << 32) if kind == "i32" and word & 0x80000000 else word + + +def sdwa_int_holds(op, left, right): + return {"f": False, "lt": left < right, "eq": left == right, "le": left <= right, "gt": left > right, + "ne": left != right, "ge": left >= right, "t": True}[op] + + +def sdwa_int_expected(kind, program, a, b, *, selections=True, sext=True, compare_kind=None): + """The four channels as 0.0 or 1.0. The keyword arguments describe wrong models for the negative controls.""" + compare_kind = compare_kind or kind + result = [] + for op, (sel0, sext0, sel1, sext1) in zip(SDWA_INT_PROGRAMS[kind][program], sdwa_int_configs(kind, program)): + if not selections: + sel0 = sel1 = "DWORD" + left = sdwa_int_compare_value(sdwa_int_field(a, sel0, sext and sext0), compare_kind) + right = sdwa_int_compare_value(sdwa_int_field(b, sel1, sext and sext1), compare_kind) + result.append(1.0 if sdwa_int_holds(op, left, right) else 0.0) + return result + + +SDWA_INT_SWAPPED_KIND = {"i32": "u32", "u32": "i32", "i16": "u16", "u16": "i16"} +SDWA_INT_WIDE_KIND = {"i16": "i32", "u16": "u32"} + + +def sdwa_int_wrong_models(kind): + """(label, keyword arguments for sdwa_int_expected) for the models a wrong lowering would follow.""" + models = [("selections ignored", {"selections": False}), ("sext() ignored", {"sext": False}), + ("signedness swapped", {"compare_kind": SDWA_INT_SWAPPED_KIND[kind]})] + if kind in SDWA_INT_WIDE_KIND: + models.append(("whole selected word compared", {"compare_kind": SDWA_INT_WIDE_KIND[kind]})) + return models + + +def check_sdwa_int_predicate_draws(directory, compiler, renderer, backend): + """Draw the 28 integer SDWA comparisons. Every program runs on each pair of SDWA_INT_PAIRS, and for each wrong + model the first pair on which that model gives other channels is drawn against the wrong reference, which must + report a mismatch. On a desktop GPU the draws establish that the translated shader computes the stated + comparisons, not what the console does.""" + source = directory / "sdwa_int_predicates.hlsl" + shader = directory / "sdwa_int_predicates.cso" + for kind, programs in SDWA_INT_PROGRAMS.items(): + for program in range(len(programs)): + source.write_text(translate(sdwa_int_predicate_group(kind, program)), encoding="ascii") + compile_shader(compiler, source, shader) + cases = [] + + def add_case(a, b, pixel, status, label): + constants = bytearray(256) + struct.pack_into("> 24u) << 16) >> 16) < " + f"(asint((({b} >> 16u) & 0xffu) << 16) >> 16);") + assert expected in lines, [line for line in lines if "cmp23" in line] + lines = translate(sdwa_int_predicate_group("u32", 0)).splitlines() + # BYTE_3 of A sign-extended, WORD_1 of B zero-extended, compared as unsigned words; f is constant false. + assert " bool cmp23 = false;" in lines + expected = f" bool cmp27 = asuint(asint({a} << 0u) >> 24u) == (({b} >> 16u) & 0xffffu);" + assert expected in lines, [line for line in lines if "cmp27" in line] + # The e32 comparison on whole dwords is the SDWA one with DWORD selections. + plain = translate(with_constants(["v_mov_b32_e32 v18, s45", "v_mov_b32_e32 v20, s44", + "v_cmp_lt_i32_e32 vcc_lo, v20, v18", "v_cndmask_b32_e32 v12, 0, v18, vcc_lo"])) + sdwa = translate(with_constants(["v_mov_b32_e32 v18, s45", "v_mov_b32_e32 v20, s44", + "v_cmp_lt_i32_sdwa vcc_lo, v20, v18 src0_sel:DWORD src1_sel:DWORD", + "v_cndmask_b32_e32 v12, 0, v18, vcc_lo"])) + assert plain == sdwa + setup = ["v_mov_b32_e32 v18, s45", "v_mov_b32_e32 v20, s44"] + for bad in ( + "v_cmp_f_i16_sdwa vcc_lo, v20, v18 src0_sel:WORD_0 src1_sel:WORD_0", + "v_cmp_t_u16_sdwa vcc_lo, v20, v18 src0_sel:WORD_0 src1_sel:WORD_0", + "v_cmp_lt_i32_sdwa vcc_lo, sext(v20, v18 src0_sel:BYTE_0 src1_sel:BYTE_0", + "v_cmp_lt_i32_sdwa vcc_lo, v20, 1 src0_sel:BYTE_0 src1_sel:DWORD", + "v_cmp_lt_i32_sdwa vcc_lo, -v20, v18 src0_sel:BYTE_0 src1_sel:DWORD", + "v_cmp_lt_u32_sdwa vcc_lo, v20, v18 src0_sel:BYTE_0", + "v_cmp_lt_u32_sdwa vcc_lo, v20, v18 src0_sel:BYTE_4 src1_sel:BYTE_0", + "v_cmp_lt_u32_sdwa vcc_lo, v20, v106 src0_sel:BYTE_0 src1_sel:BYTE_0", + "v_cmp_lt_u32_sdwa exec_lo, v20, v18 src0_sel:BYTE_0 src1_sel:BYTE_0", + "v_cmpx_lt_u32_sdwa v20, v18 src0_sel:BYTE_0 src1_sel:BYTE_0", + "v_cmp_lt_i64_sdwa vcc_lo, v20, v18 src0_sel:BYTE_0 src1_sel:BYTE_0", + ): + translate(with_constants([*setup, "v_cmp_lt_u32_sdwa vcc_lo, v20, v18 src0_sel:BYTE_0 src1_sel:BYTE_0"])) + must_reject(translate, with_constants([*setup, bad])) + + def half_rtz(x): bits, = struct.unpack("> 16)") + elif kind == "u16": + values.append(f"({word} & 0xffffu)") + else: + values.append(word) + for j, reg in enumerate(regs): + scalar[reg] = ("condition", f"cmp{i}", j, len(regs)) + lines.append(f" bool cmp{i} = {INT_COMPARE[op].format(*values)};") elif m := match(rf"v_cmp_({'|'.join(COMPARE)})_f32_sdwa {LANE_MASK}, ([^,]+), ([^,]+) src0_sel:DWORD src1_sel:DWORD"): # With whole-dword selections the SDWA comparison is the e32/e64 one; byte and word selections # would compare zero-extended fields as binary32 and are refused. From 85690efe5b0b6d95a98a8d9b290bddf372d84647 Mon Sep 17 00:00:00 2001 From: rm-NoobInCoding <35840559+rm-NoobInCoding@users.noreply.github.com> Date: Tue, 24 Nov 2026 20:21:36 +0330 Subject: [PATCH 2/3] scan: accept the integer SDWA comparisons The shader scanner keeps its own patterns, so it still reported the integer SDWA comparisons as unsupported after pixel_aot lowered them. Accept them with register sources, optional sext() and both selections printed, without f/t at 16 bits, and test the accepted and refused spellings. test_binary_scan_recognizes_vopc_sdwa used v_cmp_gt_u32_sdwa as its unlowered example; that word now belongs to the supported binary, and v_cmpx_eq_f32_sdwa stays the unlowered one. --- tests/rdna2_tools_check.py | 33 ++++++++++++++++++++++++------- tools/scan_unsupported_shaders.py | 8 ++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/tests/rdna2_tools_check.py b/tests/rdna2_tools_check.py index f47c7560b9..3758b618b0 100644 --- a/tests/rdna2_tools_check.py +++ b/tests/rdna2_tools_check.py @@ -4560,10 +4560,10 @@ def test_binary_scan_recognizes_vopc_sdwa(self): """Issue #938: binary shaders with VOPC/VOPCX SDWA reach the scanner as decoded opcodes, not vopc_sdwa.""" supported = bytes.fromhex( "f904027c01861606" # v_cmp_lt_f32_sdwa s6, -v1, v2 src0_sel:DWORD src1_sel:DWORD + "f904887d01000506" # v_cmp_gt_u32_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:DWORD "000081bf" # s_endpgm ) unlowered = bytes.fromhex( - "f904887d01000506" # v_cmp_gt_u32_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:DWORD "f904247c01001606" # v_cmpx_eq_f32_sdwa -v1, v2 src0_sel:DWORD src1_sel:DWORD "000081bf" # s_endpgm ) @@ -4580,7 +4580,7 @@ def test_binary_scan_recognizes_vopc_sdwa(self): res_sup = results["ps_vopc_sdwa_supported.bin"] self.assertEqual((res_sup["total_instructions"], res_sup["supported_instructions"], res_sup["unsupported_count"]), - (2, 2, 0), res_sup.get("unsupported_details")) + (3, 3, 0), res_sup.get("unsupported_details")) self.assertTrue(res_sup["opcodes_recognized"]) self.assertEqual(res_sup["unsupported_opcodes"], {}) @@ -4589,13 +4589,10 @@ def test_binary_scan_recognizes_vopc_sdwa(self): self.assertEqual(res_unl["unsupported_opcodes"], {}) self.assertFalse(res_unl["translator_accepted"]) self.assertEqual(res_unl["compatibility_category"], "opcode_recognized_translator_rejected") - self.assertEqual(res_unl["unsupported_count"], 2) + self.assertEqual(res_unl["unsupported_count"], 1) self.assertEqual( [d["raw"] for d in res_unl["unsupported_details"]], - [ - "v_cmp_gt_u32_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:DWORD", - "v_cmpx_eq_f32_sdwa -v1, v2 src0_sel:DWORD src1_sel:DWORD", - ], + ["v_cmpx_eq_f32_sdwa -v1, v2 src0_sel:DWORD src1_sel:DWORD"], ) res_bad = results["ps_vopc_sdwa_f64_fallback.bin"] @@ -5373,6 +5370,28 @@ def test_dashboard_report_generation(self): self.assertIn("stages", json_content) self.assertIn("missing_opcodes_ranked", json_content) + def test_sdwa_int_compare_instructions(self): + """The scanner accepts the integer SDWA comparisons pixel_aot lowers and refuses their neighbours.""" + for line in ( + "v_cmp_lt_i32_sdwa vcc_lo, sext(v20), v18 src0_sel:BYTE_1 src1_sel:BYTE_2", + "v_cmp_f_u32_sdwa s6, v1, v2 src0_sel:DWORD src1_sel:DWORD", + "v_cmp_t_i32_sdwa vcc_lo, v1, sext(v2) src0_sel:WORD_1 src1_sel:WORD_0", + "v_cmp_ge_u16_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:BYTE_0", + "v_cmp_ne_i16_sdwa s[6:7], sext(v1), sext(v2) src0_sel:BYTE_3 src1_sel:DWORD", + ): + self.assertTrue(is_instruction_supported(line), line) + for line in ( + "v_cmp_f_i16_sdwa vcc_lo, v1, v2 src0_sel:WORD_0 src1_sel:WORD_0", + "v_cmp_t_u16_sdwa vcc_lo, v1, v2 src0_sel:WORD_0 src1_sel:WORD_0", + "v_cmp_lt_i32_sdwa vcc_lo, v1, 1 src0_sel:BYTE_0 src1_sel:DWORD", + "v_cmp_lt_i32_sdwa vcc_lo, -v1, v2 src0_sel:BYTE_0 src1_sel:DWORD", + "v_cmp_lt_u32_sdwa vcc_lo, v1, v2 src0_sel:BYTE_0", + "v_cmp_lt_u32_sdwa exec_lo, v1, v2 src0_sel:BYTE_0 src1_sel:BYTE_0", + "v_cmpx_lt_u32_sdwa v1, v2 src0_sel:BYTE_0 src1_sel:BYTE_0", + "v_cmp_lt_i64_sdwa vcc_lo, v1, v2 src0_sel:BYTE_0 src1_sel:BYTE_0", + ): + self.assertFalse(is_instruction_supported(line), line) + def test_supported_shader_instructions(self): """Verify scanner patterns recognize subrev, mov_b32, waitcnt_expcnt as supported.""" self.assertTrue(is_instruction_supported("s_waitcnt_expcnt null, 0x0")) diff --git a/tools/scan_unsupported_shaders.py b/tools/scan_unsupported_shaders.py index c7dd46b11f..30f8b2fef2 100644 --- a/tools/scan_unsupported_shaders.py +++ b/tools/scan_unsupported_shaders.py @@ -222,6 +222,14 @@ def lower_rejection_causes(results: list[dict]) -> dict: SUPPORTED_INSTRUCTIONS_REGEX.append( rf"v_cmp_(?:{icmp_ops})_(?:i32|u32|i16|u16){PIXEL_VOPC_DST},\s+{INTEGER_SOURCE},\s+{INTEGER_SOURCE}" ) + # Integer SDWA comparisons: register sources, optionally under sext(), with both selections printed. gfx10 has + # no f/t forms at 16 bits. + _sdwa_cmp_source = r"(?:sext\([vs]\d+\)|[vs]\d+)" + for _ops, _kinds in ((icmp_ops, "i32|u32"), ("lt|eq|le|gt|ne|ge", "i16|u16")): + SUPPORTED_INSTRUCTIONS_REGEX.append( + rf"v_cmp_(?:{_ops})_(?:{_kinds})_sdwa\s+{PIXEL_LANE_MASK},\s+{_sdwa_cmp_source},\s+{_sdwa_cmp_source}" + rf"\s+src0_sel:{SDWA_SEL_PATTERN}\s+src1_sel:{SDWA_SEL_PATTERN}" + ) # 64-bit comparisons are checked by supports_int64_compare() below: the pair and inline ranges are numeric. INT64_COMPARE_PATTERN = re.compile( rf"v_cmp_(?:{icmp_ops})_(?:i64|u64)(_e32|_e64)?\s+(vcc(?:_lo)?|s\d+|s\[\d+:\d+\]),\s+(\S+),\s+(\S+)" From c641cd3951369167dfb22401ac1be8d81e407e14 Mon Sep 17 00:00:00 2001 From: rm-NoobInCoding <35840559+rm-NoobInCoding@users.noreply.github.com> Date: Tue, 24 Nov 2026 20:44:06 +0330 Subject: [PATCH 3/3] tests: put the integer SDWA comparisons through the LLVM round trip check_binary assembled the SDWA integer operations but none of the v_cmp_*_{i32,u32,i16,u16}_sdwa programs, so the LLVM 15 job never saw the new forms. Add the eight sdwa_int_predicate_group programs to its fixtures: each is assembled, disassembled with LLVM 15 and must translate exactly like its source text. --- tests/pixel_aot_check.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/pixel_aot_check.py b/tests/pixel_aot_check.py index 0e7ddb617b..0efb96a57f 100644 --- a/tests/pixel_aot_check.py +++ b/tests/pixel_aot_check.py @@ -17078,6 +17078,9 @@ def check_binary(directory, assembler, objcopy, library): fixtures.append((uncompressed_export(pack_b32_group()), translate_int)) fixtures.append((uncompressed_export(pack_b32_inline_group()), translate_int)) fixtures.extend((uncompressed_export(sad_group(group)), translate_int) for group in SAD_BODIES) + # The integer SDWA comparisons: each program assembled, disassembled and translated like its source text. + fixtures.extend((sdwa_int_predicate_group(kind, program), translate) + for kind, programs in SDWA_INT_PROGRAMS.items() for program in range(len(programs))) fixtures.extend((compressed_export(mask), translate_masked) for mask in (0x3, 0xC, 0xF)) fixtures.extend((uncompressed_export([], mask), translate_masked) for mask in (0x1, 0x8, 0x5, 0xA)) for restore in (MASKED_OR_RESTORE, MASKED_MOV_RESTORE):