intel/nir: Lower load_num_work_groups to 32-bit if needed
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 1 Sep 2020 19:46:25 +0000 (14:46 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 2 Sep 2020 20:38:22 +0000 (20:38 +0000)
For OpenCL-style kernels, this builtin is 64-bit.

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

src/intel/compiler/brw_fs_nir.cpp
src/intel/compiler/brw_nir_lower_cs_intrinsics.c

index 10fffa13054aae9267dd4ae93aaee9fe069c434d..1e7418d5484c8da15cd549ca8217c2b4de1057d1 100644 (file)
@@ -3759,6 +3759,7 @@ fs_visitor::nir_emit_cs_intrinsic(const fs_builder &bld,
    }
 
    case nir_intrinsic_load_num_work_groups: {
+      assert(nir_dest_bit_size(instr->dest) == 32);
       const unsigned surface =
          cs_prog_data->binding_table.work_groups_start;
 
index 401fbdd1a4bf1e2e8c0c5bbca09e1063a1ed3cb5..2fc160aff134b79f8c15e7ba40f938c1bbef79b5 100644 (file)
@@ -55,6 +55,7 @@ lower_cs_intrinsics_convert_block(struct lower_intrinsics_state *state,
       switch (intrinsic->intrinsic) {
       case nir_intrinsic_load_local_group_size:
       case nir_intrinsic_load_work_group_id:
+      case nir_intrinsic_load_num_work_groups:
          /* Convert this to 32-bit if it's not */
          if (intrinsic->dest.ssa.bit_size == 64) {
             intrinsic->dest.ssa.bit_size = 32;