From b711e62e615095524a1af8dc4a6665bf1514a56c Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 26 Sep 2019 10:33:43 +0100 Subject: [PATCH] aco: set loop_info::has_discard for demotes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We need the loop header phis for the outer exec masks. Needed for dEQP-VK.glsl.demote.dynamic_loop_texture Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann --- src/amd/compiler/aco_insert_exec_mask.cpp | 9 ++++++--- src/amd/compiler/aco_instruction_selection.cpp | 4 ++-- src/amd/compiler/aco_ir.h | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/amd/compiler/aco_insert_exec_mask.cpp b/src/amd/compiler/aco_insert_exec_mask.cpp index 7886a4c77e2..b423c5b9190 100644 --- a/src/amd/compiler/aco_insert_exec_mask.cpp +++ b/src/amd/compiler/aco_insert_exec_mask.cpp @@ -72,7 +72,7 @@ struct loop_info { uint8_t needs; bool has_divergent_break; bool has_divergent_continue; - bool has_discard; + bool has_discard; /* has a discard or demote */ loop_info(Block* b, uint16_t num, uint8_t needs, bool breaks, bool cont, bool discard) : loop_header(b), num_exec_masks(num), needs(needs), has_divergent_break(breaks), has_divergent_continue(cont), has_discard(discard) {} @@ -279,7 +279,8 @@ void calculate_wqm_needs(exec_ctx& exec_ctx) ever_again_needs |= exec_ctx.info[i].block_needs & ~Exact_Branch; if (block.kind & block_kind_discard || - block.kind & block_kind_uses_discard_if) + block.kind & block_kind_uses_discard_if || + block.kind & block_kind_uses_demote) ever_again_needs |= Exact; /* don't propagate WQM preservation further than the next top_level block */ @@ -629,6 +630,7 @@ void process_instructions(exec_ctx& ctx, Block* block, (ctx.info[block->index].block_needs & state) != (ctx.info[block->index].block_needs & (WQM | Exact))) || block->kind & block_kind_uses_discard_if || + block->kind & block_kind_uses_demote || block->kind & block_kind_needs_lowering; if (!process) { std::vector>::iterator it = std::next(block->instructions.begin(), idx); @@ -811,7 +813,8 @@ void add_branch_code(exec_ctx& ctx, Block* block) needs |= ctx.info[i].block_needs; if (loop_block.kind & block_kind_uses_discard_if || - loop_block.kind & block_kind_discard) + loop_block.kind & block_kind_discard || + loop_block.kind & block_kind_uses_demote) has_discard = true; if (loop_block.loop_nest_depth != loop_nest_depth) continue; diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 7405b1142f9..7b5dc7f7426 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -5831,7 +5831,7 @@ void visit_intrinsic(isel_context *ctx, nir_intrinsic_instr *instr) } case nir_intrinsic_demote: bld.pseudo(aco_opcode::p_demote_to_helper); - ctx->block->kind |= block_kind_needs_lowering; + ctx->block->kind |= block_kind_uses_demote; ctx->program->needs_exact = true; break; case nir_intrinsic_demote_if: { @@ -5839,7 +5839,7 @@ void visit_intrinsic(isel_context *ctx, nir_intrinsic_instr *instr) as_divergent_bool(ctx, get_ssa_temp(ctx, instr->src[0].ssa), false), Operand(exec, s2)); bld.pseudo(aco_opcode::p_demote_to_helper, cond); - ctx->block->kind |= block_kind_needs_lowering; + ctx->block->kind |= block_kind_uses_demote; ctx->program->needs_exact = true; break; } diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 139dd1e371c..24ff6a2b142 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -924,6 +924,7 @@ enum block_kind { block_kind_invert = 1 << 11, block_kind_uses_discard_if = 1 << 12, block_kind_needs_lowering = 1 << 13, + block_kind_uses_demote = 1 << 14, }; -- 2.30.2