LLVM 24.0.0git
GCNPreRAAntiHints.h
Go to the documentation of this file.
1//===- GCNPreRAAntiHints.h --------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_TARGET_AMDGPU_GCNPRERAANTIHINTS_H
10#define LLVM_LIB_TARGET_AMDGPU_GCNPRERAANTIHINTS_H
11
13
14namespace llvm {
15
16class MachineFunction;
17class MachineInstr;
19class LiveIntervals;
20class SIRegisterInfo;
21class SIInstrInfo;
22class GCNSubtarget;
24
25namespace AMDGPU {
26
28namespace HazardClass {
29
30// Coherent with CoExec instruction types
31enum : HazardClassMask {
32 None = 0,
33 CTRL = 1u << 0,
34 VALU = 1u << 1,
35 TRANS = 1u << 2,
36 SALU = 1u << 3,
37 DS = 1u << 4,
38 VMEM = 1u << 5,
39 SMEM = 1u << 6,
40 WMMA = 1u << 7,
41 MFMA = 1u << 8,
42 EXP = 1u << 9,
43
44 Load = 1u << 10,
45 WritesVGPR = 1u << 11,
46 RawVALU = 1u << 12,
47 LDSDMA = 1u << 13,
48};
49} // namespace HazardClass
50
63
68
69enum class Lifetime : uint8_t {
70 // Wait-state budget.
72 // Most recent producer regs count cap.
74};
83
84struct ClassMatch {
88 bool matches(HazardClassMask Mask) const {
89 return (!AnyOf || (Mask & AnyOf)) && ((Mask & AllOf) == AllOf) &&
90 !(Mask & NoneOf);
91 }
92};
93
94// To enable or disable the whole rule.
95using RulePredicate = bool (*)(const HazardContext &);
96
97// To gate the rule for producer or consumer.
98using InstPredicate = bool (*)(const MachineInstr &, const HazardContext &);
99
100// This helps advancing a window for the WAW/WAR case where a RAW sits between
101// the producer and the consumer.
102using AdvanceForRawWindowFn = unsigned (*)(const MachineInstr &Producer,
103 HazardClassMask ReaderClass,
104 const HazardContext &Ctx);
105
111
112// Length of a hazard window in wait states.
113// Precedence: Fn --> WindowLength.
115 unsigned WindowLength = 0;
116 unsigned (*Fn)(const MachineInstr &Producer, HazardClassMask ConsumerClass,
117 const HazardContext &Ctx) = nullptr;
118};
119
126
134
136
137} // namespace AMDGPU
138} // namespace llvm
139
140#endif // LLVM_LIB_TARGET_AMDGPU_GCNPRERAANTIHINTS_H
This file defines the SmallVector class.
Representation of each machine instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Provide an instruction scheduling machine model to CodeGen passes.
uint32_t HazardClassMask
bool(*)(const HazardContext &) RulePredicate
void applyAntiHintRules(MachineFunction &MF, const HazardContext &Ctx)
unsigned(*)(const MachineInstr &Producer, HazardClassMask ReaderClass, const HazardContext &Ctx) AdvanceForRawWindowFn
bool(*)(const MachineInstr &, const HazardContext &) InstPredicate
This is an optimization pass for GlobalISel generic memory operations.
bool matches(HazardClassMask Mask) const
SmallVector< ConsumerTarget, 3 > Consumers
AdvanceForRawWindowFn AdvanceForRawWindow
const SIRegisterInfo * TRI
MachineRegisterInfo * MRI
const TargetSchedModel * SchedModel
unsigned(* Fn)(const MachineInstr &Producer, HazardClassMask ConsumerClass, const HazardContext &Ctx)