aco: Add isTrans helper.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 14 Nov 2022 18:57:08 +0000 (18:57 +0000)
committerMarge Bot <emma+marge@anholt.net>
Wed, 7 Dec 2022 22:05:25 +0000 (22:05 +0000)
For the s_delay_alu tracking.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19743>

src/amd/compiler/aco_insert_NOPs.cpp
src/amd/compiler/aco_ir.cpp
src/amd/compiler/aco_ir.h

index 2269324..8cf4281 100644 (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)
index db283ea..dff36a7 100644 (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
index 0b08ccf..f87f90d 100644 (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");