[PATCH] D29741: [AMDGPU] Calculate number of min/max SGPRs/VGPRs for WavesPerEU instead of using switch statement

Tony Tye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 00:38:14 PST 2017


tony-tye added inline comments.


================
Comment at: lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp:211-233
 unsigned getMinNumSGPRs(const FeatureBitset &Features, unsigned WavesPerEU) {
   IsaVersion Version = getIsaVersion(Features);
   if (Version.Major >= 8) {
     switch (WavesPerEU) {
       case 0:  return 0;
       case 10: return 0;
       case 9:  return 0;
----------------
tony-tye wrote:
> kzhuravl wrote:
> > tony-tye wrote:
> > > Should this also have a calculation that takes into account if a trap handler is present?
> > I do not think so. `getMinNumSGPRs` is used to bump up granulated sgpr count in pgm rsrc1 register to match maximum number of requested waves per execution unit.
> Right, but the value required to achieve that is based on determining how many registers the kernel must use. That value is reduced if there is a trap handler as the hardware will automatically allocate registers for the trap handler. It would also seem better if the hardcoded numbers here were replaced by the calculation that produces them which can then use the already existing target specific constants. If future hardware changes those limits then the calculation will still be correct.
Sorry, missed that the function was updated with the calculation. So ignore that part: of the comment-)


https://reviews.llvm.org/D29741





More information about the llvm-commits mailing list