aco: don't emit s_endpgm for tcs with epilog

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24442>
This commit is contained in:
Qiang Yu
2023-07-25 14:00:17 +08:00
committed by Marge Bot
parent b41d3e42f7
commit d3333609e6
5 changed files with 19 additions and 10 deletions
+4 -2
View File
@@ -1279,7 +1279,8 @@ align_block(asm_context& ctx, std::vector<uint32_t>& code, Block& block)
}
unsigned
emit_program(Program* program, std::vector<uint32_t>& code, std::vector<struct aco_symbol>* symbols)
emit_program(Program* program, std::vector<uint32_t>& code, std::vector<struct aco_symbol>* symbols,
bool append_endpgm)
{
asm_context ctx(program, symbols);
@@ -1298,7 +1299,8 @@ emit_program(Program* program, std::vector<uint32_t>& code, std::vector<struct a
unsigned exec_size = code.size() * sizeof(uint32_t);
/* Add end-of-code markers for the UMR disassembler. */
code.resize(code.size() + 5, 0xbf9f0000u);
if (append_endpgm)
code.resize(code.size() + 5, 0xbf9f0000u);
fix_constaddrs(ctx, code);
@@ -11518,8 +11518,11 @@ select_program(Program* program, unsigned shader_count, struct nir_shader* const
append_logical_end(ctx.block);
ctx.block->kind |= block_kind_uniform;
Builder bld(ctx.program, ctx.block);
bld.sopp(aco_opcode::s_endpgm);
if (!ctx.program->info.has_epilog) {
Builder bld(ctx.program, ctx.block);
bld.sopp(aco_opcode::s_endpgm);
}
cleanup_cfg(program);
}
+8 -4
View File
@@ -236,7 +236,11 @@ aco_compile_shader(const struct aco_compiler_options* options, const struct aco_
/* assembly */
std::vector<uint32_t> code;
std::vector<struct aco_symbol> symbols;
unsigned exec_size = aco::emit_program(program.get(), code, &symbols);
/* OpenGL combine multi shader parts into one continous code block,
* so only last part need the s_endpgm instruction.
*/
bool append_endpgm = !(options->is_opengl && info->has_epilog);
unsigned exec_size = aco::emit_program(program.get(), code, &symbols, append_endpgm);
if (program->collect_statistics)
aco::collect_postasm_stats(program.get(), code);
@@ -284,7 +288,7 @@ aco_compile_rt_prolog(const struct aco_compiler_options* options,
/* assembly */
std::vector<uint32_t> code;
code.reserve(align(program->blocks[0].instructions.size() * 2, 16));
unsigned exec_size = aco::emit_program(program.get(), code, NULL);
unsigned exec_size = aco::emit_program(program.get(), code);
bool get_disasm = options->dump_shader || options->record_ir;
@@ -322,7 +326,7 @@ aco_compile_vs_prolog(const struct aco_compiler_options* options,
/* assembly */
std::vector<uint32_t> code;
code.reserve(align(program->blocks[0].instructions.size() * 2, 16));
unsigned exec_size = aco::emit_program(program.get(), code, NULL);
unsigned exec_size = aco::emit_program(program.get(), code);
bool get_disasm = options->dump_shader || options->record_ir;
@@ -365,7 +369,7 @@ aco_compile_shader_part(const struct aco_compiler_options* options,
/* assembly */
std::vector<uint32_t> code;
unsigned exec_size = aco::emit_program(program.get(), code, NULL);
unsigned exec_size = aco::emit_program(program.get(), code);
bool get_disasm = options->dump_shader || options->record_ir;
+1 -1
View File
@@ -2262,7 +2262,7 @@ bool dealloc_vgprs(Program* program);
void insert_NOPs(Program* program);
void form_hard_clauses(Program* program);
unsigned emit_program(Program* program, std::vector<uint32_t>& code,
std::vector<struct aco_symbol>* symbols);
std::vector<struct aco_symbol>* symbols = NULL, bool append_endpgm = true);
/**
* Returns true if print_asm can disassemble the given program for the current build/runtime
* configuration
+1 -1
View File
@@ -269,7 +269,7 @@ finish_assembler_test()
{
finish_program(program.get());
std::vector<uint32_t> binary;
unsigned exec_size = emit_program(program.get(), binary, NULL);
unsigned exec_size = emit_program(program.get(), binary);
/* we could use CLRX for disassembly but that would require it to be
* installed */