@@ -3623,6 +3623,9 @@ static llvm::omp::OpenMPOffloadMappingFlags mapParentWithMembers(
3623
3623
LLVM::ModuleTranslation &moduleTranslation, llvm::IRBuilderBase &builder,
3624
3624
llvm::OpenMPIRBuilder &ompBuilder, DataLayout &dl, MapInfosTy &combinedInfo,
3625
3625
MapInfoData &mapData, uint64_t mapDataIndex, bool isTargetParams) {
3626
+ assert (!ompBuilder.Config .isTargetDevice () &&
3627
+ " function only supported for host device codegen" );
3628
+
3626
3629
// Map the first segment of our structure
3627
3630
combinedInfo.Types .emplace_back (
3628
3631
isTargetParams
@@ -3731,6 +3734,8 @@ static void processMapMembersWithParent(
3731
3734
llvm::OpenMPIRBuilder &ompBuilder, DataLayout &dl, MapInfosTy &combinedInfo,
3732
3735
MapInfoData &mapData, uint64_t mapDataIndex,
3733
3736
llvm::omp::OpenMPOffloadMappingFlags memberOfFlag) {
3737
+ assert (!ompBuilder.Config .isTargetDevice () &&
3738
+ " function only supported for host device codegen" );
3734
3739
3735
3740
auto parentClause =
3736
3741
llvm::cast<omp::MapInfoOp>(mapData.MapClause [mapDataIndex]);
@@ -3844,6 +3849,9 @@ static void processMapWithMembersOf(LLVM::ModuleTranslation &moduleTranslation,
3844
3849
DataLayout &dl, MapInfosTy &combinedInfo,
3845
3850
MapInfoData &mapData, uint64_t mapDataIndex,
3846
3851
bool isTargetParams) {
3852
+ assert (!ompBuilder.Config .isTargetDevice () &&
3853
+ " function only supported for host device codegen" );
3854
+
3847
3855
auto parentClause =
3848
3856
llvm::cast<omp::MapInfoOp>(mapData.MapClause [mapDataIndex]);
3849
3857
@@ -3885,6 +3893,8 @@ static void
3885
3893
createAlteredByCaptureMap (MapInfoData &mapData,
3886
3894
LLVM::ModuleTranslation &moduleTranslation,
3887
3895
llvm::IRBuilderBase &builder) {
3896
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
3897
+ " function only supported for host device codegen" );
3888
3898
for (size_t i = 0 ; i < mapData.MapClause .size (); ++i) {
3889
3899
// if it's declare target, skip it, it's handled separately.
3890
3900
if (!mapData.IsDeclareTarget [i]) {
@@ -3949,6 +3959,9 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
3949
3959
LLVM::ModuleTranslation &moduleTranslation,
3950
3960
DataLayout &dl, MapInfosTy &combinedInfo,
3951
3961
MapInfoData &mapData, bool isTargetParams = false ) {
3962
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
3963
+ " function only supported for host device codegen" );
3964
+
3952
3965
// We wish to modify some of the methods in which arguments are
3953
3966
// passed based on their capture type by the target region, this can
3954
3967
// involve generating new loads and stores, which changes the
@@ -3960,8 +3973,7 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
3960
3973
// kernel arg structure. It primarily becomes relevant in cases like
3961
3974
// bycopy, or byref range'd arrays. In the default case, we simply
3962
3975
// pass thee pointer byref as both basePointer and pointer.
3963
- if (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice ())
3964
- createAlteredByCaptureMap (mapData, moduleTranslation, builder);
3976
+ createAlteredByCaptureMap (mapData, moduleTranslation, builder);
3965
3977
3966
3978
llvm::OpenMPIRBuilder *ompBuilder = moduleTranslation.getOpenMPBuilder ();
3967
3979
@@ -3995,6 +4007,8 @@ emitUserDefinedMapper(Operation *declMapperOp, llvm::IRBuilderBase &builder,
3995
4007
static llvm::Expected<llvm::Function *>
3996
4008
getOrCreateUserDefinedMapperFunc (Operation *op, llvm::IRBuilderBase &builder,
3997
4009
LLVM::ModuleTranslation &moduleTranslation) {
4010
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4011
+ " function only supported for host device codegen" );
3998
4012
auto declMapperOp = cast<omp::DeclareMapperOp>(op);
3999
4013
std::string mapperFuncName =
4000
4014
moduleTranslation.getOpenMPBuilder ()->createPlatformSpecificName (
@@ -4011,6 +4025,8 @@ static llvm::Expected<llvm::Function *>
4011
4025
emitUserDefinedMapper (Operation *op, llvm::IRBuilderBase &builder,
4012
4026
LLVM::ModuleTranslation &moduleTranslation,
4013
4027
llvm::StringRef mapperFuncName) {
4028
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4029
+ " function only supported for host device codegen" );
4014
4030
auto declMapperOp = cast<omp::DeclareMapperOp>(op);
4015
4031
auto declMapperInfoOp = declMapperOp.getDeclareMapperInfo ();
4016
4032
DataLayout dl = DataLayout (declMapperOp->getParentOfType <ModuleOp>());
@@ -4500,6 +4516,8 @@ static void
4500
4516
handleDeclareTargetMapVar (MapInfoData &mapData,
4501
4517
LLVM::ModuleTranslation &moduleTranslation,
4502
4518
llvm::IRBuilderBase &builder, llvm::Function *func) {
4519
+ assert (moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4520
+ " function only supported for target device codegen" );
4503
4521
for (size_t i = 0 ; i < mapData.MapClause .size (); ++i) {
4504
4522
// In the case of declare target mapped variables, the basePointer is
4505
4523
// the reference pointer generated by the convertDeclareTargetAttr
@@ -4592,6 +4610,8 @@ createDeviceArgumentAccessor(MapInfoData &mapData, llvm::Argument &arg,
4592
4610
LLVM::ModuleTranslation &moduleTranslation,
4593
4611
llvm::IRBuilderBase::InsertPoint allocaIP,
4594
4612
llvm::IRBuilderBase::InsertPoint codeGenIP) {
4613
+ assert (ompBuilder.Config .isTargetDevice () &&
4614
+ " function only supported for target device codegen" );
4595
4615
builder.restoreIP (allocaIP);
4596
4616
4597
4617
omp::VariableCaptureKind capture = omp::VariableCaptureKind::ByRef;
0 commit comments