freedreno/ir3: Move NIR printing to mesa_log.

Now we can get some NIR debug on Android.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9262>
This commit is contained in:
Emma Anholt 2021-06-16 09:52:04 -07:00 committed by Marge Bot
parent 990c232603
commit caa5c5b12e
4 changed files with 28 additions and 28 deletions

View File

@ -151,9 +151,9 @@ ir3_context_init(struct ir3_compiler *compiler,
} }
if (shader_debug_enabled(so->type)) { if (shader_debug_enabled(so->type)) {
fprintf(stdout, "NIR (final form) for %s shader %s:\n", mesa_logi("NIR (final form) for %s shader %s:",
ir3_shader_stage(so), so->shader->nir->info.name); ir3_shader_stage(so), so->shader->nir->info.name);
nir_print_shader(ctx->s, stdout); nir_log_shaderi(ctx->s);
} }
ir3_ibo_mapping_init(&so->image_mapping, ctx->s->info.num_textures); ir3_ibo_mapping_init(&so->image_mapping, ctx->s->info.num_textures);
@ -403,10 +403,10 @@ ir3_context_error(struct ir3_context *ctx, const char *format, ...)
char *msg = ralloc_vasprintf(errors, format, ap); char *msg = ralloc_vasprintf(errors, format, ap);
_mesa_hash_table_insert(errors, ctx->cur_instr, msg); _mesa_hash_table_insert(errors, ctx->cur_instr, msg);
} else { } else {
_debug_vprintf(format, ap); mesa_loge_v(format, ap);
} }
va_end(ap); va_end(ap);
nir_print_shader_annotated(ctx->s, stdout, errors); nir_log_shader_annotated(ctx->s, errors);
ralloc_free(errors); ralloc_free(errors);
ctx->error = true; ctx->error = true;
unreachable(""); unreachable("");

View File

@ -337,9 +337,9 @@ ir3_finalize_nir(struct ir3_compiler *compiler, nir_shader *s)
} }
if (ir3_shader_debug & IR3_DBG_DISASM) { if (ir3_shader_debug & IR3_DBG_DISASM) {
debug_printf("----------------------\n"); mesa_logi("----------------------");
nir_print_shader(s, stdout); nir_log_shaderi(s);
debug_printf("----------------------\n"); mesa_logi("----------------------");
} }
if (s->info.stage == MESA_SHADER_GEOMETRY) if (s->info.stage == MESA_SHADER_GEOMETRY)
@ -372,9 +372,9 @@ ir3_finalize_nir(struct ir3_compiler *compiler, nir_shader *s)
OPT_V(s, nir_remove_dead_variables, nir_var_function_temp, NULL); OPT_V(s, nir_remove_dead_variables, nir_var_function_temp, NULL);
if (ir3_shader_debug & IR3_DBG_DISASM) { if (ir3_shader_debug & IR3_DBG_DISASM) {
debug_printf("----------------------\n"); mesa_logi("----------------------");
nir_print_shader(s, stdout); nir_log_shaderi(s);
debug_printf("----------------------\n"); mesa_logi("----------------------");
} }
/* st_program.c's parameter list optimization requires that future nir /* st_program.c's parameter list optimization requires that future nir
@ -488,9 +488,9 @@ void
ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s) ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s)
{ {
if (ir3_shader_debug & IR3_DBG_DISASM) { if (ir3_shader_debug & IR3_DBG_DISASM) {
debug_printf("----------------------\n"); mesa_logi("----------------------");
nir_print_shader(s, stdout); nir_log_shaderi(s);
debug_printf("----------------------\n"); mesa_logi("----------------------");
} }
bool progress = false; bool progress = false;
@ -602,9 +602,9 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s)
OPT_V(s, nir_opt_sink, nir_move_const_undef); OPT_V(s, nir_opt_sink, nir_move_const_undef);
if (ir3_shader_debug & IR3_DBG_DISASM) { if (ir3_shader_debug & IR3_DBG_DISASM) {
debug_printf("----------------------\n"); mesa_logi("----------------------");
nir_print_shader(s, stdout); nir_log_shaderi(s);
debug_printf("----------------------\n"); mesa_logi("----------------------");
} }
nir_sweep(s); nir_sweep(s);

View File

@ -637,9 +637,9 @@ ir3_nir_lower_tess_ctrl(nir_shader *shader, struct ir3_shader_variant *v,
struct state state = { .topology = topology }; struct state state = { .topology = topology };
if (shader_debug_enabled(shader->info.stage)) { if (shader_debug_enabled(shader->info.stage)) {
fprintf(stderr, "NIR (before tess lowering) for %s shader:\n", mesa_logi("NIR (before tess lowering) for %s shader:",
_mesa_shader_stage_to_string(shader->info.stage)); _mesa_shader_stage_to_string(shader->info.stage));
nir_print_shader(shader, stderr); nir_log_shaderi(shader);
} }
build_primitive_map(shader, &state.map); build_primitive_map(shader, &state.map);
@ -784,9 +784,9 @@ ir3_nir_lower_tess_eval(nir_shader *shader, struct ir3_shader_variant *v, unsign
struct state state = { .topology = topology }; struct state state = { .topology = topology };
if (shader_debug_enabled(shader->info.stage)) { if (shader_debug_enabled(shader->info.stage)) {
fprintf(stderr, "NIR (before tess lowering) for %s shader:\n", mesa_logi("NIR (before tess lowering) for %s shader:",
_mesa_shader_stage_to_string(shader->info.stage)); _mesa_shader_stage_to_string(shader->info.stage));
nir_print_shader(shader, stderr); nir_log_shaderi(shader);
} }
nir_function_impl *impl = nir_shader_get_entrypoint(shader); nir_function_impl *impl = nir_shader_get_entrypoint(shader);
@ -871,8 +871,8 @@ ir3_nir_lower_gs(nir_shader *shader)
struct state state = { }; struct state state = { };
if (shader_debug_enabled(shader->info.stage)) { if (shader_debug_enabled(shader->info.stage)) {
fprintf(stderr, "NIR (before gs lowering):\n"); mesa_logi("NIR (before gs lowering):");
nir_print_shader(shader, stderr); nir_log_shaderi(shader);
} }
/* Create an output var for vertex_flags. This will be shadowed below, /* Create an output var for vertex_flags. This will be shadowed below,
@ -973,8 +973,8 @@ ir3_nir_lower_gs(nir_shader *shader)
nir_fixup_deref_modes(shader); nir_fixup_deref_modes(shader);
if (shader_debug_enabled(shader->info.stage)) { if (shader_debug_enabled(shader->info.stage)) {
fprintf(stderr, "NIR (after gs lowering):\n"); mesa_logi("NIR (after gs lowering):");
nir_print_shader(shader, stderr); nir_log_shaderi(shader);
} }
} }

View File

@ -368,8 +368,8 @@ create_variant(struct ir3_shader *shader, const struct ir3_shader_key *key,
ir3_nir_post_finalize(shader->compiler, shader->nir); ir3_nir_post_finalize(shader->compiler, shader->nir);
if (ir3_shader_debug & IR3_DBG_DISASM) { if (ir3_shader_debug & IR3_DBG_DISASM) {
printf("dump nir%d: type=%d", shader->id, shader->type); mesa_logi("dump nir%d: type=%d", shader->id, shader->type);
nir_print_shader(shader->nir, stdout); nir_log_shaderi(shader->nir);
} }
if (v->disasm_info.write_disasm) { if (v->disasm_info.write_disasm) {