lima/gpir: kill dead writes to regs in DCE

Writes to regs that are never read will confuse regalloc since they
are never live and don't conflict with any regs. Kill them to prevent
overwriting another live reg.

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4125>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4125>
This commit is contained in:
Vasily Khoruzhick 2020-03-09 19:34:43 -07:00 committed by Marge Bot
parent 8c1bcc8555
commit b7d89476f1
3 changed files with 28 additions and 17 deletions

View file

@ -69,19 +69,9 @@ dEQP-GLES2.functional.shaders.functions.qualifiers.inout_lowp_int_vertex
dEQP-GLES2.functional.shaders.functions.qualifiers.out_highp_int_vertex
dEQP-GLES2.functional.shaders.functions.qualifiers.out_int_vertex
dEQP-GLES2.functional.shaders.functions.qualifiers.out_lowp_int_vertex
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat3_dynamic_loop_write_static_loop_read_vertex
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat3_dynamic_loop_write_static_read_vertex
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat3_dynamic_write_dynamic_loop_read_vertex
dEQP-GLES2.functional.shaders.loops.do_while_constant_iterations.conditional_body_vertex
dEQP-GLES2.functional.shaders.loops.do_while_dynamic_iterations.vector_counter_fragment
dEQP-GLES2.functional.shaders.loops.do_while_uniform_iterations.conditional_body_vertex
dEQP-GLES2.functional.shaders.loops.do_while_uniform_iterations.nested_tricky_dataflow_2_vertex
dEQP-GLES2.functional.shaders.loops.for_dynamic_iterations.vector_counter_fragment
dEQP-GLES2.functional.shaders.loops.while_constant_iterations.compound_statement_vertex
dEQP-GLES2.functional.shaders.loops.while_constant_iterations.sequence_statement_vertex
dEQP-GLES2.functional.shaders.loops.while_dynamic_iterations.nested_sequence_vertex
dEQP-GLES2.functional.shaders.loops.while_dynamic_iterations.vector_counter_fragment
dEQP-GLES2.functional.shaders.loops.while_uniform_iterations.nested_vertex
dEQP-GLES2.functional.shaders.operator.binary_operator.sub_assign_effect.highp_int_vertex
dEQP-GLES2.functional.shaders.operator.binary_operator.sub_assign_effect.highp_ivec2_int_vertex
dEQP-GLES2.functional.shaders.operator.binary_operator.sub_assign_effect.highp_ivec2_vertex

View file

@ -26,18 +26,11 @@ dEQP-GLES2.functional.shaders.random.all_features.fragment.55
dEQP-GLES2.functional.shaders.random.trigonometric.fragment.1
dEQP-GLES2.functional.shaders.random.trigonometric.fragment.69
# Driver bugs causing GPU errors
dEQP-GLES2.functional.shaders.loops.while_constant_iterations.nested_sequence_vertex
dEQP-GLES2.functional.shaders.loops.while_constant_iterations.conditional_body_vertex
dEQP-GLES2.functional.shaders.loops.while_uniform_iterations.conditional_continue_vertex
dEQP-GLES2.functional.shaders.loops.while_uniform_iterations.double_continue_vertex
# Hangs / OOM
dEQP-GLES2.functional.shaders.indexing.varying_array.vec4_dynamic_loop_write_static_read
dEQP-GLES2.functional.shaders.indexing.varying_array.vec4_dynamic_loop_write_dynamic_read
dEQP-GLES2.functional.shaders.indexing.varying_array.vec4_dynamic_loop_write_static_loop_read
dEQP-GLES2.functional.shaders.indexing.varying_array.vec4_dynamic_loop_write_dynamic_loop_read
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec3_dynamic_loop_write_dynamic_read_vertex
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec4_dynamic_loop_write_static_read_vertex
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec4_dynamic_loop_write_dynamic_read_vertex

View file

@ -171,6 +171,34 @@ dead_code_eliminate(gpir_compiler *comp)
}
}
}
/* Kill all the writes to regs that are never read. All the known
* instances of these are coming from the cycle-breaking register
* created in out-of-SSA. See resolve_parallel_copy() in nir_from_ssa.c
* Since we kill redundant movs when we translate nir into gpir, it
* results in this reg being written, but never read.
*/
BITSET_WORD *regs = rzalloc_array(comp, BITSET_WORD, comp->cur_reg);
list_for_each_entry(gpir_block, block, &comp->block_list, list) {
list_for_each_entry(gpir_node, node, &block->node_list, list) {
if (node->op != gpir_op_load_reg)
continue;
gpir_load_node *load = gpir_node_to_load(node);
BITSET_SET(regs, load->reg->index);
}
}
list_for_each_entry(gpir_block, block, &comp->block_list, list) {
list_for_each_entry_safe(gpir_node, node, &block->node_list, list) {
if (node->op != gpir_op_store_reg)
continue;
gpir_store_node *store = gpir_node_to_store(node);
if (!BITSET_TEST(regs, store->reg->index))
gpir_node_delete(node);
}
}
ralloc_free(regs);
}
bool