From d496fe153ad66a58cadca04961ca4248ad1f6fb1 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 19 Apr 2022 14:00:01 -0400 Subject: [PATCH] pan/bi: Count blocks For u_worklist. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_test.h | 1 + src/panfrost/bifrost/bifrost_compile.c | 7 ++----- src/panfrost/bifrost/compiler.h | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/panfrost/bifrost/bi_test.h b/src/panfrost/bifrost/bi_test.h index 04e04602887..9a745fef6f2 100644 --- a/src/panfrost/bifrost/bi_test.h +++ b/src/panfrost/bifrost/bi_test.h @@ -37,6 +37,7 @@ bit_builder(void *memctx) { bi_context *ctx = rzalloc(memctx, bi_context); list_inithead(&ctx->blocks); + ctx->num_blocks = 1; bi_block *blk = rzalloc(ctx, bi_block); diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index f7b6f2959c7..c653530e939 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -4555,12 +4555,9 @@ bi_compile_variant_nir(nir_shader *nir, break; /* TODO: Multi-function shaders */ } - unsigned block_source_count = 0; - + /* Index blocks now that we're done emitting */ bi_foreach_block(ctx, block) { - /* Name blocks now that we're done emitting so the order is - * consistent */ - block->index = block_source_count++; + block->index = ctx->num_blocks++; } bi_validate(ctx, "NIR -> BIR"); diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index a143dd84a39..3e9c23ec5c5 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -731,6 +731,7 @@ typedef struct { uint32_t quirks; unsigned arch; enum bi_idvs_mode idvs; + unsigned num_blocks; /* In any graphics shader, whether the "IDVS with memory * allocation" flow is used. This affects how varyings are loaded and