[PATCH] D67048: [AMDGPU] Set default flat work group size to (1, 256) for HIP

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 1 06:16:54 PDT 2019


yaxunl created this revision.
yaxunl added reviewers: arsenm, rampitec, b-sumner.
Herald added subscribers: t-tye, tpr, dstuttard, wdng, kzhuravl.

https://reviews.llvm.org/D67048

Files:
  lib/CodeGen/TargetInfo.cpp


Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -7922,8 +7922,9 @@
 
   const bool IsOpenCLKernel = M.getLangOpts().OpenCL &&
                               FD->hasAttr<OpenCLKernelAttr>();
-  if ((IsOpenCLKernel ||
-       (M.getLangOpts().HIP && FD->hasAttr<CUDAGlobalAttr>())) &&
+  const bool IsHIPKernel = M.getLangOpts().HIP &&
+                           FD->hasAttr<CUDAGlobalAttr>();
+  if ((IsOpenCLKernel || IsHIPKernel) &&
       (M.getTriple().getOS() == llvm::Triple::AMDHSA))
     F->addFnAttr("amdgpu-implicitarg-num-bytes", "56");
 
@@ -7949,7 +7950,7 @@
       F->addFnAttr("amdgpu-flat-work-group-size", AttrVal);
     } else
       assert(Max == 0 && "Max must be zero");
-  } else if (IsOpenCLKernel) {
+  } else if (IsOpenCLKernel || IsHIPKernel) {
     // By default, restrict the maximum size to 256.
     F->addFnAttr("amdgpu-flat-work-group-size", "1,256");
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67048.218259.patch
Type: text/x-patch
Size: 1008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190901/48848a5e/attachment.bin>


More information about the cfe-commits mailing list