mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
ir3/sched: handle dependencies between stc and const reads
Signed-off-by: Job Noorman <jnoorman@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32454>
This commit is contained in:
parent
0f6ec14925
commit
f9fc0fc8fd
2 changed files with 32 additions and 0 deletions
|
|
@ -1029,6 +1029,11 @@ ir3_store_const(struct ir3_shader_variant *so, struct ir3_builder *build,
|
|||
stc->cat6.type = TYPE_U32;
|
||||
stc->barrier_conflict = IR3_BARRIER_CONST_W;
|
||||
|
||||
/* This isn't necessary for instruction encoding but is used by ir3_sched to
|
||||
* set up dependencies between stc and const reads.
|
||||
*/
|
||||
stc->cat6.dst_offset = dst;
|
||||
|
||||
if (a1) {
|
||||
ir3_instr_set_address(stc, a1);
|
||||
stc->flags |= IR3_INSTR_A1EN;
|
||||
|
|
|
|||
|
|
@ -1372,6 +1372,29 @@ add_barrier_deps(struct ir3_block *block, struct ir3_instruction *instr)
|
|||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
add_const_deps(struct ir3_block *block, struct ir3_instruction *stc)
|
||||
{
|
||||
bool progress = false;
|
||||
unsigned const_start = stc->cat6.dst_offset;
|
||||
unsigned const_end = const_start + stc->cat6.iim_val;
|
||||
|
||||
foreach_instr_from (instr, stc, &block->instr_list) {
|
||||
foreach_src (src, instr) {
|
||||
if (!(src->flags & IR3_REG_CONST)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (src->num >= const_start && src->num < const_end) {
|
||||
ir3_instr_add_dep(instr, stc);
|
||||
progress = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
/* before scheduling a block, we need to add any necessary false-dependencies
|
||||
* to ensure that:
|
||||
*
|
||||
|
|
@ -1392,6 +1415,10 @@ ir3_sched_add_deps(struct ir3 *ir)
|
|||
add_barrier_deps(block, instr);
|
||||
progress = true;
|
||||
}
|
||||
|
||||
if (instr->opc == OPC_STC) {
|
||||
progress |= add_const_deps(block, instr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue