aco: store if pseudo instr needs scratch reg

Cc: mesa-stable
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27855>
(cherry picked from commit 1eb067ee9f)
This commit is contained in:
Georg Lehmann 2024-02-28 17:41:31 +01:00 committed by Eric Engestrom
parent 79fd6ae01b
commit 1885c9f4a9
4 changed files with 5 additions and 2 deletions

View File

@ -974,7 +974,7 @@
"description": "aco: store if pseudo instr needs scratch reg",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@ -1613,7 +1613,7 @@ static_assert(sizeof(Export_instruction) == sizeof(Instruction) + 4, "Unexpected
struct Pseudo_instruction : public Instruction {
PhysReg scratch_sgpr; /* might not be valid if it's not needed */
bool tmp_in_scc;
uint8_t padding;
bool needs_scratch_reg; /* if scratch_sgpr/scc can be written, initialized by RA. */
};
static_assert(sizeof(Pseudo_instruction) == sizeof(Instruction) + 4, "Unexpected padding");

View File

@ -1913,6 +1913,7 @@ handle_pseudo(ra_ctx& ctx, const RegisterFile& reg_file, Instruction* instr)
if (!needs_scratch_reg)
return;
instr->pseudo().needs_scratch_reg = true;
instr->pseudo().tmp_in_scc = reg_file[scc];
int reg = ctx.max_used_sgpr;
@ -3067,6 +3068,7 @@ register_allocation(Program* program, std::vector<IDSet>& live_out_per_block, ra
handle_pseudo(ctx, tmp_file, pc.get());
} else {
pc->needs_scratch_reg = sgpr_operands_alias_defs || linear_vgpr;
pc->tmp_in_scc = false;
}

View File

@ -133,6 +133,7 @@ insert_parallelcopies(ssa_elimination_ctx& ctx)
}
pc->tmp_in_scc = block.scc_live_out;
pc->scratch_sgpr = scratch_sgpr;
pc->needs_scratch_reg = true;
block.instructions.insert(it, std::move(pc));
}
}