mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 15:50:11 +01:00
aco: add v_nop inbetween exec write and VMEM/DS/FLAT
LLVM and the proprietary compiler seem to do this
Fixes: b01847bd9 ("aco/gfx10: Fix mitigation of VMEMtoScalarWriteHazard.")
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
This commit is contained in:
parent
54742e157d
commit
a9fc81b098
1 changed files with 8 additions and 5 deletions
|
|
@ -385,7 +385,7 @@ void insert_NOPs_gfx8_9(Program* program)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_instruction_gfx10(NOP_ctx_gfx10 &ctx, aco_ptr<Instruction>& instr,
|
void handle_instruction_gfx10(Program *program, NOP_ctx_gfx10 &ctx, aco_ptr<Instruction>& instr,
|
||||||
std::vector<aco_ptr<Instruction>>& old_instructions,
|
std::vector<aco_ptr<Instruction>>& old_instructions,
|
||||||
std::vector<aco_ptr<Instruction>>& new_instructions)
|
std::vector<aco_ptr<Instruction>>& new_instructions)
|
||||||
{
|
{
|
||||||
|
|
@ -396,6 +396,9 @@ void handle_instruction_gfx10(NOP_ctx_gfx10 &ctx, aco_ptr<Instruction>& instr,
|
||||||
instr->format == Format::SCRATCH || instr->format == Format::DS) {
|
instr->format == Format::SCRATCH || instr->format == Format::DS) {
|
||||||
/* Remember all SGPRs that are read by the VMEM instruction */
|
/* Remember all SGPRs that are read by the VMEM instruction */
|
||||||
mark_read_regs(instr, ctx.sgprs_read_by_VMEM);
|
mark_read_regs(instr, ctx.sgprs_read_by_VMEM);
|
||||||
|
ctx.sgprs_read_by_VMEM.set(exec);
|
||||||
|
if (program->wave_size == 64)
|
||||||
|
ctx.sgprs_read_by_VMEM.set(exec_hi);
|
||||||
} else if (instr->isSALU() || instr->format == Format::SMEM) {
|
} else if (instr->isSALU() || instr->format == Format::SMEM) {
|
||||||
/* Check if SALU writes an SGPR that was previously read by the VALU */
|
/* Check if SALU writes an SGPR that was previously read by the VALU */
|
||||||
if (check_written_regs(instr, ctx.sgprs_read_by_VMEM)) {
|
if (check_written_regs(instr, ctx.sgprs_read_by_VMEM)) {
|
||||||
|
|
@ -528,7 +531,7 @@ void handle_instruction_gfx10(NOP_ctx_gfx10 &ctx, aco_ptr<Instruction>& instr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_block_gfx10(NOP_ctx_gfx10& ctx, Block& block)
|
void handle_block_gfx10(Program *program, NOP_ctx_gfx10& ctx, Block& block)
|
||||||
{
|
{
|
||||||
if (block.instructions.empty())
|
if (block.instructions.empty())
|
||||||
return;
|
return;
|
||||||
|
|
@ -537,7 +540,7 @@ void handle_block_gfx10(NOP_ctx_gfx10& ctx, Block& block)
|
||||||
instructions.reserve(block.instructions.size());
|
instructions.reserve(block.instructions.size());
|
||||||
|
|
||||||
for (aco_ptr<Instruction>& instr : block.instructions) {
|
for (aco_ptr<Instruction>& instr : block.instructions) {
|
||||||
handle_instruction_gfx10(ctx, instr, block.instructions, instructions);
|
handle_instruction_gfx10(program, ctx, instr, block.instructions, instructions);
|
||||||
instructions.emplace_back(std::move(instr));
|
instructions.emplace_back(std::move(instr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -562,7 +565,7 @@ void mitigate_hazards_gfx10(Program *program)
|
||||||
for (unsigned b : program->blocks[idx].linear_preds)
|
for (unsigned b : program->blocks[idx].linear_preds)
|
||||||
loop_block_ctx.join(all_ctx[b]);
|
loop_block_ctx.join(all_ctx[b]);
|
||||||
|
|
||||||
handle_block_gfx10(loop_block_ctx, program->blocks[idx]);
|
handle_block_gfx10(program, loop_block_ctx, program->blocks[idx]);
|
||||||
|
|
||||||
/* We only need to continue if the loop header context changed */
|
/* We only need to continue if the loop header context changed */
|
||||||
if (idx == loop_header_indices.top() && loop_block_ctx == all_ctx[idx])
|
if (idx == loop_header_indices.top() && loop_block_ctx == all_ctx[idx])
|
||||||
|
|
@ -577,7 +580,7 @@ void mitigate_hazards_gfx10(Program *program)
|
||||||
for (unsigned b : block.linear_preds)
|
for (unsigned b : block.linear_preds)
|
||||||
ctx.join(all_ctx[b]);
|
ctx.join(all_ctx[b]);
|
||||||
|
|
||||||
handle_block_gfx10(ctx, block);
|
handle_block_gfx10(program, ctx, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue