projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
aco: rework the way various compilation/validation errors are reported
[mesa.git]
/
src
/
amd
/
compiler
/
aco_interface.cpp
diff --git
a/src/amd/compiler/aco_interface.cpp
b/src/amd/compiler/aco_interface.cpp
index 95e2bd1ac1aaf0e189fe8e23184106e39dab536f..4dfba2618ccb2d3c52a034426dc8b6b9298f4a33 100644
(file)
--- a/
src/amd/compiler/aco_interface.cpp
+++ b/
src/amd/compiler/aco_interface.cpp
@@
-25,8
+25,6
@@
#include "aco_ir.h"
#include "vulkan/radv_shader.h"
#include "vulkan/radv_shader_args.h"
#include "aco_ir.h"
#include "vulkan/radv_shader.h"
#include "vulkan/radv_shader_args.h"
-#include "c11/threads.h"
-#include "util/debug.h"
#include <iostream>
#include <sstream>
#include <iostream>
#include <sstream>
@@
-45,6
+43,15
@@
static radv_compiler_statistic_info statistic_infos[] = {
[aco::statistic_vgpr_presched] = {"Pre-Sched VGPRs", "VGPR usage before scheduling"},
};
[aco::statistic_vgpr_presched] = {"Pre-Sched VGPRs", "VGPR usage before scheduling"},
};
+static void validate(aco::Program *program)
+{
+ if (!(aco::debug_flags & aco::DEBUG_VALIDATE_IR))
+ return;
+
+ bool is_valid = aco::validate_ir(program);
+ assert(is_valid);
+}
+
void aco_compile_shader(unsigned shader_count,
struct nir_shader *const *shaders,
struct radv_shader_binary **binary,
void aco_compile_shader(unsigned shader_count,
struct nir_shader *const *shaders,
struct radv_shader_binary **binary,
@@
-72,7
+79,7
@@
void aco_compile_shader(unsigned shader_count,
/* Phi lowering */
aco::lower_phis(program.get());
aco::dominator_tree(program.get());
/* Phi lowering */
aco::lower_phis(program.get());
aco::dominator_tree(program.get());
-
aco::validate(program.get(), stderr
);
+
validate(program.get()
);
/* Optimization */
aco::value_numbering(program.get());
/* Optimization */
aco::value_numbering(program.get());
@@
-81,15
+88,11
@@
void aco_compile_shader(unsigned shader_count,
/* cleanup and exec mask handling */
aco::setup_reduce_temp(program.get());
aco::insert_exec_mask(program.get());
/* cleanup and exec mask handling */
aco::setup_reduce_temp(program.get());
aco::insert_exec_mask(program.get());
-
aco::validate(program.get(), stderr
);
+
validate(program.get()
);
/* spilling and scheduling */
aco::live live_vars = aco::live_var_analysis(program.get(), args->options);
aco::spill(program.get(), live_vars, args->options);
/* spilling and scheduling */
aco::live live_vars = aco::live_var_analysis(program.get(), args->options);
aco::spill(program.get(), live_vars, args->options);
- if (program->collect_statistics)
- aco::collect_presched_stats(program.get());
- aco::schedule_program(program.get(), live_vars);
- aco::validate(program.get(), stderr);
std::string llvm_ir;
if (args->options->record_ir) {
std::string llvm_ir;
if (args->options->record_ir) {
@@
-106,6
+109,11
@@
void aco_compile_shader(unsigned shader_count,
free(data);
}
free(data);
}
+ if (program->collect_statistics)
+ aco::collect_presched_stats(program.get());
+ aco::schedule_program(program.get(), live_vars);
+ validate(program.get());
+
/* Register Allocation */
aco::register_allocation(program.get(), live_vars.live_out);
if (args->options->dump_shader) {
/* Register Allocation */
aco::register_allocation(program.get(), live_vars.live_out);
if (args->options->dump_shader) {
@@
-113,13
+121,13
@@
void aco_compile_shader(unsigned shader_count,
aco_print_program(program.get(), stderr);
}
aco_print_program(program.get(), stderr);
}
- if (aco::validate_ra(program.get(), args->options
, stderr
)) {
+ if (aco::validate_ra(program.get(), args->options)) {
std::cerr << "Program after RA validation failure:\n";
aco_print_program(program.get(), stderr);
abort();
}
std::cerr << "Program after RA validation failure:\n";
aco_print_program(program.get(), stderr);
abort();
}
-
aco::validate(program.get(), stderr
);
+
validate(program.get()
);
/* Lower to HW Instructions */
aco::ssa_elimination(program.get());
/* Lower to HW Instructions */
aco::ssa_elimination(program.get());