[clang] [llvm] [OpenMP][amdgpu] Use max teams for amdgpu-max-num-workgroups (PR #195203)
Kevin Sala Penades via cfe-commits
cfe-commits at lists.llvm.org
Fri May 1 11:44:40 PDT 2026
================
@@ -8349,11 +8074,12 @@ OpenMPIRBuilder::readTeamBoundsForKernel(const Triple &, Function &Kernel) {
void OpenMPIRBuilder::writeTeamsForKernel(const Triple &T, Function &Kernel,
int32_t LB, int32_t UB) {
- if (T.isNVPTX())
- if (UB > 0)
+ if (UB > 0) {
+ if (T.isNVPTX())
Kernel.addFnAttr(NVVMAttr::MaxClusterRank, llvm::utostr(UB));
- if (T.isAMDGPU())
- Kernel.addFnAttr("amdgpu-max-num-workgroups", llvm::utostr(LB) + ",1,1");
+ if (T.isAMDGPU())
+ Kernel.addFnAttr("amdgpu-max-num-workgroups", llvm::utostr(LB) + ",1,1");
+ }
Kernel.addFnAttr("omp_target_num_teams", std::to_string(LB));
----------------
kevinsala wrote:
The `num_teams` clause accepts a _lower-bound_ since OpenMP 5.1 (doesn't seem supported yet). Also, the `bounds_launch` attribute for `ompx_attribute` can change the minimum number of teams.
https://github.com/llvm/llvm-project/pull/195203
More information about the cfe-commits
mailing list