v3d: Changed v3d_compile:failed to an enum
authorNeil Roberts <nroberts@igalia.com>
Fri, 17 Jul 2020 10:49:59 +0000 (12:49 +0200)
committerNeil Roberts <nroberts@igalia.com>
Fri, 24 Jul 2020 10:27:07 +0000 (12:27 +0200)
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 <itoral@igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5953>

src/broadcom/compiler/nir_to_vir.c
src/broadcom/compiler/v3d_compiler.h
src/broadcom/compiler/vir.c
src/broadcom/compiler/vir_to_qpu.c

index 671f3dbd2abaed0e9e065d047f836670dde3b408..8d805a97ea019ef0cae4fcede546388611449d7e 100644 (file)
@@ -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);
                         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;
                 }
 
                         return;
                 }
 
index 10df1af3ce4a624b65e85a502f03aed62a833f48..624af49c86618ebb810b0ee02def3a8c87192c38 100644 (file)
@@ -489,6 +489,12 @@ vir_after_block(struct qblock *block)
         return (struct vir_cursor){ vir_cursor_addtail, &block->instructions };
 }
 
         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.
 /**
  * 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 emitted_tlb_load;
         bool lock_scoreboard_on_first_thrsw;
 
-        bool failed;
+        enum v3d_compilation_result compilation_result;
 
         bool tmu_dirty_rcl;
 };
 
         bool tmu_dirty_rcl;
 };
index fceaafb9e03b8f29c148baedbd2ff4f7272c40e8..a118d2d4c8841e5eddd876281f17dc8f9f27da3c 100644 (file)
@@ -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->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;
 
         s = nir_shader_clone(c, s);
         c->s = s;
index e6461ff94bb254f66bcaaa90f9c37398851439f6..2d72f2f744d494a0933ba03aa51bd29b0edd5fb1 100644 (file)
@@ -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");
                         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;
                 }
         }
                         return;
                 }
         }