aco: Use radv_shader_args in aco_compile_shader()

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
This commit is contained in:
Connor Abbott
2019-11-11 18:27:25 +01:00
parent 680b086db1
commit b45c54ff8d
3 changed files with 13 additions and 13 deletions
+11 -10
View File
@@ -24,6 +24,7 @@
#include "aco_interface.h"
#include "aco_ir.h"
#include "vulkan/radv_shader.h"
#include "vulkan/radv_shader_args.h"
#include "c11/threads.h"
#include "util/debug.h"
@@ -56,8 +57,7 @@ static void init()
void aco_compile_shader(unsigned shader_count,
struct nir_shader *const *shaders,
struct radv_shader_binary **binary,
struct radv_shader_info *info,
struct radv_nir_compiler_options *options)
struct radv_shader_args *args)
{
call_once(&aco::init_once_flag, aco::init);
@@ -65,8 +65,9 @@ void aco_compile_shader(unsigned shader_count,
std::unique_ptr<aco::Program> program{new aco::Program};
/* Instruction Selection */
aco::select_program(program.get(), shader_count, shaders, &config, info, options);
if (options->dump_preoptir) {
aco::select_program(program.get(), shader_count, shaders, &config,
args->shader_info, args->options);
if (args->options->dump_preoptir) {
std::cerr << "After Instruction Selection:\n";
aco_print_program(program.get(), stderr);
}
@@ -88,15 +89,15 @@ void aco_compile_shader(unsigned shader_count,
aco::insert_exec_mask(program.get());
aco::validate(program.get(), stderr);
aco::live live_vars = aco::live_var_analysis(program.get(), options);
aco::spill(program.get(), live_vars, options);
aco::live live_vars = aco::live_var_analysis(program.get(), args->options);
aco::spill(program.get(), live_vars, args->options);
//std::cerr << "Before Schedule:\n";
//aco_print_program(program.get(), stderr);
aco::schedule_program(program.get(), live_vars);
std::string llvm_ir;
if (options->record_ir) {
if (args->options->record_ir) {
char *data = NULL;
size_t size = 0;
FILE *f = open_memstream(&data, &size);
@@ -112,12 +113,12 @@ void aco_compile_shader(unsigned shader_count,
/* Register Allocation */
aco::register_allocation(program.get(), live_vars.live_out);
if (options->dump_shader) {
if (args->options->dump_shader) {
std::cerr << "After RA:\n";
aco_print_program(program.get(), stderr);
}
if (aco::validate_ra(program.get(), options, stderr)) {
if (aco::validate_ra(program.get(), args->options, stderr)) {
std::cerr << "Program after RA validation failure:\n";
aco_print_program(program.get(), stderr);
abort();
@@ -140,7 +141,7 @@ void aco_compile_shader(unsigned shader_count,
std::vector<uint32_t> code;
unsigned exec_size = aco::emit_program(program.get(), code);
bool get_disasm = options->dump_shader || options->record_ir;
bool get_disasm = args->options->dump_shader || args->options->record_ir;
size_t size = llvm_ir.size();
+1 -2
View File
@@ -35,8 +35,7 @@ struct ac_shader_config;
void aco_compile_shader(unsigned shader_count,
struct nir_shader *const *shaders,
struct radv_shader_binary** binary,
struct radv_shader_info *info,
struct radv_nir_compiler_options *options);
struct radv_shader_args *args);
#ifdef __cplusplus
}
+1 -1
View File
@@ -1111,7 +1111,7 @@ shader_variant_compile(struct radv_device *device,
ac_init_llvm_once();
if (use_aco) {
aco_compile_shader(shader_count, shaders, &binary, info, options);
aco_compile_shader(shader_count, shaders, &binary, &args);
binary->info = *info;
} else {
enum ac_target_machine_options tm_options = 0;