From c9e5605720f48b3094e708e5c762b340544ab3ff Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 14 May 2020 16:09:07 -0700 Subject: [PATCH] freedreno/ir3/postsched: report progress Or do the easy thing and claim we always changed something. It is kinda hard and not worth the effort to determine for real. Also rip out unused error handling. This pass should never fail. And we weren't even actually checking the return. And while we're at it, switch over to taking the 'struct ir3 ir*` instead of ctx, to standardize with the other passes. Signed-off-by: Rob Clark Part-of: --- src/freedreno/ir3/ir3.h | 2 +- src/freedreno/ir3/ir3_compiler_nir.c | 2 +- src/freedreno/ir3/ir3_postsched.c | 41 ++++++++++------------------ 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 4140607962b..2838346ad5c 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -1208,7 +1208,7 @@ bool ir3_sched_add_deps(struct ir3 *ir); int ir3_sched(struct ir3 *ir); struct ir3_context; -int ir3_postsched(struct ir3_context *ctx); +bool ir3_postsched(struct ir3 *ir); bool ir3_a6xx_fixup_atomic_dests(struct ir3 *ir, struct ir3_shader_variant *so); diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 4dff42c8246..d7ebbdae61c 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -3664,7 +3664,7 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler, goto out; } - ir3_postsched(ctx); + ir3_postsched(ir); ir3_debug_print(ir, "AFTER: ir3_postsched"); if (compiler->gpu_id >= 600) { diff --git a/src/freedreno/ir3/ir3_postsched.c b/src/freedreno/ir3/ir3_postsched.c index 238d937c805..a9a14d23e23 100644 --- a/src/freedreno/ir3/ir3_postsched.c +++ b/src/freedreno/ir3/ir3_postsched.c @@ -51,7 +51,7 @@ */ struct ir3_postsched_ctx { - struct ir3_context *ctx; + struct ir3 *ir; void *mem_ctx; struct ir3_block *block; /* the current block */ @@ -59,8 +59,6 @@ struct ir3_postsched_ctx { struct list_head unscheduled_list; /* unscheduled instructions */ - bool error; - int sfu_delay; int tex_delay; }; @@ -317,7 +315,7 @@ choose_instr(struct ir3_postsched_ctx *ctx) } struct ir3_postsched_deps_state { - struct ir3_context *ctx; + struct ir3_postsched_ctx *ctx; enum { F, R } direction; @@ -461,9 +459,9 @@ static void calculate_forward_deps(struct ir3_postsched_ctx *ctx) { struct ir3_postsched_deps_state state = { - .ctx = ctx->ctx, + .ctx = ctx, .direction = F, - .merged = ctx->ctx->compiler->gpu_id >= 600, + .merged = ctx->ir->compiler->gpu_id >= 600, }; foreach_instr (instr, &ctx->unscheduled_list) { @@ -475,9 +473,9 @@ static void calculate_reverse_deps(struct ir3_postsched_ctx *ctx) { struct ir3_postsched_deps_state state = { - .ctx = ctx->ctx, + .ctx = ctx, .direction = R, - .merged = ctx->ctx->compiler->gpu_id >= 600, + .merged = ctx->ir->compiler->gpu_id >= 600, }; foreach_instr_rev (instr, &ctx->unscheduled_list) { @@ -628,15 +626,7 @@ sched_block(struct ir3_postsched_ctx *ctx, struct ir3_block *block) schedule(ctx, instr); while (!list_is_empty(&ctx->unscheduled_list)) { - struct ir3_instruction *instr; - - instr = choose_instr(ctx); - - /* this shouldn't happen: */ - if (!instr) { - ctx->error = true; - break; - } + struct ir3_instruction *instr = choose_instr(ctx); unsigned delay = ir3_delay_calc(ctx->block, instr, false, false); d("delay=%u", delay); @@ -711,22 +701,19 @@ cleanup_self_movs(struct ir3 *ir) } } -int -ir3_postsched(struct ir3_context *cctx) +bool +ir3_postsched(struct ir3 *ir) { struct ir3_postsched_ctx ctx = { - .ctx = cctx, + .ir = ir, }; - ir3_remove_nops(cctx->ir); - cleanup_self_movs(cctx->ir); + ir3_remove_nops(ir); + cleanup_self_movs(ir); - foreach_block (block, &cctx->ir->block_list) { + foreach_block (block, &ir->block_list) { sched_block(&ctx, block); } - if (ctx.error) - return -1; - - return 0; + return true; } -- 2.30.2