[Mlir-commits] [flang] [mlir] [mlir][OpenMP] Add iterator support to map/motion clause (PR #197047)
Sergio Afonso
llvmlistbot at llvm.org
Wed May 13 08:49:44 PDT 2026
================
@@ -1650,12 +1650,13 @@ def TargetOp : OpenMP_Op<"target", traits = [
bool *hostEvalTripCount = nullptr);
}] # clausesExtraClassDeclaration;
- let assemblyFormat = clausesAssemblyFormat # [{
+ let assemblyFormat = clausesAssemblyFormat#[{
custom<TargetOpRegion>(
$region, $has_device_addr_vars, type($has_device_addr_vars),
$host_eval_vars, type($host_eval_vars), $in_reduction_vars,
type($in_reduction_vars), $in_reduction_byref, $in_reduction_syms,
- $map_vars, type($map_vars), $private_vars, type($private_vars),
+ $map_vars, type($map_vars), $map_iterated, type($map_iterated),
+ $private_vars, type($private_vars),
----------------
skatrak wrote:
Adding map_iterated to the custom region printer/parser breaks the pattern, as it doesn't currently correspond with entry block arguments (I imagine it should eventually, though, otherwise how are we going to reference those mapped variables?).
My suggestion for now would be to move it right after the inherited assembly format, which would be where it would be located if the op hadn't skipped it:
```
let assemblyFormat = clausesAssemblyFormat # [{
`map_iterated` `(` $map_iterated `:` type($map_iterated) `)`
custom<TargetOpRegion>(
$region, $has_device_addr_vars, type($has_device_addr_vars),
$host_eval_vars, type($host_eval_vars), $in_reduction_vars,
type($in_reduction_vars), $in_reduction_byref, $in_reduction_syms,
$map_vars, type($map_vars), $private_vars, type($private_vars),
$private_syms, $private_needs_barrier, $private_maps) attr-dict
}];
```
That would also allow rolling back some of the changes to custom parsers/printers.
https://github.com/llvm/llvm-project/pull/197047
More information about the Mlir-commits
mailing list