[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 6 05:56:29 PST 2024


================
@@ -494,6 +494,14 @@ MetadataStreamerMsgPackV4::getHSAKernelProps(const MachineFunction &MF,
 
   Kern[".max_flat_workgroup_size"] =
       Kern.getDocument()->getNode(MFI.getMaxFlatWorkGroupSize());
+  unsigned NumWGX = MFI.getMaxNumWorkGroupsX();
+  unsigned NumWGY = MFI.getMaxNumWorkGroupsY();
+  unsigned NumWGZ = MFI.getMaxNumWorkGroupsZ();
+  if (NumWGX != 0 && NumWGY != 0 && NumWGZ != 0) {
+    Kern[".max_num_work_groups_x"] = Kern.getDocument()->getNode(NumWGX);
+    Kern[".max_num_work_groups_y"] = Kern.getDocument()->getNode(NumWGY);
+    Kern[".max_num_work_groups_z"] = Kern.getDocument()->getNode(NumWGZ);
----------------
arsenm wrote:

In other contexts it's "workgroup" not "work group". Should probably change this to be consistent 

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


More information about the cfe-commits mailing list