agx: Add validation pass

For now, just check that we didn't botch the structure of the block,
since this just bit me.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16268>
This commit is contained in:
Alyssa Rosenzweig
2022-04-18 21:32:50 -04:00
parent 4498799822
commit 6b22bbab36
4 changed files with 127 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ static const struct debug_named_value agx_debug_options[] = {
{"shaderdb", AGX_DBG_SHADERDB, "Print statistics"},
{"verbose", AGX_DBG_VERBOSE, "Disassemble verbosely"},
{"internal", AGX_DBG_INTERNAL, "Dump even internal shaders"},
{"novalidate",AGX_DBG_NOVALIDATE,"Skip IR validation in debug builds"},
DEBUG_NAMED_VALUE_END
};
@@ -1790,11 +1791,14 @@ agx_compile_shader_nir(nir_shader *nir,
agx_foreach_block(ctx, block)
block->index = ctx->num_blocks++;
agx_validate(ctx, "IR translation");
if (agx_debug & AGX_DBG_SHADERS && !skip_internal)
agx_print_shader(ctx, stdout);
agx_optimizer(ctx);
agx_dce(ctx);
agx_validate(ctx, "Optimization");
if (agx_debug & AGX_DBG_SHADERS && !skip_internal)
agx_print_shader(ctx, stdout);