Commit 989de901 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜
Browse files

pan/bi: Adapt bi_lower_branch for Valhall



Disable the Bifrost optimization; it's not portable.
Signed-off-by: Alyssa Rosenzweig's avatarAlyssa Rosenzweig <alyssa@collabora.com>
parent 3e42b40e
...@@ -3449,12 +3449,23 @@ bifrost_nir_lower_store_component(struct nir_builder *b, ...@@ -3449,12 +3449,23 @@ bifrost_nir_lower_store_component(struct nir_builder *b,
/* Dead code elimination for branches at the end of a block - only one branch /* Dead code elimination for branches at the end of a block - only one branch
* per block is legal semantically, but unreachable jumps can be generated. * per block is legal semantically, but unreachable jumps can be generated.
* Likewise we can generate jumps to the terminal block which need to be * Likewise on Bifrost we can generate jumps to the terminal block which need
* lowered away to a jump to #0x0, which induces successful termination. */ * to be lowered away to a jump to #0x0, which induces successful termination.
* That trick doesn't work on Valhall, which needs a NOP inserted in the
* terminal block instead.
*/
static void static void
bi_lower_branch(bi_block *block) bi_lower_terminal_block(bi_context *ctx, bi_block *block)
{ {
bi_builder b = bi_init_builder(ctx, bi_after_block(block));
bi_nop_to(&b, bi_null());
}
static void
bi_lower_branch(bi_context *ctx, bi_block *block)
{
bool cull_terminal = (ctx->arch <= 8);
bool branched = false; bool branched = false;
ASSERTED bool was_jump = false; ASSERTED bool was_jump = false;
...@@ -3470,8 +3481,13 @@ bi_lower_branch(bi_block *block) ...@@ -3470,8 +3481,13 @@ bi_lower_branch(bi_block *block)
branched = true; branched = true;
was_jump = ins->op == BI_OPCODE_JUMP; was_jump = ins->op == BI_OPCODE_JUMP;
if (bi_is_terminal_block(ins->branch_target)) if (!bi_is_terminal_block(ins->branch_target))
continue;
if (cull_terminal)
ins->branch_target = NULL; ins->branch_target = NULL;
else if (ins->branch_target)
bi_lower_terminal_block(ctx, ins->branch_target);
} }
} }
...@@ -3630,7 +3646,7 @@ bifrost_compile_shader_nir(nir_shader *nir, ...@@ -3630,7 +3646,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
} }
bi_foreach_block(ctx, block) { bi_foreach_block(ctx, block) {
bi_lower_branch(block); bi_lower_branch(ctx, block);
} }
if (bifrost_debug & BIFROST_DBG_SHADERS && !skip_internal) if (bifrost_debug & BIFROST_DBG_SHADERS && !skip_internal)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment