Mesa (main): ir3: Add loop depth to ir3_block
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 20 10:57:10 UTC 2021
Module: Mesa
Branch: main
Commit: be3ab7ded42fa9041da548a7583df23f54d27c4f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=be3ab7ded42fa9041da548a7583df23f54d27c4f
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Fri Jul 23 13:05:50 2021 +0200
ir3: Add loop depth to ir3_block
And while we're at it, fix adding loop_id for the continue block.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>
---
src/freedreno/ir3/ir3.h | 1 +
src/freedreno/ir3/ir3_compiler_nir.c | 5 +++++
src/freedreno/ir3/ir3_context.h | 1 +
3 files changed, 7 insertions(+)
diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h
index 624a416e958..0512d8b5b3d 100644
--- a/src/freedreno/ir3/ir3.h
+++ b/src/freedreno/ir3/ir3.h
@@ -588,6 +588,7 @@ struct ir3_block {
uint32_t dom_post_index;
uint32_t loop_id;
+ uint32_t loop_depth;
#ifdef DEBUG
uint32_t serialno;
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 16be6e1f810..e3c10be1b4d 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -2984,6 +2984,7 @@ emit_block(struct ir3_context *ctx, nir_block *nblock)
list_addtail(&ctx->block->node, &ctx->ir->block_list);
ctx->block->loop_id = ctx->loop_id;
+ ctx->block->loop_depth = ctx->loop_depth;
/* re-emit addr register in each block if needed: */
for (int i = 0; i < ARRAY_SIZE(ctx->addr0_ht); i++) {
@@ -3056,6 +3057,7 @@ emit_loop(struct ir3_context *ctx, nir_loop *nloop)
{
unsigned old_loop_id = ctx->loop_id;
ctx->loop_id = ctx->so->loops + 1;
+ ctx->loop_depth++;
struct nir_block *nstart = nir_loop_first_block(nloop);
struct ir3_block *continue_blk = NULL;
@@ -3075,10 +3077,13 @@ emit_loop(struct ir3_context *ctx, nir_loop *nloop)
struct ir3_block *start = get_block(ctx, nstart);
continue_blk->successors[0] = start;
continue_blk->physical_successors[0] = start;
+ continue_blk->loop_id = ctx->loop_id;
+ continue_blk->loop_depth = ctx->loop_depth;
list_addtail(&continue_blk->node, &ctx->ir->block_list);
}
ctx->so->loops++;
+ ctx->loop_depth--;
ctx->loop_id = old_loop_id;
}
diff --git a/src/freedreno/ir3/ir3_context.h b/src/freedreno/ir3/ir3_context.h
index 18dfcabb2ce..844f14623e3 100644
--- a/src/freedreno/ir3/ir3_context.h
+++ b/src/freedreno/ir3/ir3_context.h
@@ -114,6 +114,7 @@ struct ir3_context {
unsigned stack, max_stack;
unsigned loop_id;
+ unsigned loop_depth;
/* a common pattern for indirect addressing is to request the
* same address register multiple times. To avoid generating
More information about the mesa-commit
mailing list