ir3/a7xx: insert lock/unlock at the end of every compute shader

Add (ss)(sy) in all cases until.

TODO: Set sync flags depending on real need.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23217>
This commit is contained in:
Danylo Piliaiev
2023-04-24 16:39:44 +02:00
committed by Marge Bot
parent 5f89ce8799
commit 9b7452c5e6
2 changed files with 14 additions and 1 deletions
+12
View File
@@ -5004,6 +5004,18 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
}
}
if (ctx->compiler->gen >= 7 && so->type == MESA_SHADER_COMPUTE) {
struct ir3_instruction *end = find_end(so->ir);
struct ir3_instruction *lock =
ir3_instr_create(ctx->block, OPC_LOCK, 0, 0);
/* TODO: This flags should be set by scheduler only when needed */
lock->flags = IR3_INSTR_SS | IR3_INSTR_SY | IR3_INSTR_JP;
ir3_instr_move_before(lock, end);
struct ir3_instruction *unlock =
ir3_instr_create(ctx->block, OPC_UNLOCK, 0, 0);
ir3_instr_move_before(unlock, end);
}
so->branchstack = ctx->max_stack;
so->pvtmem_size = ALIGN(so->pvtmem_size, compiler->pvtmem_per_fiber_align);
+2 -1
View File
@@ -72,7 +72,8 @@ remove_unused_by_block(struct ir3_block *block)
bool progress = false;
foreach_instr_safe (instr, &block->instr_list) {
if (instr->opc == OPC_END || instr->opc == OPC_CHSH ||
instr->opc == OPC_CHMASK)
instr->opc == OPC_CHMASK || instr->opc == OPC_LOCK ||
instr->opc == OPC_UNLOCK)
continue;
if (instr->flags & IR3_INSTR_UNUSED) {
if (instr->opc == OPC_META_SPLIT) {