agx: split up optimizer

validate in the middle

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31532>
This commit is contained in:
Alyssa Rosenzweig
2024-09-22 21:58:03 -04:00
committed by Marge Bot
parent 5abdce5af5
commit 3d48658fe3
4 changed files with 8 additions and 12 deletions
+2 -1
View File
@@ -3417,7 +3417,8 @@ agx_compile_function_nir(nir_shader *nir, nir_function_impl *impl,
AGX_PASS(ctx, agx_opt_cse);
/* After DCE, use counts are right so we can run the optimizer. */
AGX_PASS(ctx, agx_optimizer);
AGX_PASS(ctx, agx_optimizer_backward);
AGX_PASS(ctx, agx_optimizer_forward);
AGX_PASS(ctx, agx_opt_compact_constants);
/* After inlining constants, promote what's left */
+2 -1
View File
@@ -970,7 +970,8 @@ void agx_print_index(agx_index index, bool is_float, FILE *fp);
void agx_print_instr(const agx_instr *I, FILE *fp);
void agx_print_block(const agx_block *block, FILE *fp);
void agx_print_shader(const agx_context *ctx, FILE *fp);
void agx_optimizer(agx_context *ctx);
void agx_optimizer_forward(agx_context *ctx);
void agx_optimizer_backward(agx_context *ctx);
void agx_lower_divergent_shuffle(agx_context *ctx);
void agx_lower_pseudo(agx_context *ctx);
void agx_lower_spill(agx_context *ctx);
+2 -9
View File
@@ -453,7 +453,7 @@ agx_optimizer_bitop(agx_instr **defs, agx_instr *I)
}
}
static void
void
agx_optimizer_forward(agx_context *ctx)
{
agx_instr **defs = calloc(ctx->alloc, sizeof(*defs));
@@ -496,7 +496,7 @@ agx_optimizer_forward(agx_context *ctx)
free(defs);
}
static void
void
agx_optimizer_backward(agx_context *ctx)
{
agx_instr **uses = calloc(ctx->alloc, sizeof(*uses));
@@ -542,10 +542,3 @@ agx_optimizer_backward(agx_context *ctx)
free(uses);
free(multiple);
}
void
agx_optimizer(agx_context *ctx)
{
agx_optimizer_backward(ctx);
agx_optimizer_forward(ctx);
}
+2 -1
View File
@@ -12,7 +12,8 @@
static void
agx_optimize_and_dce(agx_context *ctx)
{
agx_optimizer(ctx);
agx_optimizer_backward(ctx);
agx_optimizer_forward(ctx);
agx_dce(ctx, true);
}