intel/cs_intrinsics: Handle 64-bit intrinsics
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Nov 2018 03:57:59 +0000 (21:57 -0600)
committerMarge Bot <eric+marge@anholt.net>
Wed, 12 Aug 2020 10:11:06 +0000 (10:11 +0000)
It's safe to do the math in 32 bits because they're all local workgroup
calculations.  We just need to do a conversion at the end.  For a couple
of intrinsics, we just turn them into 32-bit intrinsics and add a u2u64.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6280>

src/intel/compiler/brw_nir_lower_cs_intrinsics.c

index 7c08b36aab68b901b956b47f14d6ab59151e83c2..102bd29595a4777189de00c4b32625b16bdfee4b 100644 (file)
@@ -53,6 +53,18 @@ lower_cs_intrinsics_convert_block(struct lower_intrinsics_state *state,
 
       nir_ssa_def *sysval;
       switch (intrinsic->intrinsic) {
+      case nir_intrinsic_load_local_group_size:
+      case nir_intrinsic_load_work_group_id:
+         /* Convert this to 32-bit if it's not */
+         if (intrinsic->dest.ssa.bit_size == 64) {
+            intrinsic->dest.ssa.bit_size = 32;
+            sysval = nir_u2u64(b, &intrinsic->dest.ssa);
+            nir_ssa_def_rewrite_uses_after(&intrinsic->dest.ssa,
+                                           nir_src_for_ssa(sysval),
+                                           sysval->parent_instr);
+         }
+         continue;
+
       case nir_intrinsic_load_local_invocation_index:
       case nir_intrinsic_load_local_invocation_id: {
          /* First time we are using those, so let's calculate them. */
@@ -171,6 +183,9 @@ lower_cs_intrinsics_convert_block(struct lower_intrinsics_state *state,
          continue;
       }
 
+      if (intrinsic->dest.ssa.bit_size == 64)
+         sysval = nir_u2u64(b, sysval);
+
       nir_ssa_def_rewrite_uses(&intrinsic->dest.ssa, nir_src_for_ssa(sysval));
       nir_instr_remove(&intrinsic->instr);