1 //===--- SIProgramInfo.h ----------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 /// Defines struct to track resource usage and hardware flags for kernels and
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H
17 #define LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H
19 #include "llvm/IR/CallingConv.h"
24 /// Track resource usage for kernels / entry functions.
25 struct SIProgramInfo
{
26 // Fields set in PGM_RSRC1 pm4 packet.
27 uint32_t VGPRBlocks
= 0;
28 uint32_t SGPRBlocks
= 0;
29 uint32_t Priority
= 0;
30 uint32_t FloatMode
= 0;
32 uint32_t DX10Clamp
= 0;
33 uint32_t DebugMode
= 0;
34 uint32_t IEEEMode
= 0;
35 uint32_t WgpMode
= 0; // GFX10+
36 uint32_t MemOrdered
= 0; // GFX10+
37 uint64_t ScratchSize
= 0;
39 // Fields set in PGM_RSRC2 pm4 packet.
40 uint32_t LDSBlocks
= 0;
41 uint32_t ScratchBlocks
= 0;
43 uint64_t ComputePGMRSrc2
= 0;
44 uint64_t ComputePGMRSrc3GFX90A
= 0;
47 uint32_t NumArchVGPR
= 0;
48 uint32_t NumAccVGPR
= 0;
49 uint32_t AccumOffset
= 0;
53 bool FlatUsed
= false;
55 // Number of SGPRs that meets number of waves per execution unit request.
56 uint32_t NumSGPRsForWavesPerEU
= 0;
58 // Number of VGPRs that meets number of waves per execution unit request.
59 uint32_t NumVGPRsForWavesPerEU
= 0;
62 uint32_t Occupancy
= 0;
64 // Whether there is recursion, dynamic allocas, indirect calls or some other
65 // reason there may be statically unknown stack usage.
66 bool DynamicCallStack
= false;
68 // Bonus information for debugging.
71 SIProgramInfo() = default;
73 /// Compute the value of the ComputePGMRsrc1 register.
74 uint64_t getComputePGMRSrc1() const;
75 uint64_t getPGMRSrc1(CallingConv::ID CC
) const;
80 #endif // LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H