MLIR 22.0.0git
OpenACCUtilsLoop.h
Go to the documentation of this file.
1//===- OpenACCUtilsLoop.h - OpenACC Loop Utilities --------------*- C++ -*-===//
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// Utilities for converting OpenACC loop operations.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_DIALECT_OPENACC_OPENACCUTILSLOOP_H_
14#define MLIR_DIALECT_OPENACC_OPENACCUTILSLOOP_H_
15
16namespace mlir {
17class RewriterBase;
18namespace scf {
19class ForOp;
20class ParallelOp;
21class ExecuteRegionOp;
22} // namespace scf
23namespace acc {
24class LoopOp;
25
26/// Convert a structured acc.loop to scf.for.
27/// The loop arguments are converted to index type. If enableCollapse is true,
28/// nested loops are collapsed into a single loop.
29/// @param loopOp The acc.loop operation to convert (must not be unstructured)
30/// @param rewriter RewriterBase for creating operations
31/// @param enableCollapse Whether to collapse nested loops into one
32/// @return The created scf.for operation or nullptr on creation error.
33/// An InFlightDiagnostic is emitted on creation error.
34scf::ForOp convertACCLoopToSCFFor(LoopOp loopOp, RewriterBase &rewriter,
35 bool enableCollapse);
36
37/// Convert acc.loop to scf.parallel.
38/// The loop induction variables are converted to index types.
39/// @param loopOp The acc.loop operation to convert
40/// @param rewriter RewriterBase for creating and erasing operations
41/// @return The created scf.parallel operation or nullptr on creation error.
42/// An InFlightDiagnostic is emitted on creation error.
43scf::ParallelOp convertACCLoopToSCFParallel(LoopOp loopOp,
44 RewriterBase &rewriter);
45
46/// Convert an unstructured acc.loop to scf.execute_region.
47/// @param loopOp The acc.loop operation to convert (must be unstructured)
48/// @param rewriter RewriterBase for creating and erasing operations
49/// @return The created scf.execute_region operation or nullptr on creation
50/// error. An InFlightDiagnostic is emitted on creation error.
51scf::ExecuteRegionOp
53 RewriterBase &rewriter);
54
55} // namespace acc
56} // namespace mlir
57
58#endif // MLIR_DIALECT_OPENACC_OPENACCUTILSLOOP_H_
This class coordinates the application of a rewrite on a set of IR, providing a way for clients to tr...
scf::ParallelOp convertACCLoopToSCFParallel(LoopOp loopOp, RewriterBase &rewriter)
Convert acc.loop to scf.parallel.
scf::ExecuteRegionOp convertUnstructuredACCLoopToSCFExecuteRegion(LoopOp loopOp, RewriterBase &rewriter)
Convert an unstructured acc.loop to scf.execute_region.
scf::ForOp convertACCLoopToSCFFor(LoopOp loopOp, RewriterBase &rewriter, bool enableCollapse)
Convert a structured acc.loop to scf.for.
Include the generated interface declarations.