aco: Add isTrans helper.

For the s_delay_alu tracking.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19743>
This commit is contained in:
Bas Nieuwenhuizen 2022-11-14 18:57:08 +00:00 committed by Marge Bot
parent bdb7fd69d6
commit 352e492c7b
3 changed files with 11 additions and 6 deletions

View file

@ -1052,9 +1052,7 @@ handle_lds_direct_valu_hazard_instr(LdsDirectVALUHazardGlobalState& global_state
aco_ptr<Instruction>& instr)
{
if (instr->isVALU() || instr->isVINTERP_INREG()) {
instr_class cls = instr_info.classes[(int)instr->opcode];
block_state.has_trans |= cls == instr_class::valu_transcendental32 ||
cls == instr_class::valu_double_transcendental;
block_state.has_trans |= instr->isTrans();
bool uses_vgpr = false;
for (Definition& def : instr->definitions)
@ -1340,9 +1338,7 @@ handle_instruction_gfx11(State& state, NOP_ctx_gfx11& ctx, aco_ptr<Instruction>&
ctx.sgpr_read_by_valu_as_lanemask_then_wr_by_salu.reset();
if (instr->isVALU() || instr->isVINTERP_INREG()) {
instr_class cls = instr_info.classes[(int)instr->opcode];
bool is_trans = cls == instr_class::valu_transcendental32 ||
cls == instr_class::valu_double_transcendental;
bool is_trans = instr->isTrans();
ctx.valu_since_wr_by_trans.inc();
if (is_trans)

View file

@ -981,4 +981,11 @@ dealloc_vgprs(Program* program)
return true;
}
bool
Instruction::isTrans() const noexcept
{
return instr_info.classes[(int)opcode] == instr_class::valu_transcendental32 ||
instr_info.classes[(int)opcode] == instr_class::valu_double_transcendental;
}
} // namespace aco

View file

@ -1381,6 +1381,8 @@ struct Instruction {
}
constexpr bool isVMEM() const noexcept { return isMTBUF() || isMUBUF() || isMIMG(); }
bool isTrans() const noexcept;
};
static_assert(sizeof(Instruction) == 16, "Unexpected padding");