[llvm-dev] AMDGPU workgroup size as metadata

Frank Winter via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 30 12:09:58 PDT 2020

 From LLVM IR, how can you get the 'workgroup size' value?
It seems to be set by the AMDGPU backend as metadata since in 
AMDGPUMetadata.h there are things defined like

constexpr char ReqdWorkGroupSize[] = "ReqdWorkGroupSize";


struct Metadata final {
   /// 'reqd_work_group_size' attribute. Optional.
   std::vector<uint32_t> mReqdWorkGroupSize = std::vector<uint32_t>();

Is this metadata set to the kernel function or to the module?

What IR instructions would give access to the value of, say, the 
workgroup size in dimension x?


More information about the llvm-dev mailing list