1 //===--- SIProgramInfo.h ----------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 /// \file 11 /// Defines struct to track resource usage for kernels and entry functions. 12 /// 13 // 14 //===----------------------------------------------------------------------===// 15 16 #ifndef LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H 17 #define LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H 18 19 namespace llvm { 20 21 /// Track resource usage for kernels / entry functions. 22 struct SIProgramInfo { 23 // Fields set in PGM_RSRC1 pm4 packet. 24 uint32_t VGPRBlocks = 0; 25 uint32_t SGPRBlocks = 0; 26 uint32_t Priority = 0; 27 uint32_t FloatMode = 0; 28 uint32_t Priv = 0; 29 uint32_t DX10Clamp = 0; 30 uint32_t DebugMode = 0; 31 uint32_t IEEEMode = 0; 32 uint64_t ScratchSize = 0; 33 34 uint64_t ComputePGMRSrc1 = 0; 35 36 // Fields set in PGM_RSRC2 pm4 packet. 37 uint32_t LDSBlocks = 0; 38 uint32_t ScratchBlocks = 0; 39 40 uint64_t ComputePGMRSrc2 = 0; 41 42 uint32_t NumVGPR = 0; 43 uint32_t NumSGPR = 0; 44 uint32_t LDSSize = 0; 45 bool FlatUsed = false; 46 47 // Number of SGPRs that meets number of waves per execution unit request. 48 uint32_t NumSGPRsForWavesPerEU = 0; 49 50 // Number of VGPRs that meets number of waves per execution unit request. 51 uint32_t NumVGPRsForWavesPerEU = 0; 52 53 // Fixed SGPR number used to hold wave scratch offset for entire kernel 54 // execution, or std::numeric_limits<uint16_t>::max() if the register is not 55 // used or not known. 56 uint16_t DebuggerWavefrontPrivateSegmentOffsetSGPR = 57 std::numeric_limits<uint16_t>::max(); 58 59 // Fixed SGPR number of the first 4 SGPRs used to hold scratch V# for entire 60 // kernel execution, or std::numeric_limits<uint16_t>::max() if the register 61 // is not used or not known. 62 uint16_t DebuggerPrivateSegmentBufferSGPR = 63 std::numeric_limits<uint16_t>::max(); 64 65 // Whether there is recursion, dynamic allocas, indirect calls or some other 66 // reason there may be statically unknown stack usage. 67 bool DynamicCallStack = false; 68 69 // Bonus information for debugging. 70 bool VCCUsed = false; 71 72 SIProgramInfo() = default; 73 }; 74 75 } // namespace llvm 76 77 #endif // LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H 78