mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 07:20:10 +01:00
pan/bi: Keep vectorized phis
When the source contains vectorized phis, keep them to avoid generating unnecessary moves. Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38772>
This commit is contained in:
parent
d3a890a58e
commit
6b67ca2e8f
1 changed files with 12 additions and 3 deletions
|
|
@ -5021,7 +5021,7 @@ bi_emit_phi_deferred(bi_context *ctx, bi_block *block, bi_instr *I)
|
||||||
nir_phi_instr *phi = I->phi;
|
nir_phi_instr *phi = I->phi;
|
||||||
|
|
||||||
/* Guaranteed by lower_phis_to_scalar */
|
/* Guaranteed by lower_phis_to_scalar */
|
||||||
assert(phi->def.num_components == 1);
|
assert(phi->def.bit_size * phi->def.num_components <= 32);
|
||||||
|
|
||||||
nir_foreach_phi_src(src, phi) {
|
nir_foreach_phi_src(src, phi) {
|
||||||
bi_block *pred = bi_from_nir_block(ctx, src->pred);
|
bi_block *pred = bi_from_nir_block(ctx, src->pred);
|
||||||
|
|
@ -5502,7 +5502,16 @@ bi_vectorize_filter(const nir_instr *instr, const void *data)
|
||||||
{
|
{
|
||||||
unsigned gpu_id = *((unsigned *)data);
|
unsigned gpu_id = *((unsigned *)data);
|
||||||
|
|
||||||
/* Defaults work for everything else */
|
if (instr->type == nir_instr_type_phi) {
|
||||||
|
unsigned bit_size = nir_instr_as_phi(instr)->def.bit_size;
|
||||||
|
if (bit_size == 8)
|
||||||
|
return 4;
|
||||||
|
if (bit_size == 16)
|
||||||
|
return 2;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do not vectorize all non-ALU instruction */
|
||||||
if (instr->type != nir_instr_type_alu)
|
if (instr->type != nir_instr_type_alu)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -6355,7 +6364,7 @@ bifrost_postprocess_nir(nir_shader *nir, unsigned gpu_id)
|
||||||
|
|
||||||
NIR_PASS(_, nir, nir_lower_alu_width, bi_vectorize_filter, &gpu_id);
|
NIR_PASS(_, nir, nir_lower_alu_width, bi_vectorize_filter, &gpu_id);
|
||||||
NIR_PASS(_, nir, nir_lower_load_const_to_scalar);
|
NIR_PASS(_, nir, nir_lower_load_const_to_scalar);
|
||||||
NIR_PASS(_, nir, nir_lower_all_phis_to_scalar);
|
NIR_PASS(_, nir, nir_lower_phis_to_scalar, bi_vectorize_filter, &gpu_id);
|
||||||
NIR_PASS(_, nir, nir_lower_flrp, 16 | 32 | 64, false /* always_precise */);
|
NIR_PASS(_, nir, nir_lower_flrp, 16 | 32 | 64, false /* always_precise */);
|
||||||
NIR_PASS(_, nir, nir_lower_var_copies);
|
NIR_PASS(_, nir, nir_lower_var_copies);
|
||||||
NIR_PASS(_, nir, nir_lower_alu);
|
NIR_PASS(_, nir, nir_lower_alu);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue