MLIR 22.0.0git
Passes.h
Go to the documentation of this file.
1//===- Passes.h - OpenACC Passes Construction and Registration ------------===//
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//===----------------------------------------------------------------------===//
9#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H
10#define MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H
16#include "mlir/Pass/Pass.h"
17
18namespace mlir {
19
20namespace func {
21class FuncOp;
22} // namespace func
23
24namespace acc {
25
26class OpenACCSupport;
27
28#define GEN_PASS_DECL
29#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc"
30
31//===----------------------------------------------------------------------===//
32// ACCSpecializeForDevice patterns
33//===----------------------------------------------------------------------===//
34
35/// Populates all patterns for device specialization.
36/// In specialized device code (such as specialized acc routine), many ACC
37/// operations do not make sense because they are host-side constructs. This
38/// function adds patterns to remove or transform them.
40
41//===----------------------------------------------------------------------===//
42// ACCSpecializeForHost patterns
43//===----------------------------------------------------------------------===//
44
45/// Populates patterns for converting orphan ACC operations to host.
46/// All patterns check that the operation is NOT inside or associated with a
47/// compute region before converting.
48/// @param enableLoopConversion Whether to convert orphan acc.loop operations.
49void populateACCOrphanToHostPatterns(RewritePatternSet &patterns,
50 OpenACCSupport &accSupport,
51 bool enableLoopConversion = true);
52
53/// Populates all patterns for host fallback path (when `if` clause evaluates
54/// to false). In this mode, ALL ACC operations should be converted or removed.
55/// @param enableLoopConversion Whether to convert orphan acc.loop operations.
56void populateACCHostFallbackPatterns(RewritePatternSet &patterns,
57 OpenACCSupport &accSupport,
58 bool enableLoopConversion = true);
59
60/// Generate the code for registering conversion passes.
61#define GEN_PASS_REGISTRATION
62#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc"
63
64} // namespace acc
65} // namespace mlir
66
67#endif // MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H
void populateACCSpecializeForDevicePatterns(RewritePatternSet &patterns)
Populates all patterns for device specialization.
void populateACCOrphanToHostPatterns(RewritePatternSet &patterns, OpenACCSupport &accSupport, bool enableLoopConversion=true)
Populates patterns for converting orphan ACC operations to host.
void populateACCHostFallbackPatterns(RewritePatternSet &patterns, OpenACCSupport &accSupport, bool enableLoopConversion=true)
Populates all patterns for host fallback path (when if clause evaluates to false).
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns