[Mlir-commits] [mlir] [MLIR][OpenMP] Enable strict property assembly format (PR #217297)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Aug 19 03:55:28 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-llvm
Author: Mehdi Amini (joker-eph)
<details>
<summary>Changes</summary>
Enable strict property assembly format mode for OpenMP. Spell OpenMP assembly-only properties directly in directive and clause formats instead of relying on generic property dictionaries.
Refresh OpenMP dialect, conversion, and LLVM target tests to use the direct syntax for these properties.
Assisted-by: Codex
---
Patch is 284.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/217297.diff
84 Files Affected:
- (modified) mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td (+6-3)
- (modified) mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.td (+1)
- (modified) mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td (+17-9)
- (modified) mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir (+28-28)
- (modified) mlir/test/Dialect/OpenMP/host-op-filtering.mlir (+4-5)
- (modified) mlir/test/Dialect/OpenMP/invalid.mlir (+61-55)
- (modified) mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare-by-value.mlir (+2-2)
- (modified) mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare.mlir (+10-10)
- (modified) mlir/test/Dialect/OpenMP/ops.mlir (+144-144)
- (modified) mlir/test/Target/LLVMIR/allocatable_gpu_reduction.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/allocatable_gpu_reduction_teams.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/omp-target-call-with-repeated-parameter.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-array-sectioning-host.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-atomic-capture-control-options.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/omptarget-atomic-update-control-options.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-byref-bycopy-generation-device.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-byref-bycopy-generation-host.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-constant-indexing-device-region.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-data-use-dev-ordering.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-debug-147063.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-debug-loop-loc.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/omptarget-debug-record-pos.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-debug-reduc-fn-loc.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-debug.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-debug2.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-declare-target-all-device-types-device.mlir (+12-12)
- (modified) mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device-2.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-declare-target-module-rewrite-device.mlir (+5-5)
- (modified) mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-depend-host-only.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-depend.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/omptarget-device-shared-memory.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-device.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/omptarget-fortran-common-block-host.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-groupprivate.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-host-ref-semantics.mlir (+17-17)
- (modified) mlir/test/Target/LLVMIR/omptarget-if-nowait.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-llvm.mlir (+23-23)
- (modified) mlir/test/Target/LLVMIR/omptarget-mapper-combined-entry.mlir (+4-6)
- (modified) mlir/test/Target/LLVMIR/omptarget-memcpy-align-metadata.mlir (+5-5)
- (modified) mlir/test/Target/LLVMIR/omptarget-multi-block-reduction.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-multi-reduction.mlir (+5-5)
- (modified) mlir/test/Target/LLVMIR/omptarget-nested-ptr-record-type-mapping-host.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/omptarget-nested-record-type-mapping-host.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-nowait-host-only.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-nowait.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-overlapping-record-member-map.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-parallel-llvm-debug.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-parallel-llvm.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/omptarget-private-llvm.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-record-type-mapping-host.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-record-type-with-ptr-member-host.mlir (+8-8)
- (modified) mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-region-host-only.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction-array-descriptor.mlir (+4-5)
- (modified) mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/omptargetdata-nowait-llvm.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/openmp-allocate-clause.mlir (+24-24)
- (modified) mlir/test/Target/LLVMIR/openmp-atomic-compare-capture.mlir (+9-9)
- (modified) mlir/test/Target/LLVMIR/openmp-data-target-device.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/openmp-iterator.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/openmp-llvm-invalid.mlir (+8-8)
- (modified) mlir/test/Target/LLVMIR/openmp-llvm.mlir (+22-22)
- (modified) mlir/test/Target/LLVMIR/openmp-nested-task-target-parallel.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/openmp-private-allloca-hoisting.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/openmp-simd-guided.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/openmp-simd-linear.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/openmp-simd-ordered.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/openmp-target-default-as.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/openmp-target-has-device-addr.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/openmp-target-in-reduction-debug.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/openmp-target-multiple-private.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/openmp-target-private-allocatable.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/openmp-target-private.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/openmp-target-spmd-num-threads-i64.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/openmp-teams-clauses-trunc-ext.mlir (+30-30)
- (modified) mlir/test/Target/LLVMIR/openmp-todo.mlir (+10-10)
- (modified) mlir/test/Target/LLVMIR/openmp-wsloop-linear.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/openmp-wsloop-simd-ordered.mlir (+2-2)
- (modified) mlir/test/mlir-tblgen/openmp-ops.td (+1-1)
``````````diff
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td
index 22296338b7915..f90f201a150a1 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td
@@ -127,6 +127,8 @@ class OpenMP_AllocateClauseSkip<
`allocate` `(`
custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
$allocator_vars, type($allocator_vars)) `)`
+ (`allocate_alignments` `(` $allocate_alignments^ `)`)?
+ (`allocate_private_indices` `(` $allocate_private_indices^ `)`)?
}];
let description = [{
@@ -396,6 +398,7 @@ class OpenMP_DoacrossClauseSkip<
( `depend_type` `` $doacross_depend_type^ )?
( `depend_vec` `(` $doacross_depend_vars^ `:` type($doacross_depend_vars)
`)` )?
+ ( `num_loops` `(` $doacross_num_loops^ `)` )?
}];
let description = [{
@@ -581,12 +584,11 @@ class OpenMP_HeapAllocClauseSkip<
Variadic<IntLikeType>:$shape
);
- // The custom parser doesn't parse `uniq_name` and `bindc_name`. This is
- // handled by the attr-dict, which must be present in the operation's
- // `assemblyFormat`.
let reqAssemblyFormat = [{
custom<HeapAllocClause>($in_type, $typeparams, type($typeparams), $shape,
type($shape))
+ ( `uniq_name` `(` $uniq_name^ `)` )?
+ ( `bindc_name` `(` $bindc_name^ `)` )?
}];
let extraClassDeclaration = [{
@@ -828,6 +830,7 @@ class OpenMP_LinearClauseSkip<
custom<LinearClause>($linear_vars, type($linear_vars),
$linear_step_vars, type($linear_step_vars),
$linear_modifiers) `)`
+ ( `linear_var_types` `(` $linear_var_types^ `)` )?
}];
let description = [{
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.td
index 459cc78435809..8ef8fcccf2d57 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.td
@@ -16,6 +16,7 @@ def OpenMP_Dialect : Dialect {
let cppNamespace = "::mlir::omp";
let dependentDialects = ["::mlir::LLVM::LLVMDialect, ::mlir::func::FuncDialect"];
let useDefaultAttributePrinterParser = 1;
+ let useStrictPropertiesInAssemblyFormat = 1;
let useDefaultTypePrinterParser = 1;
}
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
index b5ecf88596f8c..16f3f1e09346a 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
@@ -115,8 +115,7 @@ def PrivateClauseOp : OpenMP_Op<"private", [IsolatedFromAbove, RecipeInterface]>
$data_sharing_type $sym_name `:` $type
(`init` $init_region^)?
(`copy` $copy_region^)?
- (`dealloc` $dealloc_region^)?
- attr-dict
+ (`dealloc` $dealloc_region^)? attr-dict
}];
let builders = [
@@ -404,8 +403,7 @@ def NewCliOp : OpenMP_Op<"new_cli",
let arguments = (ins );
let results = (outs CanonicalLoopInfoType:$result);
- let assemblyFormat = [{
- attr-dict
+ let assemblyFormat = [{ attr-dict
}];
let builders = [
@@ -1385,7 +1383,7 @@ def MapBoundsOp : OpenMP_Op<"map.bounds",
| `extent` `(` $extent `:` type($extent) `)`
| `stride` `(` $stride `:` type($stride) `)`
| `start_idx` `(` $start_idx `:` type($start_idx) `)`
- ) attr-dict
+ ) (`stride_in_bytes` `(` $stride_in_bytes^ `)`)? attr-dict
}];
let hasVerifier = 1;
@@ -1477,6 +1475,8 @@ def MapInfoOp : OpenMP_Op<"map.info", [AttrSizedOperandSegments]> {
| `mapper` `(` $mapper_id `)`
| `members` `(` $members `:` custom<MembersIndex>($members_index) `:` type($members) `)`
| `bounds` `(` $bounds `)`
+ | `name` `(` $name `)`
+ | `partial_map` `(` $partial_map `)`
) `->` type($omp_ptr) attr-dict
}];
@@ -1992,7 +1992,7 @@ def AtomicUpdateOp : OpenMP_Op<"atomic.update", traits = [
// Override clause-based assemblyFormat.
let assemblyFormat = clausesAssemblyFormat #
- "$x `:` type($x) $region attr-dict";
+ "$x `:` type($x) $region (`atomic_control` $atomic_control^)? attr-dict";
let hasVerifier = 1;
let hasRegionVerifier = 1;
@@ -2042,6 +2042,10 @@ def AtomicCaptureOp : OpenMP_Op<"atomic.capture", traits = [
// Override region definition.
let regions = (region SizedRegion<1>:$region);
+ // Override clause-based assemblyFormat.
+ let assemblyFormat = clausesAssemblyFormat #
+ "$region (`fail_only` $fail_only^)? attr-dict";
+
let extraClassDeclaration = [{
/// Returns the `atomic.read` operation inside the region, if any.
/// Otherwise, it returns nullptr.
@@ -2110,7 +2114,9 @@ def AtomicCompareOp : OpenMP_Op<"atomic.compare", traits = [
// Override clause-based assemblyFormat.
let assemblyFormat = clausesAssemblyFormat #
- "$x `:` type($x) $region attr-dict";
+ "$x `:` type($x) $region "
+ "oilist(`weak` $weak | "
+ "`fail_memory_order` `(` $fail_memory_order `)`) attr-dict";
let hasVerifier = 1;
let hasRegionVerifier = 1;
@@ -2334,7 +2340,9 @@ def DeclareReductionOp : OpenMP_Op<"declare_reduction", [IsolatedFromAbove,
AnyRegion:$cleanupRegion,
MaxSizedRegion<1>:$dataPtrPtrRegion);
- let assemblyFormat = "$sym_name `:` $type attr-dict-with-keyword "
+ let assemblyFormat = "$sym_name "
+ "( `byref_element_type` `(` $byref_element_type^ `)` )? "
+ "`:` $type attr-dict-with-keyword "
"( `alloc` $allocRegion^ )? "
"`init` $initializerRegion "
"`combiner` $reductionRegion "
@@ -2701,7 +2709,7 @@ def IteratorOp : OpenMP_Op<"iterator", [AttrSizedOperandSegments, SingleBlock],
`(` custom<IteratorHeader>($region,
$loop_lower_bounds, $loop_upper_bounds, $loop_steps,
type($loop_lower_bounds), type($loop_upper_bounds), type($loop_steps))
- `->` qualified(type($iterated)) attr-dict
+ (`inclusive` $loop_inclusive^)? `->` qualified(type($iterated)) attr-dict
}];
let hasVerifier = 1;
diff --git a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
index 5be437b662b20..1f48d3c07a11e 100644
--- a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
+++ b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
@@ -214,25 +214,25 @@ func.func @task_depend(%arg0: !llvm.ptr) {
// CHECK-LABEL: @_QPomp_target_data
// CHECK: (%[[ARG0:.*]]: !llvm.ptr, %[[ARG1:.*]]: !llvm.ptr, %[[ARG2:.*]]: !llvm.ptr, %[[ARG3:.*]]: !llvm.ptr)
-// CHECK: %[[MAP0:.*]] = omp.map.info var_ptr(%[[ARG0]] : !llvm.ptr, i32) map_clauses(to) capture(ByRef) -> !llvm.ptr {name = ""}
-// CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG1]] : !llvm.ptr, i32) map_clauses(to) capture(ByRef) -> !llvm.ptr {name = ""}
-// CHECK: %[[MAP2:.*]] = omp.map.info var_ptr(%[[ARG2]] : !llvm.ptr, i32) map_clauses(always, storage) capture(ByRef) -> !llvm.ptr {name = ""}
+// CHECK: %[[MAP0:.*]] = omp.map.info var_ptr(%[[ARG0]] : !llvm.ptr, i32) map_clauses(to) capture(ByRef) name("") -> !llvm.ptr
+// CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG1]] : !llvm.ptr, i32) map_clauses(to) capture(ByRef) name("") -> !llvm.ptr
+// CHECK: %[[MAP2:.*]] = omp.map.info var_ptr(%[[ARG2]] : !llvm.ptr, i32) map_clauses(always, storage) capture(ByRef) name("") -> !llvm.ptr
// CHECK: omp.target_enter_data map_entries(%[[MAP0]], %[[MAP1]], %[[MAP2]] : !llvm.ptr, !llvm.ptr, !llvm.ptr)
-// CHECK: %[[MAP3:.*]] = omp.map.info var_ptr(%[[ARG0]] : !llvm.ptr, i32) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = ""}
-// CHECK: %[[MAP4:.*]] = omp.map.info var_ptr(%[[ARG1]] : !llvm.ptr, i32) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = ""}
-// CHECK: %[[MAP5:.*]] = omp.map.info var_ptr(%[[ARG2]] : !llvm.ptr, i32) map_clauses(storage) capture(ByRef) -> !llvm.ptr {name = ""}
-// CHECK: %[[MAP6:.*]] = omp.map.info var_ptr(%[[ARG3]] : !llvm.ptr, i32) map_clauses(always, delete) capture(ByRef) -> !llvm.ptr {name = ""}
+// CHECK: %[[MAP3:.*]] = omp.map.info var_ptr(%[[ARG0]] : !llvm.ptr, i32) map_clauses(from) capture(ByRef) name("") -> !llvm.ptr
+// CHECK: %[[MAP4:.*]] = omp.map.info var_ptr(%[[ARG1]] : !llvm.ptr, i32) map_clauses(from) capture(ByRef) name("") -> !llvm.ptr
+// CHECK: %[[MAP5:.*]] = omp.map.info var_ptr(%[[ARG2]] : !llvm.ptr, i32) map_clauses(storage) capture(ByRef) name("") -> !llvm.ptr
+// CHECK: %[[MAP6:.*]] = omp.map.info var_ptr(%[[ARG3]] : !llvm.ptr, i32) map_clauses(always, delete) capture(ByRef) name("") -> !llvm.ptr
// CHECK: omp.target_exit_data map_entries(%[[MAP3]], %[[MAP4]], %[[MAP5]], %[[MAP6]] : !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr)
llvm.func @_QPomp_target_data(%a : !llvm.ptr, %b : !llvm.ptr, %c : !llvm.ptr, %d : !llvm.ptr) {
- %0 = omp.map.info var_ptr(%a : !llvm.ptr, i32) map_clauses(to) capture(ByRef) -> !llvm.ptr {name = ""}
- %1 = omp.map.info var_ptr(%b : !llvm.ptr, i32) map_clauses(to) capture(ByRef) -> !llvm.ptr {name = ""}
- %2 = omp.map.info var_ptr(%c : !llvm.ptr, i32) map_clauses(always, storage) capture(ByRef) -> !llvm.ptr {name = ""}
+ %0 = omp.map.info var_ptr(%a : !llvm.ptr, i32) map_clauses(to) capture(ByRef) name("") -> !llvm.ptr
+ %1 = omp.map.info var_ptr(%b : !llvm.ptr, i32) map_clauses(to) capture(ByRef) name("") -> !llvm.ptr
+ %2 = omp.map.info var_ptr(%c : !llvm.ptr, i32) map_clauses(always, storage) capture(ByRef) name("") -> !llvm.ptr
omp.target_enter_data map_entries(%0, %1, %2 : !llvm.ptr, !llvm.ptr, !llvm.ptr) {}
- %3 = omp.map.info var_ptr(%a : !llvm.ptr, i32) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = ""}
- %4 = omp.map.info var_ptr(%b : !llvm.ptr, i32) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = ""}
- %5 = omp.map.info var_ptr(%c : !llvm.ptr, i32) map_clauses(storage) capture(ByRef) -> !llvm.ptr {name = ""}
- %6 = omp.map.info var_ptr(%d : !llvm.ptr, i32) map_clauses(always, delete) capture(ByRef) -> !llvm.ptr {name = ""}
+ %3 = omp.map.info var_ptr(%a : !llvm.ptr, i32) map_clauses(from) capture(ByRef) name("") -> !llvm.ptr
+ %4 = omp.map.info var_ptr(%b : !llvm.ptr, i32) map_clauses(from) capture(ByRef) name("") -> !llvm.ptr
+ %5 = omp.map.info var_ptr(%c : !llvm.ptr, i32) map_clauses(storage) capture(ByRef) name("") -> !llvm.ptr
+ %6 = omp.map.info var_ptr(%d : !llvm.ptr, i32) map_clauses(always, delete) capture(ByRef) name("") -> !llvm.ptr
omp.target_exit_data map_entries(%3, %4, %5, %6 : !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr) {}
llvm.return
}
@@ -241,7 +241,7 @@ llvm.func @_QPomp_target_data(%a : !llvm.ptr, %b : !llvm.ptr, %c : !llvm.ptr, %d
// CHECK-LABEL: @_QPomp_target_data_region
// CHECK: (%[[ARG0:.*]]: !llvm.ptr, %[[ARG1:.*]]: !llvm.ptr) {
-// CHECK: %[[MAP_0:.*]] = omp.map.info var_ptr(%[[ARG0]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+// CHECK: %[[MAP_0:.*]] = omp.map.info var_ptr(%[[ARG0]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(tofrom) capture(ByRef) name("") -> !llvm.ptr
// CHECK: omp.target_data map_entries(%[[MAP_0]] : !llvm.ptr) {
// CHECK: %[[VAL_1:.*]] = llvm.mlir.constant(10 : i32) : i32
// CHECK: llvm.store %[[VAL_1]], %[[ARG1]] : i32, !llvm.ptr
@@ -250,7 +250,7 @@ llvm.func @_QPomp_target_data(%a : !llvm.ptr, %b : !llvm.ptr, %c : !llvm.ptr, %d
// CHECK: llvm.return
llvm.func @_QPomp_target_data_region(%a : !llvm.ptr, %i : !llvm.ptr) {
- %1 = omp.map.info var_ptr(%a : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ %1 = omp.map.info var_ptr(%a : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(tofrom) capture(ByRef) name("") -> !llvm.ptr
omp.target_data map_entries(%1 : !llvm.ptr) {
%2 = llvm.mlir.constant(10 : i32) : i32
llvm.store %2, %i : i32, !llvm.ptr
@@ -265,8 +265,8 @@ llvm.func @_QPomp_target_data_region(%a : !llvm.ptr, %i : !llvm.ptr) {
// CHECK: %[[ARG_0:.*]]: !llvm.ptr,
// CHECK: %[[ARG_1:.*]]: !llvm.ptr) {
// CHECK: %[[VAL_0:.*]] = llvm.mlir.constant(64 : i32) : i32
-// CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG_0]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
-// CHECK: %[[MAP2:.*]] = omp.map.info var_ptr(%[[ARG_1]] : !llvm.ptr, i32) map_clauses(implicit, storage) capture(ByCopy) -> !llvm.ptr {name = ""}
+// CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG_0]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(tofrom) capture(ByRef) name("") -> !llvm.ptr
+// CHECK: %[[MAP2:.*]] = omp.map.info var_ptr(%[[ARG_1]] : !llvm.ptr, i32) map_clauses(implicit, storage) capture(ByCopy) name("") -> !llvm.ptr
// CHECK: omp.target kernel_type(generic) thread_limit(%[[VAL_0]] : i32) map_entries(%[[MAP1]] -> %[[BB_ARG0:.*]], %[[MAP2]] -> %[[BB_ARG1:.*]] : !llvm.ptr, !llvm.ptr) {
// CHECK: %[[VAL_1:.*]] = llvm.mlir.constant(10 : i32) : i32
// CHECK: llvm.store %[[VAL_1]], %[[BB_ARG1]] : i32, !llvm.ptr
@@ -277,8 +277,8 @@ llvm.func @_QPomp_target_data_region(%a : !llvm.ptr, %i : !llvm.ptr) {
llvm.func @_QPomp_target(%a : !llvm.ptr, %i : !llvm.ptr) {
%0 = llvm.mlir.constant(64 : i32) : i32
- %1 = omp.map.info var_ptr(%a : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
- %3 = omp.map.info var_ptr(%i : !llvm.ptr, i32) map_clauses(implicit, storage) capture(ByCopy) -> !llvm.ptr {name = ""}
+ %1 = omp.map.info var_ptr(%a : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(tofrom) capture(ByRef) name("") -> !llvm.ptr
+ %3 = omp.map.info var_ptr(%i : !llvm.ptr, i32) map_clauses(implicit, storage) capture(ByCopy) name("") -> !llvm.ptr
omp.target kernel_type(generic) thread_limit(%0 : i32) map_entries(%1 -> %arg0, %3 -> %arg1 : !llvm.ptr, !llvm.ptr) {
%2 = llvm.mlir.constant(10 : i32) : i32
llvm.store %2, %arg1 : i32, !llvm.ptr
@@ -474,13 +474,13 @@ llvm.func @sub_() {
// CHECK: %[[C_03:.*]] = llvm.mlir.constant(1 : index) : i64
// CHECK: %[[C_04:.*]] = llvm.mlir.constant(1 : index) : i64
// CHECK: %[[BOUNDS0:.*]] = omp.map.bounds lower_bound(%[[C_02]] : i64) upper_bound(%[[C_01]] : i64) stride(%[[C_04]] : i64) start_idx(%[[C_04]] : i64)
-// CHECK: %[[MAP0:.*]] = omp.map.info var_ptr(%[[ARG_1]] : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS0]]) -> !llvm.ptr {name = ""}
+// CHECK: %[[MAP0:.*]] = omp.map.info var_ptr(%[[ARG_1]] : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS0]]) name("") -> !llvm.ptr
// CHECK: %[[C_11:.*]] = llvm.mlir.constant(4 : index) : i64
// CHECK: %[[C_12:.*]] = llvm.mlir.constant(1 : index) : i64
// CHECK: %[[C_13:.*]] = llvm.mlir.constant(1 : index) : i64
// CHECK: %[[C_14:.*]] = llvm.mlir.constant(1 : index) : i64
// CHECK: %[[BOUNDS1:.*]] = omp.map.bounds lower_bound(%[[C_12]] : i64) upper_bound(%[[C_11]] : i64) stride(%[[C_14]] : i64) start_idx(%[[C_14]] : i64)
-// CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG_2]] : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS1]]) -> !llvm.ptr {name = ""}
+// CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG_2]] : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS1]]) name("") -> !llvm.ptr
// CHECK: omp.target kernel_type(generic) map_entries(%[[MAP0]] -> %[[BB_ARG0:.*]], %[[MAP1]] -> %[[BB_ARG1:.*]] : !llvm.ptr, !llvm.ptr) {
// CHECK: omp.terminator
// CHECK: }
@@ -493,13 +493,13 @@ llvm.func @_QPtarget_map_with_bounds(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2:
%2 = llvm.mlir.constant(1 : index) : i64
%3 = llvm.mlir.constant(1 : index) : i64
%4 = omp.map.bounds lower_bound(%1 : i64) upper_bound(%0 : i64) stride(%3 : i64) start_idx(%3 : i64)
- %5 = omp.map.info var_ptr(%arg1 : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(tofrom) capture(ByRef) bounds(%4) -> !llvm.ptr {name = ""}
+ %5 = omp.map.info var_ptr(%arg1 : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(tofrom) capture(ByRef) bounds(%4) name("") -> !llvm.ptr
%6 = llvm.mlir.constant(4 : index) : i64
%7 = llvm.mlir.constant(1 : index) : i64
%8 = llvm.mlir.constant(1 : index) : i64
%9 = llvm.mlir.constant(1 : index) : i64
%10 = omp.map.bounds lower_bound(%7 : i64) upper_bound(%6 : i64) stride(%9 : i64) start_idx(%9 : i64)
- %11 = omp.map.info var_ptr(%arg2 : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(tofrom) capture(ByRef) bounds(%10) -> !llvm.ptr {name = ""}
+ %11 = omp.map.info var_ptr(%arg2 : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(tofrom) capture(ByRef) bounds(%10) name("") -> !llvm.ptr
omp.target kernel_type(generic) map_entries(%5 -> %arg3, %11 -> %arg4: !llvm.ptr, !llvm.ptr) {
omp.terminator
}
@@ -573,8 +573,8 @@ func.func @omp_teams(%arg0 : memref<i32>) -> () {
func.func @omp_ordered(%arg0 : index) -> () {
omp.wsloop ordered(1) {
omp.loop_nest (%iv) : index = (%arg0) to (%arg0) step (%arg0) {
- // CHECK: omp.ordered depend_vec(%[[ARG0]] : i64) {doacross_num_loops = 1 : i64}
- omp.ordered depend_vec(%arg0 : index) {doacross_num_loops = 1 : i64}
+ // CHECK: omp.ordered depend_vec(%[[ARG0]] : i64) num_loops(1)
+ omp.ordered depend_vec(%arg0 : index) num_loops(1)
omp.yield
}
}
@@ -614,8 +614,8 @@ omp.declare_mapper @my_mapper : !llvm.struct<"_QFdeclare_mapperTmy_type", (i32)>
^bb0(%arg0: !llvm.ptr):
%0 = llvm.mlir.constant(0 : i32) : i32
%1 = llvm.getelementptr %arg0[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<"_QFdeclare_mapperTmy_type", (i32)>
- %2 = omp.map.info var_ptr(%1 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = "var%data"}
- %3 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.struct<"_QFdeclare_mapperTmy_type", (i32)>) map_clauses(tofrom) capture(ByRef) members(%2 : [0] : !llvm.ptr) -> !llvm.ptr {name = "var", partial_map = true}
+ %2 = omp.map.info var_ptr(%1 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) name("var%data") -> !llvm.ptr
+ %3 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.struct<"_QFdeclare_mapperTmy_type", (i32)>) map_clauses(tofrom) capture(ByRef) members(%2 : [0] : !llvm.ptr) name("var") partial_map(true) -> !llvm.ptr
// CHECK: omp.declare_mapper.info map_entries(%{{.*}}, %{{.*}} : !llvm.ptr, !llvm.ptr)
omp.declare_mapper.info map_entries(%3, %2 : !llvm.ptr, !llvm.ptr)
}
diff --git a/mlir/test/Dialect/OpenMP/host-op-filtering.mlir b/mlir/test/Dialect/OpenMP/host-op-filtering.mlir
index d4dde0cdef178..8ef6df39094cd 100644
--- a/mlir/test/Dialect/OpenMP/host-op-filtering.mlir
+++ b/mlir/test/Dialect/OpenMP/host-op-filtering.mlir
@@ -183,7 +183,7 @@ module attributes {omp.is_target_device = true} {
%11 = llvm.load %10 : !llvm.ptr -> i64
%12 = llvm.sub %3, %7 : i64
%13 = llvm.sub %4, %7 : i64
- %14 = omp.map.bounds lower_bound(%12 : i64) upper_bound(%13 : i64) extent(%9 : i64) stride(%11 : i64) start_idx(%7 : i64) {stride_in_bytes = true}
+ %14 = omp.map.bounds lower_bound(%12 : i64) upper_bound(%13 : i64) extent(%9 : i64) stride(%11 : i64) start_idx(%7 : i64) stride_in_bytes(true)
%15 = llvm.getelementptr %arg0[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
// CHECK-NEXT: %[[MAP0:.*]] = omp.map.info var_ptr(%[[ARG]] {{.*}} map_clauses(tofrom) capture(ByRef) var_ptr_ptr(%[[VAR_PTR_PTR]] : !llvm.ptr, f32) -> !llvm.ptr
@@ -352,11 +352,10 @@ module attributes {omp.is_target_device = true} {
// argument; it is captured by a matching `map_entries` entry.
// CHECK-NEXT: %[[MAP:.*]] = omp.map.info var_ptr(%[[ARG0]] : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr
%1 = omp.map.info var_ptr(%arg0 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr
- // CHECK-NEXT: omp.target kernel_type(generic) allocate(%[[ARG0]] : !llvm.ptr -> %[[ARG0]] : !llvm.ptr) thread_limit(%[[ARG1]] : i32) map_entries(%[[MAP]] -> %{{.*}} : !llvm.ptr...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/217297
More information about the Mlir-commits
mailing list