Skip to content

Commit bccb227

Browse files
committed
Revert "[flang][NFC] Move OpenMP related passes into a separate directory (#104732)"
This reverts commit 87eeed1.
1 parent 68e21e1 commit bccb227

19 files changed

+63
-153
lines changed

flang/docs/OpenMP-declare-target.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,15 @@ flang/lib/Lower/OpenMP.cpp function `genDeclareTargetIntGlobal`.
149149

150150
There are currently two passes within Flang that are related to the processing
151151
of `declare target`:
152-
* `MarkDeclareTarget` - This pass is in charge of marking functions captured
152+
* `OMPMarkDeclareTarget` - This pass is in charge of marking functions captured
153153
(called from) in `target` regions or other `declare target` marked functions as
154154
`declare target`. It does so recursively, i.e. nested calls will also be
155155
implicitly marked. It currently will try to mark things as conservatively as
156156
possible, e.g. if captured in a `target` region it will apply `nohost`, unless
157157
it encounters a `host` `declare target` in which case it will apply the `any`
158158
device type. Functions are handled similarly, except we utilise the parent's
159159
device type where possible.
160-
* `FunctionFiltering` - This is executed after the `MarkDeclareTarget`
160+
* `OMPFunctionFiltering` - This is executed after the `OMPMarkDeclareTarget`
161161
pass, and its job is to conservatively remove host functions from
162162
the module where possible when compiling for the device. This helps make
163163
sure that most incompatible code for the host is not lowered for the

flang/docs/OpenMP-descriptor-management.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Currently, Flang will lower these descriptor types in the OpenMP lowering (lower
4444
to all other map types, generating an omp.MapInfoOp containing relevant information required for lowering
4545
the OpenMP dialect to LLVM-IR during the final stages of the MLIR lowering. However, after
4646
the lowering to FIR/HLFIR has been performed an OpenMP dialect specific pass for Fortran,
47-
`MapInfoFinalizationPass` (Optimizer/OpenMP/MapInfoFinalization.cpp) will expand the
47+
`OMPMapInfoFinalizationPass` (Optimizer/OMPMapInfoFinalization.cpp) will expand the
4848
`omp.MapInfoOp`'s containing descriptors (which currently will be a `BoxType` or `BoxAddrOp`) into multiple
4949
mappings, with one extra per pointer member in the descriptor that is supported on top of the original
5050
descriptor map operation. These pointers members are linked to the parent descriptor by adding them to
@@ -53,7 +53,7 @@ owning operation's (`omp.TargetOp`, `omp.TargetDataOp` etc.) map operand list an
5353
operation is `IsolatedFromAbove`, it also inserts them as `BlockArgs` to canonicalize the mappings and
5454
simplify lowering.
5555
56-
An example transformation by the `MapInfoFinalizationPass`:
56+
An example transformation by the `OMPMapInfoFinalizationPass`:
5757
5858
```
5959

flang/include/flang/Optimizer/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ add_subdirectory(CodeGen)
22
add_subdirectory(Dialect)
33
add_subdirectory(HLFIR)
44
add_subdirectory(Transforms)
5-
add_subdirectory(OpenMP)

flang/include/flang/Optimizer/OpenMP/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

flang/include/flang/Optimizer/OpenMP/Passes.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

flang/include/flang/Optimizer/OpenMP/Passes.td

Lines changed: 0 additions & 40 deletions
This file was deleted.

flang/include/flang/Optimizer/Transforms/Passes.td

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,32 @@ def LoopVersioning : Pass<"loop-versioning", "mlir::func::FuncOp"> {
340340
let dependentDialects = [ "fir::FIROpsDialect" ];
341341
}
342342

343+
def OMPMapInfoFinalizationPass
344+
: Pass<"omp-map-info-finalization"> {
345+
let summary = "expands OpenMP MapInfo operations containing descriptors";
346+
let description = [{
347+
Expands MapInfo operations containing descriptor types into multiple
348+
MapInfo's for each pointer element in the descriptor that requires
349+
explicit individual mapping by the OpenMP runtime.
350+
}];
351+
let dependentDialects = ["mlir::omp::OpenMPDialect"];
352+
}
353+
354+
def OMPMarkDeclareTargetPass
355+
: Pass<"omp-mark-declare-target", "mlir::ModuleOp"> {
356+
let summary = "Marks all functions called by an OpenMP declare target function as declare target";
357+
let dependentDialects = ["mlir::omp::OpenMPDialect"];
358+
}
359+
360+
def OMPFunctionFiltering : Pass<"omp-function-filtering"> {
361+
let summary = "Filters out functions intended for the host when compiling "
362+
"for the target device.";
363+
let dependentDialects = [
364+
"mlir::func::FuncDialect",
365+
"fir::FIROpsDialect"
366+
];
367+
}
368+
343369
def VScaleAttr : Pass<"vscale-attr", "mlir::func::FuncOp"> {
344370
let summary = "Add vscale_range attribute to functions";
345371
let description = [{

flang/include/flang/Tools/CLOptions.inc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "mlir/Transforms/Passes.h"
1818
#include "flang/Optimizer/CodeGen/CodeGen.h"
1919
#include "flang/Optimizer/HLFIR/Passes.h"
20-
#include "flang/Optimizer/OpenMP/Passes.h"
2120
#include "flang/Optimizer/Transforms/Passes.h"
2221
#include "llvm/Passes/OptimizationLevel.h"
2322
#include "llvm/Support/CommandLine.h"
@@ -359,10 +358,10 @@ inline void createHLFIRToFIRPassPipeline(
359358
inline void createOpenMPFIRPassPipeline(
360359
mlir::PassManager &pm, bool isTargetDevice) {
361360
addNestedPassToAllTopLevelOperations(
362-
pm, flangomp::createMapInfoFinalizationPass);
363-
pm.addPass(flangomp::createMarkDeclareTargetPass());
361+
pm, fir::createOMPMapInfoFinalizationPass);
362+
pm.addPass(fir::createOMPMarkDeclareTargetPass());
364363
if (isTargetDevice)
365-
pm.addPass(flangomp::createFunctionFiltering());
364+
pm.addPass(fir::createOMPFunctionFiltering());
366365
}
367366

368367
#if !defined(FLANG_EXCLUDE_CODEGEN)

flang/lib/Frontend/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ add_flang_library(flangFrontend
3838
FIRTransforms
3939
HLFIRDialect
4040
HLFIRTransforms
41-
FlangOpenMPTransforms
4241
MLIRTransforms
4342
MLIRBuiltinToLLVMIRTranslation
4443
MLIRLLVMToLLVMIRTranslation

flang/lib/Optimizer/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ add_subdirectory(HLFIR)
55
add_subdirectory(Support)
66
add_subdirectory(Transforms)
77
add_subdirectory(Analysis)
8-
add_subdirectory(OpenMP)

0 commit comments

Comments
 (0)