aco: use s_delay_alu skip field
fossil-db (gfx1100): Totals from 130066 (96.65% of 134574) affected shaders: Instrs: 80208817 -> 71420648 (-10.96%) CodeSize: 403523036 -> 368370360 (-8.71%) Latency: 658064779 -> 657935384 (-0.02%); split: -0.02%, +0.00% InvThroughput: 87698268 -> 87693326 (-0.01%); split: -0.01%, +0.00% Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20512>
This commit is contained in:
@@ -1097,6 +1097,33 @@ insert_wait_states(Program* program)
|
||||
|
||||
out_ctx[current.index] = std::move(ctx);
|
||||
}
|
||||
|
||||
/* Combine s_delay_alu using the skip field. */
|
||||
if (program->gfx_level >= GFX11) {
|
||||
for (Block& block : program->blocks) {
|
||||
int i = 0;
|
||||
int prev_delay_alu = -1;
|
||||
for (aco_ptr<Instruction>& instr : block.instructions) {
|
||||
if (instr->opcode != aco_opcode::s_delay_alu) {
|
||||
block.instructions[i++] = std::move(instr);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint16_t imm = instr->sopp().imm;
|
||||
int skip = i - prev_delay_alu - 1;
|
||||
if (imm >> 7 || prev_delay_alu < 0 || skip >= 6) {
|
||||
if (imm >> 7 == 0)
|
||||
prev_delay_alu = i;
|
||||
block.instructions[i++] = std::move(instr);
|
||||
continue;
|
||||
}
|
||||
|
||||
block.instructions[prev_delay_alu]->sopp().imm |= (skip << 4) | (imm << 7);
|
||||
prev_delay_alu = -1;
|
||||
}
|
||||
block.instructions.resize(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace aco
|
||||
|
Reference in New Issue
Block a user