xref: /llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td (revision 89063433792699c5913ba116cab09b534c549e56)
1//===-- OpenMPOpsInterfaces.td - OpenMP op interfaces ------*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This is the OpenMP Dialect interfaces definition file.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef OPENMP_OPS_INTERFACES
14#define OPENMP_OPS_INTERFACES
15
16include "mlir/IR/OpBase.td"
17
18def BlockArgOpenMPOpInterface : OpInterface<"BlockArgOpenMPOpInterface"> {
19  let description = [{
20    OpenMP operations that define entry block arguments as part of the
21    representation of its clauses.
22  }];
23
24  let cppNamespace = "::mlir::omp";
25
26  let methods = [
27    // Default-implemented methods to be overriden by the corresponding clauses.
28    InterfaceMethod<"Get number of block arguments defined by `host_eval`.",
29                    "unsigned", "numHostEvalBlockArgs", (ins), [{}], [{
30      return 0;
31    }]>,
32    InterfaceMethod<"Get number of block arguments defined by `in_reduction`.",
33                    "unsigned", "numInReductionBlockArgs", (ins), [{}], [{
34      return 0;
35    }]>,
36    InterfaceMethod<"Get number of block arguments defined by `map`.",
37                    "unsigned", "numMapBlockArgs", (ins), [{}], [{
38      return 0;
39    }]>,
40    InterfaceMethod<"Get number of block arguments defined by `private`.",
41                    "unsigned", "numPrivateBlockArgs", (ins), [{}], [{
42      return 0;
43    }]>,
44    InterfaceMethod<"Get number of block arguments defined by `reduction`.",
45                    "unsigned", "numReductionBlockArgs", (ins), [{}], [{
46      return 0;
47    }]>,
48    InterfaceMethod<"Get number of block arguments defined by `task_reduction`.",
49                    "unsigned", "numTaskReductionBlockArgs", (ins), [{}], [{
50      return 0;
51    }]>,
52    InterfaceMethod<"Get number of block arguments defined by `use_device_addr`.",
53                    "unsigned", "numUseDeviceAddrBlockArgs", (ins), [{}], [{
54      return 0;
55    }]>,
56    InterfaceMethod<"Get number of block arguments defined by `use_device_ptr`.",
57                    "unsigned", "numUseDevicePtrBlockArgs", (ins), [{}], [{
58      return 0;
59    }]>,
60
61    // Unified access methods for start indices of clause-associated entry block
62    // arguments.
63    InterfaceMethod<"Get start index of block arguments defined by `host_eval`.",
64                    "unsigned", "getHostEvalBlockArgsStart", (ins), [{
65      return 0;
66    }]>,
67    InterfaceMethod<"Get start index of block arguments defined by `in_reduction`.",
68                    "unsigned", "getInReductionBlockArgsStart", (ins), [{
69      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
70      return iface.getHostEvalBlockArgsStart() + $_op.numHostEvalBlockArgs();
71    }]>,
72    InterfaceMethod<"Get start index of block arguments defined by `map`.",
73                    "unsigned", "getMapBlockArgsStart", (ins), [{
74      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
75      return iface.getInReductionBlockArgsStart() +
76             $_op.numInReductionBlockArgs();
77    }]>,
78    InterfaceMethod<"Get start index of block arguments defined by `private`.",
79                    "unsigned", "getPrivateBlockArgsStart", (ins), [{
80      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
81      return iface.getMapBlockArgsStart() + $_op.numMapBlockArgs();
82    }]>,
83    InterfaceMethod<"Get start index of block arguments defined by `reduction`.",
84                    "unsigned", "getReductionBlockArgsStart", (ins), [{
85      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
86      return iface.getPrivateBlockArgsStart() + $_op.numPrivateBlockArgs();
87    }]>,
88    InterfaceMethod<"Get start index of block arguments defined by `task_reduction`.",
89                    "unsigned", "getTaskReductionBlockArgsStart", (ins), [{
90      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
91      return iface.getReductionBlockArgsStart() + $_op.numReductionBlockArgs();
92    }]>,
93    InterfaceMethod<"Get start index of block arguments defined by `use_device_addr`.",
94                    "unsigned", "getUseDeviceAddrBlockArgsStart", (ins), [{
95      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
96      return iface.getTaskReductionBlockArgsStart() + $_op.numTaskReductionBlockArgs();
97    }]>,
98    InterfaceMethod<"Get start index of block arguments defined by `use_device_ptr`.",
99                    "unsigned", "getUseDevicePtrBlockArgsStart", (ins), [{
100      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
101      return iface.getUseDeviceAddrBlockArgsStart() + $_op.numUseDeviceAddrBlockArgs();
102    }]>,
103
104    // Unified access methods for clause-associated entry block arguments.
105    InterfaceMethod<"Get block arguments defined by `host_eval`.",
106                    "::llvm::MutableArrayRef<::mlir::BlockArgument>",
107                    "getHostEvalBlockArgs", (ins), [{
108      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
109      return $_op->getRegion(0).getArguments().slice(
110          iface.getHostEvalBlockArgsStart(), $_op.numHostEvalBlockArgs());
111    }]>,
112    InterfaceMethod<"Get block arguments defined by `in_reduction`.",
113                    "::llvm::MutableArrayRef<::mlir::BlockArgument>",
114                    "getInReductionBlockArgs", (ins), [{
115      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
116      return $_op->getRegion(0).getArguments().slice(
117          iface.getInReductionBlockArgsStart(), $_op.numInReductionBlockArgs());
118    }]>,
119    InterfaceMethod<"Get block arguments defined by `map`.",
120                    "::llvm::MutableArrayRef<::mlir::BlockArgument>",
121                    "getMapBlockArgs", (ins), [{
122      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
123      return $_op->getRegion(0).getArguments().slice(
124          iface.getMapBlockArgsStart(), $_op.numMapBlockArgs());
125    }]>,
126    InterfaceMethod<"Get block arguments defined by `private`.",
127                    "::llvm::MutableArrayRef<::mlir::BlockArgument>",
128                    "getPrivateBlockArgs", (ins), [{
129      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
130      return $_op->getRegion(0).getArguments().slice(
131          iface.getPrivateBlockArgsStart(), $_op.numPrivateBlockArgs());
132    }]>,
133    InterfaceMethod<"Get block arguments defined by `reduction`.",
134                    "::llvm::MutableArrayRef<::mlir::BlockArgument>",
135                    "getReductionBlockArgs", (ins), [{
136      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
137      return $_op->getRegion(0).getArguments().slice(
138          iface.getReductionBlockArgsStart(), $_op.numReductionBlockArgs());
139    }]>,
140    InterfaceMethod<"Get block arguments defined by `task_reduction`.",
141                    "::llvm::MutableArrayRef<::mlir::BlockArgument>",
142                    "getTaskReductionBlockArgs", (ins), [{
143      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
144      return $_op->getRegion(0).getArguments().slice(
145          iface.getTaskReductionBlockArgsStart(),
146          $_op.numTaskReductionBlockArgs());
147    }]>,
148    InterfaceMethod<"Get block arguments defined by `use_device_addr`.",
149                    "::llvm::MutableArrayRef<::mlir::BlockArgument>",
150                    "getUseDeviceAddrBlockArgs", (ins), [{
151      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
152      return $_op->getRegion(0).getArguments().slice(
153          iface.getUseDeviceAddrBlockArgsStart(),
154          $_op.numUseDeviceAddrBlockArgs());
155    }]>,
156    InterfaceMethod<"Get block arguments defined by `use_device_ptr`.",
157                    "::llvm::MutableArrayRef<::mlir::BlockArgument>",
158                    "getUseDevicePtrBlockArgs", (ins), [{
159      auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>(*$_op);
160      return $_op->getRegion(0).getArguments().slice(
161          iface.getUseDevicePtrBlockArgsStart(),
162          $_op.numUseDevicePtrBlockArgs());
163    }]>,
164  ];
165
166  let verify = [{
167    auto iface = ::llvm::cast<BlockArgOpenMPOpInterface>($_op);
168    unsigned expectedArgs = iface.numHostEvalBlockArgs() +
169        iface.numInReductionBlockArgs() + iface.numMapBlockArgs() +
170        iface.numPrivateBlockArgs() + iface.numReductionBlockArgs() +
171        iface.numTaskReductionBlockArgs() + iface.numUseDeviceAddrBlockArgs() +
172        iface.numUseDevicePtrBlockArgs();
173    if ($_op->getRegion(0).getNumArguments() < expectedArgs)
174      return $_op->emitOpError() << "expected at least " << expectedArgs
175                                 << " entry block argument(s)";
176    return ::mlir::success();
177  }];
178}
179
180def OutlineableOpenMPOpInterface : OpInterface<"OutlineableOpenMPOpInterface"> {
181  let description = [{
182    OpenMP operations whose region will be outlined will implement this
183    interface.
184  }];
185
186  let cppNamespace = "::mlir::omp";
187
188  let methods = [
189    InterfaceMethod<"Get alloca block", "::mlir::Block*", "getAllocaBlock",
190      (ins), [{
191      return &$_op.getRegion().front();
192      }]>,
193  ];
194}
195
196def MapClauseOwningOpInterface : OpInterface<"MapClauseOwningOpInterface"> {
197  let description = [{
198    OpenMP operations which own a list of omp::MapInfoOp's implement this interface
199    to allow generic access to deal with map operands to more easily manipulate
200    this class of operations.
201  }];
202
203  let cppNamespace = "::mlir::omp";
204
205  let methods = [
206    InterfaceMethod<"Get map operands", "::mlir::OperandRange", "getMapVars",
207      (ins), [{
208        return $_op.getMapVars();
209      }]>,
210      InterfaceMethod<"Get mutable map operands", "::mlir::MutableOperandRange",
211                      "getMapVarsMutable",
212      (ins), [{
213        return $_op.getMapVarsMutable();
214      }]>,
215      InterfaceMethod<"Get operand index for a map clause",
216                      "int64_t",
217                      "getOperandIndexForMap",
218      (ins "::mlir::Value":$map), [{
219         return std::distance($_op.getMapVars().begin(),
220                              llvm::find($_op.getMapVars(), map));
221      }]>,
222  ];
223}
224
225def ReductionClauseInterface : OpInterface<"ReductionClauseInterface"> {
226  let description = [{
227    OpenMP operations that support reduction clause have this interface.
228  }];
229
230  let cppNamespace = "::mlir::omp";
231
232  let methods = [
233    InterfaceMethod<
234      "Get reduction vars", "::mlir::SmallVector<::mlir::Value>",
235      "getAllReductionVars", (ins), [{}], [{
236        return $_op.getReductionVars();
237      }]>,
238  ];
239}
240
241def LoopWrapperInterface : OpInterface<"LoopWrapperInterface"> {
242  let description = [{
243    OpenMP operations that wrap a single loop nest. They must only contain a
244    single region with a single block in which there's a single operation and a
245    terminator. That nested operation must be another loop wrapper or an
246    `omp.loop_nest`.
247  }];
248
249  let cppNamespace = "::mlir::omp";
250
251  let methods = [
252    InterfaceMethod<
253      /*description=*/[{
254        If there is another loop wrapper immediately nested inside, return that
255        operation. Assumes this operation is a valid loop wrapper.
256      }],
257      /*retTy=*/"::mlir::omp::LoopWrapperInterface",
258      /*methodName=*/"getNestedWrapper",
259      (ins), [{}], [{
260        Operation *nested = &*$_op->getRegion(0).op_begin();
261        return ::llvm::dyn_cast<LoopWrapperInterface>(nested);
262      }]
263    >,
264    InterfaceMethod<
265      /*description=*/[{
266        Return the loop nest nested directly or indirectly inside of this loop
267        wrapper. Assumes this operation is a valid loop wrapper.
268      }],
269      /*retTy=*/"::mlir::Operation *",
270      /*methodName=*/"getWrappedLoop",
271      (ins), [{}], [{
272        if (LoopWrapperInterface nested = $_op.getNestedWrapper())
273          return nested.getWrappedLoop();
274        return &*$_op->getRegion(0).op_begin();
275      }]
276    >
277  ];
278
279  let extraClassDeclaration = [{
280    /// Interface verifier imlementation.
281    llvm::LogicalResult verifyImpl();
282  }];
283
284  let verify = [{
285    return ::llvm::cast<::mlir::omp::LoopWrapperInterface>($_op).verifyImpl();
286  }];
287  let verifyWithRegions = 1;
288}
289
290def ComposableOpInterface : OpInterface<"ComposableOpInterface"> {
291  let description = [{
292    OpenMP operations that can represent a single leaf of a composite OpenMP
293    construct.
294  }];
295
296  let cppNamespace = "::mlir::omp";
297
298  let methods = [
299    InterfaceMethod<
300      /*description=*/[{
301        Check whether the operation is representing a leaf of a composite OpenMP
302        construct.
303      }],
304      /*retTy=*/"bool",
305      /*methodName=*/"isComposite",
306      (ins ), [{}], [{
307        return $_op->hasAttr("omp.composite");
308      }]
309    >,
310    InterfaceMethod<
311      /*description=*/[{
312        Mark the operation as part of an OpenMP composite construct.
313      }],
314      /*retTy=*/"void",
315      /*methodName=*/"setComposite",
316      (ins "bool":$val), [{}], [{
317        if (val)
318          $_op->setDiscardableAttr("omp.composite", mlir::UnitAttr::get($_op->getContext()));
319        else
320          $_op->removeDiscardableAttr("omp.composite");
321      }]
322    >
323  ];
324}
325
326def DeclareTargetInterface : OpInterface<"DeclareTargetInterface"> {
327  let description = [{
328    OpenMP operations that support declare target have this interface.
329    For example, FuncOp's and llvm.GlobalOp/fir.GlobalOp's. This
330    interface allows simple manipulation and introspection of the
331    declare target attribute that can be applied to these operations.
332  }];
333
334  let cppNamespace = "::mlir::omp";
335
336  let methods = [
337    InterfaceMethod<
338      /*description=*/[{
339        Set the declare target attribute on the current operation with the
340        specified attribute arguments.
341      }],
342      /*retTy=*/"void",
343      /*methodName=*/"setDeclareTarget",
344      (ins "mlir::omp::DeclareTargetDeviceType":$deviceType,
345            "mlir::omp::DeclareTargetCaptureClause":$captureClause), [{}], [{
346        $_op->setAttr("omp.declare_target",
347                  mlir::omp::DeclareTargetAttr::get(
348                      $_op->getContext(),
349                      mlir::omp::DeclareTargetDeviceTypeAttr::get(
350                          $_op->getContext(), deviceType),
351                      mlir::omp::DeclareTargetCaptureClauseAttr::get(
352                          $_op->getContext(), captureClause)));
353      }]>,
354      InterfaceMethod<
355      /*description=*/[{
356        Checks if the declare target attribute has been applied and exists on the
357        current operation. Returns true if it exists on it, otherwise returns
358        false.
359      }],
360      /*retTy=*/"bool",
361      /*methodName=*/"isDeclareTarget",
362      (ins), [{}], [{
363        return $_op->hasAttr("omp.declare_target");
364      }]>,
365      InterfaceMethod<
366      /*description=*/[{
367        Returns the DeclareTargetDeviceType segment of the DeclareTarget attribute if it
368        exists on the current operation. Otherwise it returns null.
369      }],
370      /*retTy=*/"mlir::omp::DeclareTargetDeviceType",
371      /*methodName=*/"getDeclareTargetDeviceType",
372      (ins), [{}], [{
373        if (mlir::Attribute dTar = $_op->getAttr("omp.declare_target"))
374          if (auto dAttr = llvm::dyn_cast_or_null<mlir::omp::DeclareTargetAttr>(dTar))
375            return dAttr.getDeviceType().getValue();
376        return {};
377      }]>,
378      InterfaceMethod<
379      /*description=*/[{
380        Returns the DeclareTargetCaptureClause segment of the DeclareTarget attribute if it
381        exists on the current operation. Otherwise it returns null.
382      }],
383      /*retTy=*/"mlir::omp::DeclareTargetCaptureClause",
384      /*methodName=*/"getDeclareTargetCaptureClause",
385      (ins), [{}], [{
386        if (mlir::Attribute dTar = $_op->getAttr("omp.declare_target"))
387          if (auto dAttr = llvm::dyn_cast_or_null<mlir::omp::DeclareTargetAttr>(dTar))
388            return dAttr.getCaptureClause().getValue();
389        return {};
390      }]>
391  ];
392}
393
394def OffloadModuleInterface : OpInterface<"OffloadModuleInterface"> {
395  let description = [{
396    Operations that represent a module for offloading (host or device)
397    should have this interface.
398  }];
399
400  let cppNamespace = "::mlir::omp";
401
402  let methods = [
403    InterfaceMethod<
404      /*description=*/[{
405      Set the attribute on the current module with the specified boolean
406      argument.
407      }],
408      /*retTy=*/"void",
409      /*methodName=*/"setIsTargetDevice",
410      (ins "bool":$isTargetDevice), [{}], [{
411        $_op->setAttr(
412          mlir::StringAttr::get($_op->getContext(), llvm::Twine{"omp.is_target_device"}),
413            mlir::BoolAttr::get($_op->getContext(), isTargetDevice));
414      }]>,
415    InterfaceMethod<
416      /*description=*/[{
417        Get the attribute on the current module if it exists and
418        return its value, if it doesn't exist it returns false by default.
419      }],
420      /*retTy=*/"bool",
421      /*methodName=*/"getIsTargetDevice",
422      (ins), [{}], [{
423        if (Attribute isTargetDevice = $_op->getAttr("omp.is_target_device"))
424          if (::llvm::isa<mlir::BoolAttr>(isTargetDevice))
425           return ::llvm::dyn_cast<BoolAttr>(isTargetDevice).getValue();
426        return false;
427      }]>,
428    InterfaceMethod<
429      /*description=*/[{
430      Set the attribute on the current module with the specified boolean
431      argument.
432      }],
433      /*retTy=*/"void",
434      /*methodName=*/"setIsGPU",
435      (ins "bool":$isGPU), [{}], [{
436        $_op->setAttr(
437          mlir::StringAttr::get($_op->getContext(), "omp.is_gpu"),
438            mlir::BoolAttr::get($_op->getContext(), isGPU));
439      }]>,
440    InterfaceMethod<
441      /*description=*/[{
442        Get the attribute on the current module if it exists and
443        return its value, if it doesn't exist it returns false by default.
444      }],
445      /*retTy=*/"bool",
446      /*methodName=*/"getIsGPU",
447      (ins), [{}], [{
448        if (Attribute isTargetCGAttr = $_op->getAttr("omp.is_gpu"))
449          if (auto isTargetCGVal = ::llvm::dyn_cast<BoolAttr>(isTargetCGAttr))
450           return isTargetCGVal.getValue();
451        return false;
452      }]>,
453    InterfaceMethod<
454      /*description=*/[{
455        Get the FlagsAttr attribute on the current module if it exists
456        and return the attribute, if it doesn't exit it returns a nullptr
457      }],
458      /*retTy=*/"mlir::omp::FlagsAttr",
459      /*methodName=*/"getFlags",
460      (ins), [{}], [{
461        if (Attribute flags = $_op->getAttr("omp.flags"))
462          return ::llvm::dyn_cast_or_null<mlir::omp::FlagsAttr>(flags);
463        return nullptr;
464      }]>,
465      InterfaceMethod<
466      /*description=*/[{
467        Apply an omp.FlagsAttr to a module with the specified values
468        for the flags
469      }],
470      /*retTy=*/"void",
471      /*methodName=*/"setFlags",
472      (ins "uint32_t":$debugKind,
473            "bool":$assumeTeamsOversubscription,
474            "bool":$assumeThreadsOversubscription,
475            "bool":$assumeNoThreadState,
476            "bool":$assumeNoNestedParallelism,
477            "uint32_t":$openmpDeviceVersion,
478            "bool":$noGPULib), [{}], [{
479        $_op->setAttr(("omp." + mlir::omp::FlagsAttr::getMnemonic()).str(),
480                  mlir::omp::FlagsAttr::get($_op->getContext(), debugKind,
481                      assumeTeamsOversubscription, assumeThreadsOversubscription,
482                      assumeNoThreadState, assumeNoNestedParallelism, noGPULib, openmpDeviceVersion));
483      }]>,
484    InterfaceMethod<
485      /*description=*/[{
486        Set a StringAttr on the current module containing the host IR file path. This
487        file path is used in two-phase compilation during the device phase to generate
488        device side LLVM IR when lowering MLIR.
489      }],
490      /*retTy=*/"void",
491      /*methodName=*/"setHostIRFilePath",
492      (ins "std::string":$hostIRFilePath), [{}], [{
493        $_op->setAttr(
494          mlir::StringAttr::get($_op->getContext(), llvm::Twine{"omp.host_ir_filepath"}),
495            mlir::StringAttr::get($_op->getContext(), hostIRFilePath));
496       }]>,
497    InterfaceMethod<
498      /*description=*/[{
499        Find the host-ir file path StringAttr from the current module if it exists and
500        return its contained value, if it doesn't exist it returns an empty string. This
501        file path is used in two-phase compilation during the device phase to generate
502        device side LLVM IR when lowering MLIR.
503      }],
504      /*retTy=*/"llvm::StringRef",
505      /*methodName=*/"getHostIRFilePath",
506      (ins), [{}], [{
507        if (Attribute filepath = $_op->getAttr("omp.host_ir_filepath"))
508          if (::llvm::isa<mlir::StringAttr>(filepath))
509            return ::llvm::dyn_cast<mlir::StringAttr>(filepath).getValue();
510        return {};
511      }]>,
512    InterfaceMethod<
513      /*description=*/[{
514        Get the omp.requires attribute on the operator if it's present and
515        return its value. If it doesn't exist, return `ClauseRequires::none` by
516        default.
517      }],
518      /*retTy=*/"::mlir::omp::ClauseRequires",
519      /*methodName=*/"getRequires",
520      (ins), [{}], [{
521        if (Attribute requiresAttr = $_op->getAttr("omp.requires"))
522          if (auto requiresVal = ::llvm::dyn_cast<mlir::omp::ClauseRequiresAttr>(requiresAttr))
523            return requiresVal.getValue();
524        return mlir::omp::ClauseRequires::none;
525      }]>,
526    InterfaceMethod<
527      /*description=*/[{
528        Set the omp.requires attribute on the operator to the specified clauses.
529      }],
530      /*retTy=*/"void",
531      /*methodName=*/"setRequires",
532      (ins "::mlir::omp::ClauseRequires":$clauses), [{}], [{
533        $_op->setAttr(mlir::StringAttr::get($_op->getContext(), "omp.requires"),
534          mlir::omp::ClauseRequiresAttr::get($_op->getContext(), clauses));
535      }]>,
536    InterfaceMethod<
537      /*description=*/[{
538        Get the omp.target_triples attribute on the operator if it's present and
539        return its value. If it doesn't exist, return an empty array by default.
540      }],
541      /*retTy=*/"::llvm::ArrayRef<::mlir::Attribute>",
542      /*methodName=*/"getTargetTriples",
543      (ins), [{}], [{
544        if (Attribute triplesAttr = $_op->getAttr("omp.target_triples"))
545          if (auto triples = ::llvm::dyn_cast<::mlir::ArrayAttr>(triplesAttr))
546            return triples.getValue();
547        return {};
548      }]>,
549    InterfaceMethod<
550      /*description=*/[{
551        Set the omp.target_triples attribute on the operation.
552      }],
553      /*retTy=*/"void",
554      /*methodName=*/"setTargetTriples",
555      (ins "::llvm::ArrayRef<::std::string>":$targetTriples), [{}], [{
556        auto names = ::llvm::to_vector(::llvm::map_range(
557            targetTriples, [&](::std::string str) -> ::mlir::Attribute {
558              return mlir::StringAttr::get($_op->getContext(), str);
559            }));
560        $_op->setAttr(
561            ::mlir::StringAttr::get($_op->getContext(), "omp.target_triples"),
562            ::mlir::ArrayAttr::get($_op->getContext(), names));
563      }]>
564  ];
565}
566
567#endif // OPENMP_OPS_INTERFACES
568