mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 09:20:12 +01:00
nir/opt_vectorize_io: optionally don't vectorize IO with different types
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11443 Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29895>
This commit is contained in:
parent
07ef1a8124
commit
d90080b51b
3 changed files with 29 additions and 1 deletions
|
|
@ -99,7 +99,8 @@ void ac_set_nir_options(struct radeon_info *info, bool use_llvm,
|
||||||
options->io_options = nir_io_has_flexible_input_interpolation_except_flat |
|
options->io_options = nir_io_has_flexible_input_interpolation_except_flat |
|
||||||
(info->gfx_level >= GFX8 ? nir_io_16bit_input_output_support : 0) |
|
(info->gfx_level >= GFX8 ? nir_io_16bit_input_output_support : 0) |
|
||||||
nir_io_prefer_scalar_fs_inputs |
|
nir_io_prefer_scalar_fs_inputs |
|
||||||
nir_io_mix_convergent_flat_with_interpolated;
|
nir_io_mix_convergent_flat_with_interpolated |
|
||||||
|
nir_io_vectorizer_ignores_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -3727,6 +3727,14 @@ typedef enum {
|
||||||
*/
|
*/
|
||||||
nir_io_mix_convergent_flat_with_interpolated = BITFIELD_BIT(5),
|
nir_io_mix_convergent_flat_with_interpolated = BITFIELD_BIT(5),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether src_type and dest_type of IO intrinsics are irrelevant and
|
||||||
|
* should be ignored by nir_opt_vectorize_io. All drivers that always treat
|
||||||
|
* load_input and store_output as untyped and load_interpolated_input as
|
||||||
|
* float##bit_size should set this.
|
||||||
|
*/
|
||||||
|
nir_io_vectorizer_ignores_types = BITFIELD_BIT(6),
|
||||||
|
|
||||||
/* Options affecting the GLSL compiler are below. */
|
/* Options affecting the GLSL compiler are below. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,25 @@ compare_is_not_vectorizable(nir_intrinsic_instr *a, nir_intrinsic_instr *b)
|
||||||
sem0.high_16bits != sem1.high_16bits)
|
sem0.high_16bits != sem1.high_16bits)
|
||||||
return sem0.high_16bits > sem1.high_16bits ? 1 : -1;
|
return sem0.high_16bits > sem1.high_16bits ? 1 : -1;
|
||||||
|
|
||||||
|
nir_shader *shader =
|
||||||
|
nir_cf_node_get_function(&a->instr.block->cf_node)->function->shader;
|
||||||
|
|
||||||
|
/* Compare the types. */
|
||||||
|
if (!(shader->options->io_options & nir_io_vectorizer_ignores_types)) {
|
||||||
|
unsigned type_a, type_b;
|
||||||
|
|
||||||
|
if (nir_intrinsic_has_src_type(a)) {
|
||||||
|
type_a = nir_intrinsic_src_type(a);
|
||||||
|
type_b = nir_intrinsic_src_type(b);
|
||||||
|
} else {
|
||||||
|
type_a = nir_intrinsic_dest_type(a);
|
||||||
|
type_b = nir_intrinsic_dest_type(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type_a != type_b)
|
||||||
|
return type_a > type_b ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue