aco: reset prefetch in the correct block after removing the exit

fossil-db (navi31):
Totals from 279 (0.35% of 79332) affected shaders:
(no stat changes)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: c778803d67 ("aco/assembler: change prefetch mode on GFX10.3+ during loops if beneficial")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25312>
(cherry picked from commit 21db2e7017)
This commit is contained in:
Rhys Perry 2023-09-20 19:27:39 +01:00 committed by Dylan Baker
parent 94d14d477f
commit 265a822e9d
2 changed files with 7 additions and 3 deletions

View file

@ -14,7 +14,7 @@
"description": "aco: reset prefetch in the correct block after removing the exit",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "c778803d673f8db16df5951637258405b2d7e0a6",
"notes": null

View file

@ -48,7 +48,7 @@ struct asm_context {
std::map<unsigned, constaddr_info> constaddrs;
std::map<unsigned, constaddr_info> resumeaddrs;
std::vector<struct aco_symbol>* symbols;
Block* loop_header;
Block* loop_header = NULL;
const int16_t* opcode;
// TODO: keep track of branch instructions referring blocks
// and, when emitting the block, correct the offset in instr
@ -1221,7 +1221,11 @@ fix_constaddrs(asm_context& ctx, std::vector<uint32_t>& out)
void
align_block(asm_context& ctx, std::vector<uint32_t>& code, Block& block)
{
if (block.kind & block_kind_loop_exit && ctx.loop_header) {
/* Blocks with block_kind_loop_exit might be eliminated after jump threading, so we instead find
* loop exits using loop_nest_depth.
*/
if (ctx.loop_header && !block.linear_preds.empty() &&
block.loop_nest_depth < ctx.loop_header->loop_nest_depth) {
Block* loop_header = ctx.loop_header;
ctx.loop_header = NULL;
std::vector<uint32_t> nops;