aco: insert waitcnt before/after ds_ordered_count

The LLVM backend does this when lowering ordered_xfb_counter_add_amd. I
guess there is some missing dependency checking or something.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19345>
This commit is contained in:
Rhys Perry
2022-10-27 12:49:09 +01:00
committed by Marge Bot
parent ea8ddf5c26
commit 7fa50ced14
5 changed files with 77 additions and 0 deletions
+12
View File
@@ -393,6 +393,11 @@ kill(wait_imm& imm, Instruction* instr, wait_ctx& ctx, memory_sync_info sync_inf
}
}
if (instr->opcode == aco_opcode::ds_ordered_count &&
((instr->ds().offset1 | (instr->ds().offset0 >> 8)) & 0x1)) {
imm.combine(ctx.barrier_imm[ffs(storage_gds) - 1]);
}
if (ctx.program->early_rast && instr->opcode == aco_opcode::exp) {
if (instr->exp().dest >= V_008DFC_SQ_EXP_POS && instr->exp().dest < V_008DFC_SQ_EXP_PRIM) {
@@ -774,8 +779,15 @@ handle_block(Program* program, Block& block, wait_ctx& ctx)
if (!queued_imm.empty())
emit_waitcnt(ctx, new_instructions, queued_imm);
bool is_ordered_count_acquire =
instr->opcode == aco_opcode::ds_ordered_count &&
!((instr->ds().offset1 | (instr->ds().offset0 >> 8)) & 0x1);
new_instructions.emplace_back(std::move(instr));
perform_barrier(ctx, queued_imm, sync_info, semantic_acquire);
if (is_ordered_count_acquire)
queued_imm.combine(ctx.barrier_imm[ffs(storage_gds) - 1]);
}
}