[llvm] [AMDGPU][Attributor] Make `AAAMDFlatWorkGroupSize` honor existing attribute (PR #114357)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 09:33:50 PDT 2024


================
@@ -168,11 +168,21 @@ class AMDGPUInformationCache : public InformationCache {
     return ST.supportsGetDoorbellID();
   }
 
-  std::pair<unsigned, unsigned> getFlatWorkGroupSizes(const Function &F) {
+  std::optional<std::pair<unsigned, unsigned>>
+  getFlatWorkGroupSizeAttr(const Function &F) const {
+    Attribute A = F.getFnAttribute("amdgpu-flat-work-group-size");
+    if (!A.isStringAttribute())
----------------
arsenm wrote:

This amounts to querying the attribute twice. If you're going to apply your own maximum clamping later, can you directly parse the attribute instead of going through the smarter wrapper applying the clamp? i.e. use getIntegerPairAttribute? This would be easier to follow and you can avoid the second map lookup 

https://github.com/llvm/llvm-project/pull/114357


More information about the llvm-commits mailing list