@@ -3720,6 +3720,9 @@ static llvm::omp::OpenMPOffloadMappingFlags mapParentWithMembers(
3720
3720
LLVM::ModuleTranslation &moduleTranslation, llvm::IRBuilderBase &builder,
3721
3721
llvm::OpenMPIRBuilder &ompBuilder, DataLayout &dl, MapInfosTy &combinedInfo,
3722
3722
MapInfoData &mapData, uint64_t mapDataIndex, bool isTargetParams) {
3723
+ assert (!ompBuilder.Config .isTargetDevice () &&
3724
+ " function only supported for host device codegen" );
3725
+
3723
3726
// Map the first segment of our structure
3724
3727
combinedInfo.Types .emplace_back (
3725
3728
isTargetParams
@@ -3828,6 +3831,8 @@ static void processMapMembersWithParent(
3828
3831
llvm::OpenMPIRBuilder &ompBuilder, DataLayout &dl, MapInfosTy &combinedInfo,
3829
3832
MapInfoData &mapData, uint64_t mapDataIndex,
3830
3833
llvm::omp::OpenMPOffloadMappingFlags memberOfFlag) {
3834
+ assert (!ompBuilder.Config .isTargetDevice () &&
3835
+ " function only supported for host device codegen" );
3831
3836
3832
3837
auto parentClause =
3833
3838
llvm::cast<omp::MapInfoOp>(mapData.MapClause [mapDataIndex]);
@@ -3941,6 +3946,9 @@ static void processMapWithMembersOf(LLVM::ModuleTranslation &moduleTranslation,
3941
3946
DataLayout &dl, MapInfosTy &combinedInfo,
3942
3947
MapInfoData &mapData, uint64_t mapDataIndex,
3943
3948
bool isTargetParams) {
3949
+ assert (!ompBuilder.Config .isTargetDevice () &&
3950
+ " function only supported for host device codegen" );
3951
+
3944
3952
auto parentClause =
3945
3953
llvm::cast<omp::MapInfoOp>(mapData.MapClause [mapDataIndex]);
3946
3954
@@ -3982,6 +3990,8 @@ static void
3982
3990
createAlteredByCaptureMap (MapInfoData &mapData,
3983
3991
LLVM::ModuleTranslation &moduleTranslation,
3984
3992
llvm::IRBuilderBase &builder) {
3993
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
3994
+ " function only supported for host device codegen" );
3985
3995
for (size_t i = 0 ; i < mapData.MapClause .size (); ++i) {
3986
3996
// if it's declare target, skip it, it's handled separately.
3987
3997
if (!mapData.IsDeclareTarget [i]) {
@@ -4046,6 +4056,9 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
4046
4056
LLVM::ModuleTranslation &moduleTranslation,
4047
4057
DataLayout &dl, MapInfosTy &combinedInfo,
4048
4058
MapInfoData &mapData, bool isTargetParams = false ) {
4059
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4060
+ " function only supported for host device codegen" );
4061
+
4049
4062
// We wish to modify some of the methods in which arguments are
4050
4063
// passed based on their capture type by the target region, this can
4051
4064
// involve generating new loads and stores, which changes the
@@ -4057,8 +4070,7 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
4057
4070
// kernel arg structure. It primarily becomes relevant in cases like
4058
4071
// bycopy, or byref range'd arrays. In the default case, we simply
4059
4072
// pass thee pointer byref as both basePointer and pointer.
4060
- if (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice ())
4061
- createAlteredByCaptureMap (mapData, moduleTranslation, builder);
4073
+ createAlteredByCaptureMap (mapData, moduleTranslation, builder);
4062
4074
4063
4075
llvm::OpenMPIRBuilder *ompBuilder = moduleTranslation.getOpenMPBuilder ();
4064
4076
@@ -4092,6 +4104,8 @@ emitUserDefinedMapper(Operation *declMapperOp, llvm::IRBuilderBase &builder,
4092
4104
static llvm::Expected<llvm::Function *>
4093
4105
getOrCreateUserDefinedMapperFunc (Operation *op, llvm::IRBuilderBase &builder,
4094
4106
LLVM::ModuleTranslation &moduleTranslation) {
4107
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4108
+ " function only supported for host device codegen" );
4095
4109
auto declMapperOp = cast<omp::DeclareMapperOp>(op);
4096
4110
std::string mapperFuncName =
4097
4111
moduleTranslation.getOpenMPBuilder ()->createPlatformSpecificName (
@@ -4108,6 +4122,8 @@ static llvm::Expected<llvm::Function *>
4108
4122
emitUserDefinedMapper (Operation *op, llvm::IRBuilderBase &builder,
4109
4123
LLVM::ModuleTranslation &moduleTranslation,
4110
4124
llvm::StringRef mapperFuncName) {
4125
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4126
+ " function only supported for host device codegen" );
4111
4127
auto declMapperOp = cast<omp::DeclareMapperOp>(op);
4112
4128
auto declMapperInfoOp = declMapperOp.getDeclareMapperInfo ();
4113
4129
DataLayout dl = DataLayout (declMapperOp->getParentOfType <ModuleOp>());
@@ -4597,6 +4613,8 @@ static void
4597
4613
handleDeclareTargetMapVar (MapInfoData &mapData,
4598
4614
LLVM::ModuleTranslation &moduleTranslation,
4599
4615
llvm::IRBuilderBase &builder, llvm::Function *func) {
4616
+ assert (moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4617
+ " function only supported for target device codegen" );
4600
4618
for (size_t i = 0 ; i < mapData.MapClause .size (); ++i) {
4601
4619
// In the case of declare target mapped variables, the basePointer is
4602
4620
// the reference pointer generated by the convertDeclareTargetAttr
@@ -4689,6 +4707,8 @@ createDeviceArgumentAccessor(MapInfoData &mapData, llvm::Argument &arg,
4689
4707
LLVM::ModuleTranslation &moduleTranslation,
4690
4708
llvm::IRBuilderBase::InsertPoint allocaIP,
4691
4709
llvm::IRBuilderBase::InsertPoint codeGenIP) {
4710
+ assert (ompBuilder.Config .isTargetDevice () &&
4711
+ " function only supported for target device codegen" );
4692
4712
builder.restoreIP (allocaIP);
4693
4713
4694
4714
omp::VariableCaptureKind capture = omp::VariableCaptureKind::ByRef;
0 commit comments