aco: move s_setprio to before NGG exec initialization

fossil-db (gfx1150):
Totals from 32 (0.04% of 79395) affected shaders:
Instrs: 17397 -> 17365 (-0.18%)
CodeSize: 83700 -> 83580 (-0.14%)
Latency: 59006 -> 58974 (-0.05%)

fossil-db (navi21):
Totals from 4 (0.01% of 79395) affected shaders:

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30241>
This commit is contained in:
Rhys Perry 2024-07-19 13:23:29 +01:00 committed by Marge Bot
parent 4574cd9fae
commit cccfbe6141
2 changed files with 9 additions and 7 deletions

View file

@ -166,8 +166,9 @@ add_coupling_code(exec_ctx& ctx, Block* block, std::vector<aco_ptr<Instruction>>
bld.insert(std::move(startpgm));
unsigned count = 1;
if (block->instructions[1]->opcode == aco_opcode::p_init_scratch) {
bld.insert(std::move(block->instructions[1]));
while (block->instructions[count]->opcode == aco_opcode::p_init_scratch ||
block->instructions[count]->opcode == aco_opcode::s_setprio) {
bld.insert(std::move(block->instructions[count]));
count++;
}

View file

@ -11866,6 +11866,12 @@ select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, cons
if (need_startpgm) {
/* Needs to be after init_context() for FS. */
Instruction* startpgm = add_startpgm(&ctx);
if (!program->info.vs.has_prolog &&
(program->stage.has(SWStage::VS) || program->stage.has(SWStage::TES))) {
Builder(ctx.program, ctx.block).sopp(aco_opcode::s_setprio, 0x3u);
}
append_logical_start(ctx.block);
if (ctx.options->has_ls_vgpr_init_bug && ctx.stage == vertex_tess_control_hs &&
@ -11873,11 +11879,6 @@ select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, cons
fix_ls_vgpr_init_bug(&ctx);
split_arguments(&ctx, startpgm);
if (!program->info.vs.has_prolog &&
(program->stage.has(SWStage::VS) || program->stage.has(SWStage::TES))) {
Builder(ctx.program, ctx.block).sopp(aco_opcode::s_setprio, 0x3u);
}
}
if (program->gfx_level == GFX10 && program->stage.hw == AC_HW_NEXT_GEN_GEOMETRY_SHADER &&