nir/lower_bit_size: Fix subgroup lowering for floats
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Thu, 26 Oct 2023 13:01:15 +0000 (08:01 -0500)
committerEric Engestrom <eric@engestrom.ch>
Mon, 30 Oct 2023 15:47:22 +0000 (15:47 +0000)
Using u2u is always correct for integers, including signed integers,
because we're doing a down-cast.  It's wrong for floats, though.

Fixes: f95665cfebbd ("nir/lower_bit_size: Add support for lowering subgroup ops")
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25894>
(cherry picked from commit 5979e74177eb3013ca7e78867295e9a015e6c8ed)

.pick_status.json
src/compiler/nir/nir_lower_bit_size.c

index d2d18bc..8247aa1 100644 (file)
         "description": "nir/lower_bit_size: Fix subgroup lowering for floats",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "f95665cfebbd943ca3795c026e3dabf4af3f262c",
         "notes": null
index 37889a3..35097b8 100644 (file)
@@ -203,7 +203,7 @@ lower_intrinsic_instr(nir_builder *b, nir_intrinsic_instr *intrin,
 
       if (intrin->intrinsic != nir_intrinsic_vote_feq &&
           intrin->intrinsic != nir_intrinsic_vote_ieq)
-         res = nir_u2uN(b, res, old_bit_size);
+         res = nir_convert_to_bit_size(b, res, type, old_bit_size);
 
       nir_def_rewrite_uses(&intrin->def, res);
       break;