From a0814a873d50f65484b17927379fbb47cf90372e Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 21 Aug 2020 11:33:22 +0200 Subject: [PATCH] aco: skip unnecessary compiler pass for the trap handler program MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The shader is written by hands with assigned registers, so most of the pass are unnecessary. Signed-off-by: Samuel Pitoiset Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_interface.cpp | 71 ++++++++++++++++-------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/src/amd/compiler/aco_interface.cpp b/src/amd/compiler/aco_interface.cpp index 96a968d376a..5d402495ae5 100644 --- a/src/amd/compiler/aco_interface.cpp +++ b/src/amd/compiler/aco_interface.cpp @@ -79,23 +79,26 @@ void aco_compile_shader(unsigned shader_count, aco_print_program(program.get(), stderr); } - /* Phi lowering */ - aco::lower_phis(program.get()); - aco::dominator_tree(program.get()); - validate(program.get()); - - /* Optimization */ - aco::value_numbering(program.get()); - aco::optimize(program.get()); - - /* cleanup and exec mask handling */ - aco::setup_reduce_temp(program.get()); - aco::insert_exec_mask(program.get()); - 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); + aco::live live_vars; + if (!args->is_trap_handler_shader) { + /* Phi lowering */ + aco::lower_phis(program.get()); + aco::dominator_tree(program.get()); + validate(program.get()); + + /* Optimization */ + aco::value_numbering(program.get()); + aco::optimize(program.get()); + + /* cleanup and exec mask handling */ + aco::setup_reduce_temp(program.get()); + aco::insert_exec_mask(program.get()); + validate(program.get()); + + /* spilling and scheduling */ + live_vars = aco::live_var_analysis(program.get(), args->options); + aco::spill(program.get(), live_vars, args->options); + } std::string llvm_ir; if (args->options->record_ir) { @@ -114,26 +117,30 @@ void aco_compile_shader(unsigned shader_count, 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) { - std::cerr << "After RA:\n"; - aco_print_program(program.get(), stderr); - } + if (!args->is_trap_handler_shader) { + aco::schedule_program(program.get(), live_vars); + validate(program.get()); - if (aco::validate_ra(program.get(), args->options)) { - std::cerr << "Program after RA validation failure:\n"; - aco_print_program(program.get(), stderr); - abort(); - } + /* Register Allocation */ + aco::register_allocation(program.get(), live_vars.live_out); + if (args->options->dump_shader) { + std::cerr << "After RA:\n"; + aco_print_program(program.get(), stderr); + } + + if (aco::validate_ra(program.get(), args->options)) { + std::cerr << "Program after RA validation failure:\n"; + aco_print_program(program.get(), stderr); + abort(); + } + + validate(program.get()); - validate(program.get()); + aco::ssa_elimination(program.get()); + } /* Lower to HW Instructions */ - aco::ssa_elimination(program.get()); aco::lower_to_hw_instr(program.get()); /* Insert Waitcnt */ -- 2.30.2