LLVM
22.0.0git
lib
Target
AMDGPU
SIProgramInfo.h
Go to the documentation of this file.
1
//===--- SIProgramInfo.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
/// \file
10
/// Defines struct to track resource usage and hardware flags for kernels and
11
/// entry functions.
12
///
13
//
14
//===----------------------------------------------------------------------===//
15
16
#ifndef LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H
17
#define LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H
18
19
#include "
llvm/IR/CallingConv.h
"
20
#include "
llvm/Support/Compiler.h
"
21
#include <cstdint>
22
#include <optional>
23
24
namespace
llvm
{
25
26
class
GCNSubtarget
;
27
class
MCContext
;
28
class
MCExpr
;
29
class
MachineFunction
;
30
31
/// Track resource usage for kernels / entry functions.
32
struct
LLVM_EXTERNAL_VISIBILITY
SIProgramInfo
{
33
std::optional<uint64_t>
CodeSizeInBytes
;
34
35
// Fields set in PGM_RSRC1 pm4 packet.
36
const
MCExpr
*
VGPRBlocks
=
nullptr
;
37
const
MCExpr
*
SGPRBlocks
=
nullptr
;
38
uint32_t
Priority
= 0;
39
uint32_t
FloatMode
= 0;
40
uint32_t
Priv
= 0;
41
uint32_t
DX10Clamp
= 0;
42
uint32_t
DebugMode
= 0;
43
uint32_t
IEEEMode
= 0;
44
uint32_t
WgpMode
= 0;
// GFX10+
45
uint32_t
MemOrdered
= 0;
// GFX10+
46
uint32_t
FwdProgress
= 0;
// GFX10+
47
uint32_t
RrWgMode
= 0;
// GFX12+
48
const
MCExpr
*
ScratchSize
=
nullptr
;
49
50
// State used to calculate fields set in PGM_RSRC2 pm4 packet.
51
uint32_t
LDSBlocks
= 0;
52
const
MCExpr
*
ScratchBlocks
=
nullptr
;
53
54
// Fields set in PGM_RSRC2 pm4 packet
55
const
MCExpr
*
ScratchEnable
=
nullptr
;
56
uint32_t
UserSGPR
= 0;
57
uint32_t
TrapHandlerEnable
= 0;
58
uint32_t
TGIdXEnable
= 0;
59
uint32_t
TGIdYEnable
= 0;
60
uint32_t
TGIdZEnable
= 0;
61
uint32_t
TGSizeEnable
= 0;
62
uint32_t
TIdIGCompCount
= 0;
63
uint32_t
EXCPEnMSB
= 0;
64
uint32_t
LdsSize
= 0;
65
uint32_t
EXCPEnable
= 0;
66
67
const
MCExpr
*
ComputePGMRSrc3
=
nullptr
;
68
69
const
MCExpr
*
NumVGPR
=
nullptr
;
70
const
MCExpr
*
NumArchVGPR
=
nullptr
;
71
const
MCExpr
*
NumAccVGPR
=
nullptr
;
72
const
MCExpr
*
AccumOffset
=
nullptr
;
73
uint32_t
TgSplit
= 0;
74
const
MCExpr
*
NumSGPR
=
nullptr
;
75
unsigned
SGPRSpill
= 0;
76
unsigned
VGPRSpill
= 0;
77
uint32_t
LDSSize
= 0;
78
const
MCExpr
*
FlatUsed
=
nullptr
;
79
80
// Number of SGPRs that meets number of waves per execution unit request.
81
const
MCExpr
*
NumSGPRsForWavesPerEU
=
nullptr
;
82
83
// Number of VGPRs that meets number of waves per execution unit request.
84
const
MCExpr
*
NumVGPRsForWavesPerEU
=
nullptr
;
85
86
// Number of named barriers used by the kernel.
87
const
MCExpr
*
NamedBarCnt
=
nullptr
;
88
89
// Final occupancy.
90
const
MCExpr
*
Occupancy
=
nullptr
;
91
92
// Whether there is recursion, dynamic allocas, indirect calls or some other
93
// reason there may be statically unknown stack usage.
94
const
MCExpr
*
DynamicCallStack
=
nullptr
;
95
96
// Bonus information for debugging.
97
const
MCExpr
*
VCCUsed
=
nullptr
;
98
99
SIProgramInfo
() =
default
;
100
101
// The constructor sets the values for each member as shown in the struct.
102
// However, setting the MCExpr members to their zero value equivalent
103
// happens in reset together with (duplicated) value re-set for the
104
// non-MCExpr members.
105
void
reset
(
const
MachineFunction
&MF);
106
107
// Get function code size and cache the value.
108
// If \p IsLowerBound is set it returns a minimal code size which is safe
109
// to address.
110
uint64_t
getFunctionCodeSize
(
const
MachineFunction
&MF,
111
bool
IsLowerBound =
false
);
112
113
/// Compute the value of the ComputePGMRsrc1 register.
114
const
MCExpr
*
getComputePGMRSrc1
(
const
GCNSubtarget
&ST,
115
MCContext
&Ctx)
const
;
116
const
MCExpr
*
getPGMRSrc1
(
CallingConv::ID
CC,
const
GCNSubtarget
&ST,
117
MCContext
&Ctx)
const
;
118
119
/// Compute the value of the ComputePGMRsrc2 register.
120
const
MCExpr
*
getComputePGMRSrc2
(
MCContext
&Ctx)
const
;
121
const
MCExpr
*
getPGMRSrc2
(
CallingConv::ID
CC,
MCContext
&Ctx)
const
;
122
};
123
124
}
// namespace llvm
125
126
#endif
// LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H
CallingConv.h
Compiler.h
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition
Compiler.h:132
llvm::GCNSubtarget
Definition
GCNSubtarget.h:34
llvm::MCContext
Context object for machine code objects.
Definition
MCContext.h:83
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition
MCExpr.h:34
llvm::MachineFunction
Definition
MachineFunction.h:286
uint32_t
uint64_t
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition
CallingConv.h:24
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
AddressRanges.h:18
llvm::SIProgramInfo::Priv
uint32_t Priv
Definition
SIProgramInfo.h:40
llvm::SIProgramInfo::SGPRSpill
unsigned SGPRSpill
Definition
SIProgramInfo.h:75
llvm::SIProgramInfo::NumSGPR
const MCExpr * NumSGPR
Definition
SIProgramInfo.h:74
llvm::SIProgramInfo::getPGMRSrc2
const MCExpr * getPGMRSrc2(CallingConv::ID CC, MCContext &Ctx) const
Definition
SIProgramInfo.cpp:200
llvm::SIProgramInfo::TIdIGCompCount
uint32_t TIdIGCompCount
Definition
SIProgramInfo.h:62
llvm::SIProgramInfo::RrWgMode
uint32_t RrWgMode
Definition
SIProgramInfo.h:47
llvm::SIProgramInfo::NumArchVGPR
const MCExpr * NumArchVGPR
Definition
SIProgramInfo.h:70
llvm::SIProgramInfo::getFunctionCodeSize
uint64_t getFunctionCodeSize(const MachineFunction &MF, bool IsLowerBound=false)
Definition
SIProgramInfo.cpp:208
llvm::SIProgramInfo::getComputePGMRSrc2
const MCExpr * getComputePGMRSrc2(MCContext &Ctx) const
Compute the value of the ComputePGMRsrc2 register.
Definition
SIProgramInfo.cpp:194
llvm::SIProgramInfo::DebugMode
uint32_t DebugMode
Definition
SIProgramInfo.h:42
llvm::SIProgramInfo::TGIdZEnable
uint32_t TGIdZEnable
Definition
SIProgramInfo.h:60
llvm::SIProgramInfo::LDSBlocks
uint32_t LDSBlocks
Definition
SIProgramInfo.h:51
llvm::SIProgramInfo::VGPRBlocks
const MCExpr * VGPRBlocks
Definition
SIProgramInfo.h:36
llvm::SIProgramInfo::Priority
uint32_t Priority
Definition
SIProgramInfo.h:38
llvm::SIProgramInfo::ScratchBlocks
const MCExpr * ScratchBlocks
Definition
SIProgramInfo.h:52
llvm::SIProgramInfo::EXCPEnable
uint32_t EXCPEnable
Definition
SIProgramInfo.h:65
llvm::SIProgramInfo::ComputePGMRSrc3
const MCExpr * ComputePGMRSrc3
Definition
SIProgramInfo.h:67
llvm::SIProgramInfo::getComputePGMRSrc1
const MCExpr * getComputePGMRSrc1(const GCNSubtarget &ST, MCContext &Ctx) const
Compute the value of the ComputePGMRsrc1 register.
Definition
SIProgramInfo.cpp:169
llvm::SIProgramInfo::VCCUsed
const MCExpr * VCCUsed
Definition
SIProgramInfo.h:97
llvm::SIProgramInfo::UserSGPR
uint32_t UserSGPR
Definition
SIProgramInfo.h:56
llvm::SIProgramInfo::FloatMode
uint32_t FloatMode
Definition
SIProgramInfo.h:39
llvm::SIProgramInfo::FlatUsed
const MCExpr * FlatUsed
Definition
SIProgramInfo.h:78
llvm::SIProgramInfo::TrapHandlerEnable
uint32_t TrapHandlerEnable
Definition
SIProgramInfo.h:57
llvm::SIProgramInfo::NamedBarCnt
const MCExpr * NamedBarCnt
Definition
SIProgramInfo.h:87
llvm::SIProgramInfo::ScratchEnable
const MCExpr * ScratchEnable
Definition
SIProgramInfo.h:55
llvm::SIProgramInfo::AccumOffset
const MCExpr * AccumOffset
Definition
SIProgramInfo.h:72
llvm::SIProgramInfo::SIProgramInfo
SIProgramInfo()=default
llvm::SIProgramInfo::NumAccVGPR
const MCExpr * NumAccVGPR
Definition
SIProgramInfo.h:71
llvm::SIProgramInfo::DynamicCallStack
const MCExpr * DynamicCallStack
Definition
SIProgramInfo.h:94
llvm::SIProgramInfo::LdsSize
uint32_t LdsSize
Definition
SIProgramInfo.h:64
llvm::SIProgramInfo::SGPRBlocks
const MCExpr * SGPRBlocks
Definition
SIProgramInfo.h:37
llvm::SIProgramInfo::NumVGPRsForWavesPerEU
const MCExpr * NumVGPRsForWavesPerEU
Definition
SIProgramInfo.h:84
llvm::SIProgramInfo::CodeSizeInBytes
std::optional< uint64_t > CodeSizeInBytes
Definition
SIProgramInfo.h:33
llvm::SIProgramInfo::NumVGPR
const MCExpr * NumVGPR
Definition
SIProgramInfo.h:69
llvm::SIProgramInfo::DX10Clamp
uint32_t DX10Clamp
Definition
SIProgramInfo.h:41
llvm::SIProgramInfo::TGIdXEnable
uint32_t TGIdXEnable
Definition
SIProgramInfo.h:58
llvm::SIProgramInfo::IEEEMode
uint32_t IEEEMode
Definition
SIProgramInfo.h:43
llvm::SIProgramInfo::getPGMRSrc1
const MCExpr * getPGMRSrc1(CallingConv::ID CC, const GCNSubtarget &ST, MCContext &Ctx) const
Definition
SIProgramInfo.cpp:179
llvm::SIProgramInfo::LDSSize
uint32_t LDSSize
Definition
SIProgramInfo.h:77
llvm::SIProgramInfo::Occupancy
const MCExpr * Occupancy
Definition
SIProgramInfo.h:90
llvm::SIProgramInfo::ScratchSize
const MCExpr * ScratchSize
Definition
SIProgramInfo.h:48
llvm::SIProgramInfo::WgpMode
uint32_t WgpMode
Definition
SIProgramInfo.h:44
llvm::SIProgramInfo::FwdProgress
uint32_t FwdProgress
Definition
SIProgramInfo.h:46
llvm::SIProgramInfo::NumSGPRsForWavesPerEU
const MCExpr * NumSGPRsForWavesPerEU
Definition
SIProgramInfo.h:81
llvm::SIProgramInfo::TGSizeEnable
uint32_t TGSizeEnable
Definition
SIProgramInfo.h:61
llvm::SIProgramInfo::TgSplit
uint32_t TgSplit
Definition
SIProgramInfo.h:73
llvm::SIProgramInfo::EXCPEnMSB
uint32_t EXCPEnMSB
Definition
SIProgramInfo.h:63
llvm::SIProgramInfo::reset
void reset(const MachineFunction &MF)
Definition
SIProgramInfo.cpp:25
llvm::SIProgramInfo::TGIdYEnable
uint32_t TGIdYEnable
Definition
SIProgramInfo.h:59
llvm::SIProgramInfo::VGPRSpill
unsigned VGPRSpill
Definition
SIProgramInfo.h:76
llvm::SIProgramInfo::MemOrdered
uint32_t MemOrdered
Definition
SIProgramInfo.h:45
Generated on
for LLVM by
1.14.0