MLIR 23.0.0git
HostOpFiltering.cpp File Reference
#include "mlir/Dialect/OpenMP/Transforms/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "mlir/Dialect/OpenMP/Transforms/Passes.h.inc"

Go to the source code of this file.

Classes

class  mlir::omp::impl::HostOpFilteringPassBase< DerivedT >

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::omp
namespace  mlir::omp::impl

Macros

#define GEN_PASS_DEF_HOSTOPFILTERINGPASS
#define GEN_PASS_DECL_HOSTOPFILTERINGPASS
#define GEN_PASS_DECL_MARKDECLARETARGETPASS
#define GEN_PASS_DECL_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS
#define GEN_PASS_DECL_STACKTOSHAREDPASS
#define GEN_PASS_REGISTRATION_HOSTOPFILTERINGPASS
#define GEN_PASS_REGISTRATION_MARKDECLARETARGETPASS
#define GEN_PASS_REGISTRATION_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS
#define GEN_PASS_REGISTRATION_STACKTOSHAREDPASS

Functions

std::unique_ptr<::mlir::Passmlir::omp::createHostOpFilteringPass ()
std::unique_ptr<::mlir::Passmlir::omp::impl::createHostOpFilteringPass ()
std::unique_ptr<::mlir::Passmlir::omp::createMarkDeclareTargetPass ()
std::unique_ptr<::mlir::Passmlir::omp::createPrepareForOMPOffloadPrivatizationPass ()
std::unique_ptr<::mlir::Passmlir::omp::createStackToSharedPass ()
void mlir::omp::registerHostOpFilteringPass ()
void mlir::omp::registerHostOpFilteringPassPass ()
void mlir::omp::registerMarkDeclareTargetPass ()
void mlir::omp::registerMarkDeclareTargetPassPass ()
void mlir::omp::registerPrepareForOMPOffloadPrivatizationPass ()
void mlir::omp::registerPrepareForOMPOffloadPrivatizationPassPass ()
void mlir::omp::registerStackToSharedPass ()
void mlir::omp::registerStackToSharedPassPass ()
void mlir::omp::registerOpenMPPasses ()
static bool keepHostOpInDevice (Operation &op)
 Some host operations, like llvm.mlir.addressof and constants, must remain in the device module because they impact how device code is generated when attached to an omp.target operation.
static void collectRewrite (omp::MapInfoOp mapOp, llvm::SetVector< omp::MapInfoOp > &rewrites)
 Add an omp.map.info operation and all its members recursively to the output set to be later rewritten.
static void collectRewrite (Value value, llvm::SetVector< Value > &rewrites)
 Add the given value to a sorted set if it should be replaced by a placeholder when used as an operand that must remain for the device.
static std::optional< omp::DeclareTargetDeviceType > getDeclareTargetDevice (Operation &op)
 Provide the device_type of an omp.declare_target attribute, if defined.

Macro Definition Documentation

◆ GEN_PASS_DECL_HOSTOPFILTERINGPASS

#define GEN_PASS_DECL_HOSTOPFILTERINGPASS

◆ GEN_PASS_DECL_MARKDECLARETARGETPASS

#define GEN_PASS_DECL_MARKDECLARETARGETPASS

◆ GEN_PASS_DECL_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS

#define GEN_PASS_DECL_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS

◆ GEN_PASS_DECL_STACKTOSHAREDPASS

#define GEN_PASS_DECL_STACKTOSHAREDPASS

◆ GEN_PASS_DEF_HOSTOPFILTERINGPASS

#define GEN_PASS_DEF_HOSTOPFILTERINGPASS

Definition at line 22 of file HostOpFiltering.cpp.

◆ GEN_PASS_REGISTRATION_HOSTOPFILTERINGPASS

#define GEN_PASS_REGISTRATION_HOSTOPFILTERINGPASS

◆ GEN_PASS_REGISTRATION_MARKDECLARETARGETPASS

#define GEN_PASS_REGISTRATION_MARKDECLARETARGETPASS

◆ GEN_PASS_REGISTRATION_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS

#define GEN_PASS_REGISTRATION_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS

◆ GEN_PASS_REGISTRATION_STACKTOSHAREDPASS

#define GEN_PASS_REGISTRATION_STACKTOSHAREDPASS

Function Documentation

◆ collectRewrite() [1/2]

void collectRewrite ( omp::MapInfoOp mapOp,
llvm::SetVector< omp::MapInfoOp > & rewrites )
static

Add an omp.map.info operation and all its members recursively to the output set to be later rewritten.

Dependencies across omp.map.info are maintained by ensuring dependencies are added to the output sets before operations based on them.

Definition at line 47 of file HostOpFiltering.cpp.

Referenced by mlir::omp::impl::HostOpFilteringPassBase< DerivedT >::getPassName().

◆ collectRewrite() [2/2]

void collectRewrite ( Value value,
llvm::SetVector< Value > & rewrites )
static

Add the given value to a sorted set if it should be replaced by a placeholder when used as an operand that must remain for the device.

Values that are block arguments of function operations are skipped, since they will still be available after all rewrites are completed, and operands of operations that need to remain on the host are recursively collected.

Definition at line 61 of file HostOpFiltering.cpp.

◆ getDeclareTargetDevice()

std::optional< omp::DeclareTargetDeviceType > getDeclareTargetDevice ( Operation & op)
static

Provide the device_type of an omp.declare_target attribute, if defined.

Definition at line 79 of file HostOpFiltering.cpp.

◆ keepHostOpInDevice()

bool keepHostOpInDevice ( Operation & op)
static

Some host operations, like llvm.mlir.addressof and constants, must remain in the device module because they impact how device code is generated when attached to an omp.target operation.

This function identifies the operations that need this special handling. This includes cast-style operations to avoid losing information about the original source of an operand.

Definition at line 36 of file HostOpFiltering.cpp.