From 1c8167da612e8710aae8ea797b6bc0f22eac7f6a Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 17 Jul 2020 12:49:59 +0200 Subject: [PATCH] v3d: Changed v3d_compile:failed to an enum MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Instead of just having a bool status for the failure, there is now an enum so that the compilation can report a more detailed status. Currently this is only used to report whether the failure was due to failed register allocation. The “failed” bool doesn’t seem to actually have been used anywhere so this doesn’t really change a lot. Reviewed-by: Iago Toral Quiroga Reviewed-by: Alejandro Piñeiro Part-of: --- src/broadcom/compiler/nir_to_vir.c | 3 ++- src/broadcom/compiler/v3d_compiler.h | 8 +++++++- src/broadcom/compiler/vir.c | 1 + src/broadcom/compiler/vir_to_qpu.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index 671f3dbd2ab..8d805a97ea0 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -3018,7 +3018,8 @@ v3d_nir_to_vir(struct v3d_compile *c) fprintf(stderr, "Failed to register allocate at %d threads:\n", c->threads); vir_dump(c); - c->failed = true; + c->compilation_result = + V3D_COMPILATION_FAILED_REGISTER_ALLOCATION; return; } diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h index 10df1af3ce4..624af49c866 100644 --- a/src/broadcom/compiler/v3d_compiler.h +++ b/src/broadcom/compiler/v3d_compiler.h @@ -489,6 +489,12 @@ vir_after_block(struct qblock *block) return (struct vir_cursor){ vir_cursor_addtail, &block->instructions }; } +enum v3d_compilation_result { + V3D_COMPILATION_SUCCEEDED, + V3D_COMPILATION_FAILED_REGISTER_ALLOCATION, + V3D_COMPILATION_FAILED, +}; + /** * Compiler state saved across compiler invocations, for any expensive global * setup. @@ -666,7 +672,7 @@ struct v3d_compile { bool emitted_tlb_load; bool lock_scoreboard_on_first_thrsw; - bool failed; + enum v3d_compilation_result compilation_result; bool tmu_dirty_rcl; }; diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index fceaafb9e03..a118d2d4c88 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -512,6 +512,7 @@ vir_compile_init(const struct v3d_compiler *compiler, c->threads = 4; c->debug_output = debug_output; c->debug_output_data = debug_output_data; + c->compilation_result = V3D_COMPILATION_SUCCEEDED; s = nir_shader_clone(c, s); c->s = s; diff --git a/src/broadcom/compiler/vir_to_qpu.c b/src/broadcom/compiler/vir_to_qpu.c index e6461ff94bb..2d72f2f744d 100644 --- a/src/broadcom/compiler/vir_to_qpu.c +++ b/src/broadcom/compiler/vir_to_qpu.c @@ -417,7 +417,7 @@ v3d_vir_to_qpu(struct v3d_compile *c, struct qpu_reg *temp_registers) fprintf(stderr, "Failed to pack instruction:\n"); vir_dump_inst(c, inst); fprintf(stderr, "\n"); - c->failed = true; + c->compilation_result = V3D_COMPILATION_FAILED; return; } } -- 2.30.2