From: Mike Blumenkrantz Date: Fri, 4 Aug 2023 18:59:14 +0000 (-0400) Subject: nir/lower_io: add a new doubles-only 64bit lowering option X-Git-Tag: upstream/23.3.3~3500 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=550f3dc437021c8b512687943fc955906f380d6f;p=platform%2Fupstream%2Fmesa.git nir/lower_io: add a new doubles-only 64bit lowering option this allows lowering only 64bit float operations for drivers that support 64bit integers Reviewed-by: Timur Kristóf Part-of: --- diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 1dd90bb..15997fc 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4883,6 +4883,11 @@ typedef enum { * modes. */ nir_lower_io_lower_64bit_to_32 = (1 << 0), + /* If set, this causes the subset of 64-bit IO operations involving floats to be lowered on-the-fly + * to 32-bit operations. This is only valid for nir_var_shader_in/out + * modes. + */ + nir_lower_io_lower_64bit_float_to_32 = (1 << 1), } nir_lower_io_options; bool nir_lower_io(nir_shader *shader, nir_variable_mode modes, diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index ebf6388..38ed2a8 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -345,8 +345,9 @@ lower_load(nir_intrinsic_instr *intrin, struct lower_io_state *state, nir_ssa_def *array_index, nir_variable *var, nir_ssa_def *offset, unsigned component, const struct glsl_type *type) { + const bool lower_double = !glsl_type_is_integer(type) && state->options & nir_lower_io_lower_64bit_float_to_32; if (intrin->dest.ssa.bit_size == 64 && - (state->options & nir_lower_io_lower_64bit_to_32)) { + (lower_double || (state->options & nir_lower_io_lower_64bit_to_32))) { nir_builder *b = &state->builder; const unsigned slot_size = state->type_size(glsl_dvec_type(2), false); @@ -456,8 +457,9 @@ lower_store(nir_intrinsic_instr *intrin, struct lower_io_state *state, nir_ssa_def *array_index, nir_variable *var, nir_ssa_def *offset, unsigned component, const struct glsl_type *type) { + const bool lower_double = !glsl_type_is_integer(type) && state->options & nir_lower_io_lower_64bit_float_to_32; if (intrin->src[1].ssa->bit_size == 64 && - (state->options & nir_lower_io_lower_64bit_to_32)) { + (lower_double || (state->options & nir_lower_io_lower_64bit_to_32))) { nir_builder *b = &state->builder; const unsigned slot_size = state->type_size(glsl_dvec_type(2), false);