Index: clang/lib/CodeGen/TargetInfo.cpp =================================================================== --- clang/lib/CodeGen/TargetInfo.cpp +++ clang/lib/CodeGen/TargetInfo.cpp @@ -9588,12 +9588,9 @@ const bool IsHIPKernel = M.getLangOpts().HIP && FD && FD->hasAttr(); - const bool IsOpenMPkernel = - M.getLangOpts().OpenMPIsDevice && - (F->getCallingConv() == llvm::CallingConv::AMDGPU_KERNEL); // TODO: This should be moved to language specific attributes instead. - if (IsHIPKernel || IsOpenMPkernel) + if (IsHIPKernel) F->addFnAttr("uniform-work-group-size", "true"); if (M.getContext().getTargetInfo().allowAMDGPUUnsafeFPAtomics()) Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp =================================================================== --- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -4892,6 +4892,8 @@ // Add a function attribute for the kernel. Fn->addFnAttr(Attribute::get(Ctx, "kernel")); + if (Triple(M.getTargetTriple()).isAMDGCN()) + Fn->addFnAttr("uniform-work-group-size", "true"); } // We only generate metadata for function that contain target regions.