|
7 | 7 |
|
8 | 8 | -->
|
9 | 9 |
|
10 |
| -# Introduction to Declare Target |
| 10 | +# OpenMP Declare Target |
| 11 | + |
| 12 | +```{contents} |
| 13 | +--- |
| 14 | +local: |
| 15 | +--- |
| 16 | +``` |
| 17 | + |
| 18 | +## Introduction to Declare Target |
11 | 19 |
|
12 | 20 | In OpenMP `declare target` is a directive that can be applied to a function or
|
13 | 21 | variable (primarily global) to notate to the compiler that it should be
|
@@ -55,7 +63,7 @@ in this case, leave off the `declare target` from the function and it
|
55 | 63 | would be implicitly marked `declare target any` (for both host and device),
|
56 | 64 | as it's been utilised within a target region.
|
57 | 65 |
|
58 |
| -# Declare Target as represented in the OpenMP Dialect |
| 66 | +## Declare Target as represented in the OpenMP Dialect |
59 | 67 |
|
60 | 68 | In the OpenMP Dialect `declare target` is not represented by a specific
|
61 | 69 | `operation`. Instead, it's an OpenMP dialect specific `attribute` that can be
|
@@ -89,7 +97,7 @@ llvm::dyn_cast<mlir::omp::DeclareTargetInterface>(Op.getOperation());
|
89 | 97 | declareTargetGlobal.isDeclareTarget();
|
90 | 98 | ```
|
91 | 99 |
|
92 |
| -# Declare Target Fortran OpenMP Lowering |
| 100 | +## Declare Target Fortran OpenMP Lowering |
93 | 101 |
|
94 | 102 | The initial lowering of `declare target` to MLIR for both use-cases is done
|
95 | 103 | inside of the usual OpenMP lowering in flang/lib/Lower/OpenMP.cpp. However,
|
@@ -145,7 +153,7 @@ to the way `threadprivate` handles these cases, we raise and initialize the
|
145 | 153 | variable as an internal `GlobalOp` and apply the attribute. This occurs in the
|
146 | 154 | flang/lib/Lower/OpenMP.cpp function `genDeclareTargetIntGlobal`.
|
147 | 155 |
|
148 |
| -# Declare Target Transformation Passes for Flang |
| 156 | +## Declare Target Transformation Passes for Flang |
149 | 157 |
|
150 | 158 | There are currently two passes within Flang that are related to the processing
|
151 | 159 | of `declare target`:
|
@@ -173,7 +181,7 @@ While this infrastructure could be generally applicable to more than just Flang,
|
173 | 181 | it is only utilised in the Flang frontend, so it resides there rather than in
|
174 | 182 | the OpenMP dialect codebase.
|
175 | 183 |
|
176 |
| -# Declare Target OpenMP Dialect To LLVM-IR Lowering |
| 184 | +## Declare Target OpenMP Dialect To LLVM-IR Lowering |
177 | 185 |
|
178 | 186 | The OpenMP dialect lowering of `declare target` is done through the
|
179 | 187 | `amendOperation` flow, as it's not an `operation` but rather an
|
@@ -228,7 +236,7 @@ place. It may be possible to store this information in the OMPIRBuilder and
|
228 | 236 | then perform this cleanup process on finalization, but this is open for
|
229 | 237 | discussion and implementation still.
|
230 | 238 |
|
231 |
| -# Current Support |
| 239 | +## Current Support |
232 | 240 |
|
233 | 241 | For the moment, `declare target` should work for:
|
234 | 242 | * Marking functions/subroutines and function/subroutine interfaces for
|
|
0 commit comments