@@ -3563,6 +3563,9 @@ static llvm::omp::OpenMPOffloadMappingFlags mapParentWithMembers(
3563
3563
LLVM::ModuleTranslation &moduleTranslation, llvm::IRBuilderBase &builder,
3564
3564
llvm::OpenMPIRBuilder &ompBuilder, DataLayout &dl, MapInfosTy &combinedInfo,
3565
3565
MapInfoData &mapData, uint64_t mapDataIndex, bool isTargetParams) {
3566
+ assert (!ompBuilder.Config .isTargetDevice () &&
3567
+ " function only supported for host device codegen" );
3568
+
3566
3569
// Map the first segment of our structure
3567
3570
combinedInfo.Types .emplace_back (
3568
3571
isTargetParams
@@ -3671,6 +3674,8 @@ static void processMapMembersWithParent(
3671
3674
llvm::OpenMPIRBuilder &ompBuilder, DataLayout &dl, MapInfosTy &combinedInfo,
3672
3675
MapInfoData &mapData, uint64_t mapDataIndex,
3673
3676
llvm::omp::OpenMPOffloadMappingFlags memberOfFlag) {
3677
+ assert (!ompBuilder.Config .isTargetDevice () &&
3678
+ " function only supported for host device codegen" );
3674
3679
3675
3680
auto parentClause =
3676
3681
llvm::cast<omp::MapInfoOp>(mapData.MapClause [mapDataIndex]);
@@ -3784,6 +3789,9 @@ static void processMapWithMembersOf(LLVM::ModuleTranslation &moduleTranslation,
3784
3789
DataLayout &dl, MapInfosTy &combinedInfo,
3785
3790
MapInfoData &mapData, uint64_t mapDataIndex,
3786
3791
bool isTargetParams) {
3792
+ assert (!ompBuilder.Config .isTargetDevice () &&
3793
+ " function only supported for host device codegen" );
3794
+
3787
3795
auto parentClause =
3788
3796
llvm::cast<omp::MapInfoOp>(mapData.MapClause [mapDataIndex]);
3789
3797
@@ -3825,6 +3833,8 @@ static void
3825
3833
createAlteredByCaptureMap (MapInfoData &mapData,
3826
3834
LLVM::ModuleTranslation &moduleTranslation,
3827
3835
llvm::IRBuilderBase &builder) {
3836
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
3837
+ " function only supported for host device codegen" );
3828
3838
for (size_t i = 0 ; i < mapData.MapClause .size (); ++i) {
3829
3839
// if it's declare target, skip it, it's handled separately.
3830
3840
if (!mapData.IsDeclareTarget [i]) {
@@ -3889,6 +3899,9 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
3889
3899
LLVM::ModuleTranslation &moduleTranslation,
3890
3900
DataLayout &dl, MapInfosTy &combinedInfo,
3891
3901
MapInfoData &mapData, bool isTargetParams = false ) {
3902
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
3903
+ " function only supported for host device codegen" );
3904
+
3892
3905
// We wish to modify some of the methods in which arguments are
3893
3906
// passed based on their capture type by the target region, this can
3894
3907
// involve generating new loads and stores, which changes the
@@ -3900,8 +3913,7 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
3900
3913
// kernel arg structure. It primarily becomes relevant in cases like
3901
3914
// bycopy, or byref range'd arrays. In the default case, we simply
3902
3915
// pass thee pointer byref as both basePointer and pointer.
3903
- if (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice ())
3904
- createAlteredByCaptureMap (mapData, moduleTranslation, builder);
3916
+ createAlteredByCaptureMap (mapData, moduleTranslation, builder);
3905
3917
3906
3918
llvm::OpenMPIRBuilder *ompBuilder = moduleTranslation.getOpenMPBuilder ();
3907
3919
@@ -3935,6 +3947,8 @@ emitUserDefinedMapper(Operation *declMapperOp, llvm::IRBuilderBase &builder,
3935
3947
static llvm::Expected<llvm::Function *>
3936
3948
getOrCreateUserDefinedMapperFunc (Operation *op, llvm::IRBuilderBase &builder,
3937
3949
LLVM::ModuleTranslation &moduleTranslation) {
3950
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
3951
+ " function only supported for host device codegen" );
3938
3952
auto declMapperOp = cast<omp::DeclareMapperOp>(op);
3939
3953
std::string mapperFuncName =
3940
3954
moduleTranslation.getOpenMPBuilder ()->createPlatformSpecificName (
@@ -3951,6 +3965,8 @@ static llvm::Expected<llvm::Function *>
3951
3965
emitUserDefinedMapper (Operation *op, llvm::IRBuilderBase &builder,
3952
3966
LLVM::ModuleTranslation &moduleTranslation,
3953
3967
llvm::StringRef mapperFuncName) {
3968
+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
3969
+ " function only supported for host device codegen" );
3954
3970
auto declMapperOp = cast<omp::DeclareMapperOp>(op);
3955
3971
auto declMapperInfoOp = declMapperOp.getDeclareMapperInfo ();
3956
3972
DataLayout dl = DataLayout (declMapperOp->getParentOfType <ModuleOp>());
@@ -4440,6 +4456,8 @@ static void
4440
4456
handleDeclareTargetMapVar (MapInfoData &mapData,
4441
4457
LLVM::ModuleTranslation &moduleTranslation,
4442
4458
llvm::IRBuilderBase &builder, llvm::Function *func) {
4459
+ assert (moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4460
+ " function only supported for target device codegen" );
4443
4461
for (size_t i = 0 ; i < mapData.MapClause .size (); ++i) {
4444
4462
// In the case of declare target mapped variables, the basePointer is
4445
4463
// the reference pointer generated by the convertDeclareTargetAttr
@@ -4532,6 +4550,8 @@ createDeviceArgumentAccessor(MapInfoData &mapData, llvm::Argument &arg,
4532
4550
LLVM::ModuleTranslation &moduleTranslation,
4533
4551
llvm::IRBuilderBase::InsertPoint allocaIP,
4534
4552
llvm::IRBuilderBase::InsertPoint codeGenIP) {
4553
+ assert (ompBuilder.Config .isTargetDevice () &&
4554
+ " function only supported for target device codegen" );
4535
4555
builder.restoreIP (allocaIP);
4536
4556
4537
4557
omp::VariableCaptureKind capture = omp::VariableCaptureKind::ByRef;
0 commit comments