From fe18a0fd45c79cdba7b63959657861488c775c0d Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 1 Sep 2020 14:46:25 -0500 Subject: [PATCH] intel/nir: Lower load_num_work_groups to 32-bit if needed For OpenCL-style kernels, this builtin is 64-bit. Reviewed-by: Kenneth Graunke Part-of: --- src/intel/compiler/brw_fs_nir.cpp | 1 + src/intel/compiler/brw_nir_lower_cs_intrinsics.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index 10fffa13054..1e7418d5484 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -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; diff --git a/src/intel/compiler/brw_nir_lower_cs_intrinsics.c b/src/intel/compiler/brw_nir_lower_cs_intrinsics.c index 401fbdd1a4b..2fc160aff13 100644 --- a/src/intel/compiler/brw_nir_lower_cs_intrinsics.c +++ b/src/intel/compiler/brw_nir_lower_cs_intrinsics.c @@ -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; -- 2.30.2