mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 07:20:10 +01:00
brw: Perform mark_last_urb_write_with_eot optimization after CFG
Avoid using exec_node::remove() and the initial "main list of instructions", and instead use the existing helpers like other passes. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37146>
This commit is contained in:
parent
a4e84c9244
commit
9c16bbd023
3 changed files with 41 additions and 17 deletions
|
|
@ -110,13 +110,13 @@ run_gs(brw_shader &s)
|
||||||
|
|
||||||
brw_from_nir(&s);
|
brw_from_nir(&s);
|
||||||
|
|
||||||
brw_emit_gs_thread_end(s);
|
|
||||||
|
|
||||||
if (s.failed)
|
if (s.failed)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
brw_calculate_cfg(s);
|
brw_calculate_cfg(s);
|
||||||
|
|
||||||
|
brw_emit_gs_thread_end(s);
|
||||||
|
|
||||||
brw_optimize(s);
|
brw_optimize(s);
|
||||||
|
|
||||||
s.assign_curb_setup();
|
s.assign_curb_setup();
|
||||||
|
|
|
||||||
|
|
@ -176,13 +176,13 @@ run_tcs(brw_shader &s)
|
||||||
bld.emit(BRW_OPCODE_ENDIF);
|
bld.emit(BRW_OPCODE_ENDIF);
|
||||||
}
|
}
|
||||||
|
|
||||||
brw_emit_tcs_thread_end(s);
|
|
||||||
|
|
||||||
if (s.failed)
|
if (s.failed)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
brw_calculate_cfg(s);
|
brw_calculate_cfg(s);
|
||||||
|
|
||||||
|
brw_emit_tcs_thread_end(s);
|
||||||
|
|
||||||
brw_optimize(s);
|
brw_optimize(s);
|
||||||
|
|
||||||
s.assign_curb_setup();
|
s.assign_curb_setup();
|
||||||
|
|
|
||||||
|
|
@ -578,23 +578,47 @@ brw_barycentric_mode(const struct brw_wm_prog_key *key,
|
||||||
bool
|
bool
|
||||||
brw_shader::mark_last_urb_write_with_eot()
|
brw_shader::mark_last_urb_write_with_eot()
|
||||||
{
|
{
|
||||||
brw_foreach_in_list_reverse(brw_inst, prev, &this->instructions) {
|
brw_inst *limit = NULL;
|
||||||
if (prev->opcode == SHADER_OPCODE_URB_WRITE_LOGICAL) {
|
foreach_block_reverse(block, cfg) {
|
||||||
prev->eot = true;
|
foreach_inst_in_block_reverse(brw_inst, inst, block) {
|
||||||
|
if (inst->opcode == SHADER_OPCODE_URB_WRITE_LOGICAL) {
|
||||||
|
inst->eot = true;
|
||||||
|
limit = inst;
|
||||||
|
break;
|
||||||
|
} else if (inst->is_control_flow() || inst->has_side_effects()) {
|
||||||
|
limit = inst;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (limit)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!limit || !limit->eot)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
brw_analysis_dependency_class dep = BRW_DEPENDENCY_INSTRUCTION_DETAIL;
|
||||||
|
|
||||||
/* Delete now dead instructions. */
|
/* Delete now dead instructions. */
|
||||||
brw_foreach_in_list_reverse_safe(brw_exec_node, dead, &this->instructions) {
|
bool done = false;
|
||||||
if (dead == prev)
|
foreach_block_reverse(block, cfg) {
|
||||||
|
foreach_inst_in_block_reverse_safe(brw_inst, dead, block) {
|
||||||
|
if (dead == limit) {
|
||||||
|
done = true;
|
||||||
break;
|
break;
|
||||||
dead->remove();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else if (prev->is_control_flow() || prev->has_side_effects()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
dep = dep | BRW_DEPENDENCY_INSTRUCTION_IDENTITY;
|
||||||
|
dead->remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (done)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
invalidate_analysis(dep);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue