@@ -308,7 +308,6 @@ int target_data_begin(DeviceTy &Device, int32_t arg_num, void **args_base,
308
308
// Force the creation of a device side copy of the data when:
309
309
// a close map modifier was associated with a map that contained a to.
310
310
bool HasCloseModifier = arg_types[i] & OMP_TGT_MAPTYPE_CLOSE;
311
- bool HasPresentModifier = arg_types[i] & OMP_TGT_MAPTYPE_PRESENT;
312
311
// UpdateRef is based on MEMBER_OF instead of TARGET_PARAM because if we
313
312
// have reached this point via __tgt_target_data_begin and not __tgt_target
314
313
// then no argument is marked as TARGET_PARAM ("omp target data map" is not
@@ -317,26 +316,13 @@ int target_data_begin(DeviceTy &Device, int32_t arg_num, void **args_base,
317
316
bool UpdateRef = !(arg_types[i] & OMP_TGT_MAPTYPE_MEMBER_OF);
318
317
if (arg_types[i] & OMP_TGT_MAPTYPE_PTR_AND_OBJ) {
319
318
DP (" Has a pointer entry: \n " );
320
- // Base is address of pointer.
321
- //
322
- // Usually, the pointer is already allocated by this time. For example:
323
- //
324
- // #pragma omp target map(s.p[0:N])
325
- //
326
- // The map entry for s comes first, and the PTR_AND_OBJ entry comes
327
- // afterward, so the pointer is already allocated by the time the
328
- // PTR_AND_OBJ entry is handled below, and Pointer_TgtPtrBegin is thus
329
- // non-null. However, "declare target link" can produce a PTR_AND_OBJ
330
- // entry for a global that might not already be allocated by the time the
331
- // PTR_AND_OBJ entry is handled below, and so the allocation might fail
332
- // when HasPresentModifier.
333
- Pointer_TgtPtrBegin = Device.getOrAllocTgtPtr (
334
- HstPtrBase, HstPtrBase, sizeof (void *), Pointer_IsNew, IsHostPtr,
335
- IsImplicit, UpdateRef, HasCloseModifier, HasPresentModifier);
319
+ // base is address of pointer.
320
+ Pointer_TgtPtrBegin = Device.getOrAllocTgtPtr (HstPtrBase, HstPtrBase,
321
+ sizeof (void *), Pointer_IsNew, IsHostPtr, IsImplicit, UpdateRef,
322
+ HasCloseModifier);
336
323
if (!Pointer_TgtPtrBegin) {
337
- DP (" Call to getOrAllocTgtPtr returned null pointer (%s).\n " ,
338
- HasPresentModifier ? " 'present' map type modifier"
339
- : " device failure or illegal mapping" );
324
+ DP (" Call to getOrAllocTgtPtr returned null pointer (device failure or "
325
+ " illegal mapping).\n " );
340
326
return OFFLOAD_FAIL;
341
327
}
342
328
DP (" There are %zu bytes allocated at target address " DPxMOD " - is%s new"
@@ -348,15 +334,13 @@ int target_data_begin(DeviceTy &Device, int32_t arg_num, void **args_base,
348
334
UpdateRef = true ; // subsequently update ref count of pointee
349
335
}
350
336
351
- void *TgtPtrBegin = Device.getOrAllocTgtPtr (
352
- HstPtrBegin, HstPtrBase, data_size, IsNew, IsHostPtr, IsImplicit,
353
- UpdateRef, HasCloseModifier, HasPresentModifier);
354
- // If data_size==0, then the argument could be a zero-length pointer to
355
- // NULL, so getOrAlloc() returning NULL is not an error.
356
- if (!TgtPtrBegin && (data_size || HasPresentModifier)) {
357
- DP (" Call to getOrAllocTgtPtr returned null pointer (%s).\n " ,
358
- HasPresentModifier ? " 'present' map type modifier"
359
- : " device failure or illegal mapping" );
337
+ void *TgtPtrBegin = Device.getOrAllocTgtPtr (HstPtrBegin, HstPtrBase,
338
+ data_size, IsNew, IsHostPtr, IsImplicit, UpdateRef, HasCloseModifier);
339
+ if (!TgtPtrBegin && data_size) {
340
+ // If data_size==0, then the argument could be a zero-length pointer to
341
+ // NULL, so getOrAlloc() returning NULL is not an error.
342
+ DP (" Call to getOrAllocTgtPtr returned null pointer (device failure or "
343
+ " illegal mapping).\n " );
360
344
return OFFLOAD_FAIL;
361
345
}
362
346
DP (" There are %" PRId64 " bytes allocated at target address " DPxMOD
@@ -475,27 +459,13 @@ int target_data_end(DeviceTy &Device, int32_t arg_num, void **args_base,
475
459
(arg_types[i] & OMP_TGT_MAPTYPE_PTR_AND_OBJ);
476
460
bool ForceDelete = arg_types[i] & OMP_TGT_MAPTYPE_DELETE;
477
461
bool HasCloseModifier = arg_types[i] & OMP_TGT_MAPTYPE_CLOSE;
478
- bool HasPresentModifier = arg_types[i] & OMP_TGT_MAPTYPE_PRESENT;
479
462
480
463
// If PTR_AND_OBJ, HstPtrBegin is address of pointee
481
464
void *TgtPtrBegin = Device.getTgtPtrBegin (HstPtrBegin, data_size, IsLast,
482
465
UpdateRef, IsHostPtr);
483
- if (!TgtPtrBegin && (data_size || HasPresentModifier)) {
484
- DP (" Mapping does not exist (%s)\n " ,
485
- (HasPresentModifier ? " 'present' map type modifier" : " ignored" ));
486
- if (HasPresentModifier) {
487
- // FIXME: This should not be an error on exit from "omp target data",
488
- // but it should be an error upon entering an "omp target exit data".
489
- MESSAGE (" device mapping required by 'present' map type modifier does "
490
- " not exist for host address " DPxMOD " (%ld bytes)" ,
491
- DPxPTR (HstPtrBegin), data_size);
492
- return OFFLOAD_FAIL;
493
- }
494
- } else {
495
- DP (" There are %" PRId64 " bytes allocated at target address " DPxMOD
496
- " - is%s last\n " ,
497
- data_size, DPxPTR (TgtPtrBegin), (IsLast ? " " : " not" ));
498
- }
466
+ DP (" There are %" PRId64 " bytes allocated at target address " DPxMOD
467
+ " - is%s last\n " , data_size, DPxPTR (TgtPtrBegin),
468
+ (IsLast ? " " : " not" ));
499
469
500
470
bool DelEntry = IsLast || ForceDelete;
501
471
0 commit comments