Skip to content

Commit 304b51b

Browse files
committed
[OpenMP][Runtime] remove dead prepareAndSubmitData function from omptarget
prepareAndSubmitData should no longer be used, it should be superceded by performPointerAttachment after recent PR merges upstream, keeping the extra code path around is likely to cause some issues long-term. It wasn't removed in the merges as prepareAndSubmitData is a uniquely downstream thing, we excised what used to be in the if statement into a function at some point and now upstream have basically done the same thing with performPointerAttachment and extended it a bit.
1 parent c5154cb commit 304b51b

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

offload/libomptarget/omptarget.cpp

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -309,38 +309,6 @@ int targetDataMapper(ident_t *Loc, DeviceTy &Device, void *ArgBase, void *Arg,
309309
return Rc;
310310
}
311311

312-
static int prepareAndSubmitData(DeviceTy &Device, void *HstPtrBegin,
313-
void *HstPtrBase, void *LocalTgtPtrBegin,
314-
TargetPointerResultTy &PointerTpr,
315-
void *PointerHstPtrBegin,
316-
void *PointerTgtPtrBegin,
317-
AsyncInfoTy &AsyncInfo) {
318-
uint64_t Delta = (uint64_t)HstPtrBegin - (uint64_t)HstPtrBase;
319-
void *ExpectedTgtPtrBase = (void *)((uint64_t)LocalTgtPtrBegin - Delta);
320-
321-
if (PointerTpr.getEntry()->addShadowPointer(
322-
ShadowPtrInfoTy{(void **)PointerHstPtrBegin,
323-
(void **)PointerTgtPtrBegin, ExpectedTgtPtrBase, sizeof(void*)})) {
324-
DP("USM_SPECIAL: Update pointer (" DPxMOD ") -> [" DPxMOD "]\n",
325-
DPxPTR(PointerTgtPtrBegin), DPxPTR(LocalTgtPtrBegin));
326-
327-
void *&LocalTgtPtrBase = AsyncInfo.getVoidPtrLocation();
328-
LocalTgtPtrBase = ExpectedTgtPtrBase;
329-
330-
int Ret =
331-
Device.submitData(PointerTgtPtrBegin, &LocalTgtPtrBase, sizeof(void *),
332-
AsyncInfo, PointerTpr.getEntry());
333-
if (Ret != OFFLOAD_SUCCESS) {
334-
REPORT("Copying data to device failed.\n");
335-
return OFFLOAD_FAIL;
336-
}
337-
if (PointerTpr.getEntry()->addEventIfNecessary(Device, AsyncInfo) !=
338-
OFFLOAD_SUCCESS)
339-
return OFFLOAD_FAIL;
340-
}
341-
return OFFLOAD_SUCCESS;
342-
}
343-
344312
/// Utility function to perform a pointer attachment operation.
345313
///
346314
/// For something like:
@@ -672,14 +640,7 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
672640
// Perhaps OMP_TGT_MAPTYPE_DESCRIPTOR would help here, not sure.
673641
if ((ArgTypes[I] & OMP_TGT_MAPTYPE_PTR_AND_OBJ) &&
674642
(!IsHostPtr || (PointerTpr.getEntry() != nullptr &&
675-
PointerHstPtrBegin != PointerTgtPtrBegin)))
676-
if (prepareAndSubmitData(Device, HstPtrBegin, HstPtrBase, TgtPtrBegin,
677-
PointerTpr, PointerHstPtrBegin,
678-
PointerTgtPtrBegin,
679-
AsyncInfo) != OFFLOAD_SUCCESS)
680-
return OFFLOAD_FAIL;
681-
682-
if (ArgTypes[I] & OMP_TGT_MAPTYPE_PTR_AND_OBJ && !IsHostPtr) {
643+
PointerHstPtrBegin != PointerTgtPtrBegin))) {
683644
int Ret = performPointerAttachment(
684645
Device, AsyncInfo, reinterpret_cast<void **>(PointerHstPtrBegin),
685646
HstPtrBase, HstPtrBegin,

0 commit comments

Comments
 (0)