[Mlir-commits] [mlir] [OpenMP][MLIR] Add num_teams mlir to llvm lowering (PR #179418)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon May 4 04:28:00 PDT 2026
================
@@ -3,7 +3,7 @@
// CHECK: @[[EXEC_MODE1:.*]] = weak protected constant i8 1
// CHECK: @llvm.compiler.used{{.*}} = appending global [1 x ptr] [ptr @[[EXEC_MODE1]]], section "llvm.metadata"
// CHECK: @[[KERNEL1_ENV:.*_kernel_environment]] = weak_odr protected constant %struct.KernelEnvironmentTy {
-// CHECK-SAME: %struct.ConfigurationEnvironmentTy { i8 1, i8 1, i8 [[EXEC_MODE1:1]], i32 [[MIN_THREADS1:1]], i32 [[MAX_THREADS1:10]], i32 [[MIN_TEAMS1:1]], i32 [[MAX_TEAMS1:-1]], i32 0, i32 0 },
+// CHECK-SAME: %struct.ConfigurationEnvironmentTy { i8 1, i8 1, i8 [[EXEC_MODE1:1]], i32 [[MIN_THREADS1:1]], i32 [[MAX_THREADS1:10]], i32 [[MIN_TEAMS1:0]], i32 [[MAX_TEAMS1:0]], i32 0, i32 0 },
----------------
skc7 wrote:
The change comes from the new `else maxTeamsVals[i] = 0;` changes in `initTargetDefaultAttrs`.
For a non-constant unidim `num_teams(...)` the previous code left `maxTeamsVals[0] = -1` ("unset") and `minTeamsVal = 1`
With this PR, `maxTeamsVals[0] becomes 0` ("set but unknown").
`if (maxTeamsVals[0] >= 0)
minTeamsVal = maxTeamsVals[0];`
This line encodes the spec rule "if lower-bound is not specified, it equals the upper bound", so 0 flows from maxTeamsVals[0] into minTeamsVal. Hence `MIN_TEAMS: 1 → 0`, `MAX_TEAMS: -1 → 0`.
https://github.com/llvm/llvm-project/pull/179418
More information about the Mlir-commits
mailing list