Skip to content

Commit 6a7eff0

Browse files
committed
[OpenMP][Offload][Runtime] Add map types and map behaviour tweaks for descriptor and descriptor base address
This PR seeks to add some new modifications to the OpenMP offload runtime for Fortran descriptor types with the behaviour being flipped on by new map type modifiers OMP_*_DESCRIPTOR and OMP_*_BASE_ADDR. In particular it modifies the runtime to use shared memory for small descriptor allocations where feasible (with the size breakpoint being modifiable). It also tweaks some of the mapping behaviour around shadow pointer map back from device and always mapping for descriptors, in the latter if a descriptor has been marked as always, we skip over the data pointer (first 8-bytes) so as not to overwrite or otherwise modify the pointer, we leave all pointer control to the additional BASE_ADDR mapping. The former makes sure our host pointer address is not null before we map back shadow pointers for base addresses, with the intent to avoid re-allocation of deallocated host data from device data. This can occur when a large allocation of a derived type with multiple allocatable components has been mapped back in pieces and dealloacated, it's possible without these changes for the previously deallocated pieces to be reallocated (or at least the descriptor to be tricked into thinking it's allocated, breaking certain runtime functions around presence checking) by the shadow pointers in map backs of subsequent components. Co-author: Matthew Curtis <[email protected]>
1 parent f8de161 commit 6a7eff0

File tree

9 files changed

+136
-44
lines changed

9 files changed

+136
-44
lines changed

llvm/include/llvm/Frontend/OpenMP/OMPConstants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ enum class OpenMPOffloadMappingFlags : uint64_t {
236236
// dynamic.
237237
// This is an OpenMP extension for the sake of OpenACC support.
238238
OMP_MAP_OMPX_HOLD = 0x2000,
239+
// Mapping is for a descriptor (a.k.a. dope vector)
240+
OMP_MAP_DESCRIPTOR = 0x4000,
241+
// Mapping is for a descriptor's (a.k.a. dope vector) data base address
242+
OMP_MAP_DESCRIPTOR_BASE_ADDR = 0x8000,
239243
/// Signal that the runtime library should use args as an array of
240244
/// descriptor_dim pointers and use args_size as dims. Used when we have
241245
/// non-contiguous list items in target update directive

offload/include/OpenMP/Mapping.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct ShadowPtrInfoTy {
5252
void *HstPtrVal = nullptr;
5353
void **TgtPtrAddr = nullptr;
5454
void *TgtPtrVal = nullptr;
55+
bool IsDescriptorBaseAddr = false;
5556

5657
bool operator==(const ShadowPtrInfoTy &Other) const {
5758
return HstPtrAddr == Other.HstPtrAddr;
@@ -68,6 +69,7 @@ struct HostDataToTargetTy {
6869
const uintptr_t HstPtrBegin;
6970
const uintptr_t HstPtrEnd; // non-inclusive.
7071
const map_var_info_t HstPtrName; // Optional source name of mapped variable.
72+
const int32_t AllocKind;
7173

7274
const uintptr_t TgtAllocBegin; // allocated target memory
7375
const uintptr_t TgtPtrBegin; // mapped target memory = TgtAllocBegin + padding
@@ -124,10 +126,11 @@ struct HostDataToTargetTy {
124126
public:
125127
HostDataToTargetTy(uintptr_t BP, uintptr_t B, uintptr_t E,
126128
uintptr_t TgtAllocBegin, uintptr_t TgtPtrBegin,
127-
bool UseHoldRefCount, map_var_info_t Name = nullptr,
128-
bool IsINF = false)
129+
bool UseHoldRefCount, int32_t AllocKind,
130+
map_var_info_t Name = nullptr, bool IsINF = false)
129131
: HstPtrBase(BP), HstPtrBegin(B), HstPtrEnd(E), HstPtrName(Name),
130-
TgtAllocBegin(TgtAllocBegin), TgtPtrBegin(TgtPtrBegin),
132+
AllocKind(AllocKind), TgtAllocBegin(TgtAllocBegin),
133+
TgtPtrBegin(TgtPtrBegin),
131134
States(std::make_unique<StatesTy>(UseHoldRefCount ? 0
132135
: IsINF ? INFRefCount
133136
: 1,
@@ -479,11 +482,11 @@ struct MappingInfoTy {
479482
/// - Data transfer issue fails.
480483
TargetPointerResultTy getTargetPointer(
481484
HDTTMapAccessorTy &HDTTMap, void *HstPtrBegin, void *HstPtrBase,
482-
int64_t TgtPadding, int64_t Size, map_var_info_t HstPtrName,
483-
bool HasFlagTo, bool HasFlagAlways, bool IsImplicit, bool UpdateRefCount,
484-
bool HasCloseModifier, bool HasPresentModifier, bool HasHoldModifier,
485-
AsyncInfoTy &AsyncInfo, HostDataToTargetTy *OwnedTPR = nullptr,
486-
bool ReleaseHDTTMap = true);
485+
int64_t TgtPadding, int64_t Size, int64_t TypeFlags,
486+
map_var_info_t HstPtrName, bool HasFlagTo, bool HasFlagAlways,
487+
bool IsImplicit, bool UpdateRefCount, bool HasCloseModifier,
488+
bool HasPresentModifier, bool HasHoldModifier, AsyncInfoTy &AsyncInfo,
489+
HostDataToTargetTy *OwnedTPR = nullptr, bool ReleaseHDTTMap = true);
487490

488491
/// Return the target pointer for \p HstPtrBegin in \p HDTTMap. The accessor
489492
/// ensures exclusive access to the HDTT map.

offload/include/omptarget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ enum tgt_map_type {
8080
// the structured region
8181
// This is an OpenMP extension for the sake of OpenACC support.
8282
OMP_TGT_MAPTYPE_OMPX_HOLD = 0x2000,
83+
// mapping is for a descriptor (a.k.a. dope vector)
84+
OMP_TGT_MAPTYPE_DESCRIPTOR = 0x4000,
85+
// Mapping is for a descriptor's (a.k.a. dope vector) data base address
86+
OMP_TGT_MAPTYPE_DESCRIPTOR_BASE_ADDR = 0x8000,
8387
// descriptor for non-contiguous target-update
8488
OMP_TGT_MAPTYPE_NON_CONTIG = 0x100000000000,
8589
// member of struct, member given by [16 MSBs] - 1

offload/libomptarget/OpenMP/Mapping.cpp

Lines changed: 66 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ int MappingInfoTy::associatePtr(void *HstPtrBegin, void *TgtPtrBegin,
7777
/*HstPtrEnd=*/(uintptr_t)HstPtrBegin + Size,
7878
/*TgtAllocBegin=*/(uintptr_t)TgtPtrBegin,
7979
/*TgtPtrBegin=*/(uintptr_t)TgtPtrBegin,
80-
/*UseHoldRefCount=*/false, /*Name=*/nullptr,
80+
/*UseHoldRefCount=*/false, /*AllocKind=*/TARGET_ALLOC_DEFAULT,
81+
/*Name=*/nullptr,
8182
/*IsRefCountINF=*/true))
8283
.first->HDTT;
8384
DP("Creating new map entry: HstBase=" DPxMOD ", HstBegin=" DPxMOD
@@ -199,10 +200,11 @@ LookupResult MappingInfoTy::lookupMapping(HDTTMapAccessorTy &HDTTMap,
199200

200201
TargetPointerResultTy MappingInfoTy::getTargetPointer(
201202
HDTTMapAccessorTy &HDTTMap, void *HstPtrBegin, void *HstPtrBase,
202-
int64_t TgtPadding, int64_t Size, map_var_info_t HstPtrName, bool HasFlagTo,
203-
bool HasFlagAlways, bool IsImplicit, bool UpdateRefCount,
204-
bool HasCloseModifier, bool HasPresentModifier, bool HasHoldModifier,
205-
AsyncInfoTy &AsyncInfo, HostDataToTargetTy *OwnedTPR, bool ReleaseHDTTMap) {
203+
int64_t TgtPadding, int64_t Size, int64_t TypeFlags,
204+
map_var_info_t HstPtrName, bool HasFlagTo, bool HasFlagAlways,
205+
bool IsImplicit, bool UpdateRefCount, bool HasCloseModifier,
206+
bool HasPresentModifier, bool HasHoldModifier, AsyncInfoTy &AsyncInfo,
207+
HostDataToTargetTy *OwnedTPR, bool ReleaseHDTTMap) {
206208

207209
LookupResult LR = lookupMapping(HDTTMap, HstPtrBegin, Size, OwnedTPR);
208210
LR.TPR.Flags.IsPresent = true;
@@ -286,17 +288,28 @@ TargetPointerResultTy MappingInfoTy::getTargetPointer(
286288
} else if (Size) {
287289
// If it is not contained and Size > 0, we should create a new entry for it.
288290
LR.TPR.Flags.IsNewEntry = true;
291+
292+
int32_t AllocKind = TARGET_ALLOC_DEFAULT;
293+
294+
if (TypeFlags == OMP_TGT_MAPTYPE_DESCRIPTOR &&
295+
Device.RTL->use_shared_mem_for_descriptor(Device.DeviceID, Size)) {
296+
AllocKind = TARGET_ALLOC_SHARED;
297+
INFO(OMP_INFOTYPE_MAPPING_CHANGED, Device.DeviceID,
298+
"Using shared memory for descriptor allocation of size=%zu\n", Size);
299+
}
300+
289301
uintptr_t TgtAllocBegin =
290-
(uintptr_t)Device.allocData(TgtPadding + Size, HstPtrBegin);
302+
(uintptr_t)Device.allocData(TgtPadding + Size, HstPtrBegin, AllocKind);
291303
uintptr_t TgtPtrBegin = TgtAllocBegin + TgtPadding;
292304
// Release the mapping table lock only after the entry is locked by
293305
// attaching it to TPR.
294-
LR.TPR.setEntry(HDTTMap
295-
->emplace(new HostDataToTargetTy(
296-
(uintptr_t)HstPtrBase, (uintptr_t)HstPtrBegin,
297-
(uintptr_t)HstPtrBegin + Size, TgtAllocBegin,
298-
TgtPtrBegin, HasHoldModifier, HstPtrName))
299-
.first->HDTT);
306+
LR.TPR.setEntry(
307+
HDTTMap
308+
->emplace(new HostDataToTargetTy(
309+
(uintptr_t)HstPtrBase, (uintptr_t)HstPtrBegin,
310+
(uintptr_t)HstPtrBegin + Size, TgtAllocBegin, TgtPtrBegin,
311+
HasHoldModifier, AllocKind, HstPtrName))
312+
.first->HDTT);
300313
INFO(OMP_INFOTYPE_MAPPING_CHANGED, Device.DeviceID,
301314
"Creating new map entry with HstPtrBase=" DPxMOD
302315
", HstPtrBegin=" DPxMOD ", TgtAllocBegin=" DPxMOD
@@ -326,20 +339,47 @@ TargetPointerResultTy MappingInfoTy::getTargetPointer(
326339
// data transfer.
327340
if (LR.TPR.TargetPointer && !LR.TPR.Flags.IsHostPointer && HasFlagTo &&
328341
(LR.TPR.Flags.IsNewEntry || HasFlagAlways) && Size != 0) {
329-
DP("Moving %" PRId64 " bytes (hst:" DPxMOD ") -> (tgt:" DPxMOD ")\n", Size,
330-
DPxPTR(HstPtrBegin), DPxPTR(LR.TPR.TargetPointer));
331-
332-
int Ret = Device.submitData(LR.TPR.TargetPointer, HstPtrBegin, Size,
333-
AsyncInfo, LR.TPR.getEntry());
334-
if (Ret != OFFLOAD_SUCCESS) {
335-
REPORT("Copying data to device failed.\n");
336-
// We will also return nullptr if the data movement fails because that
337-
// pointer points to a corrupted memory region so it doesn't make any
338-
// sense to continue to use it.
339-
LR.TPR.TargetPointer = nullptr;
340-
} else if (LR.TPR.getEntry()->addEventIfNecessary(Device, AsyncInfo) !=
341-
OFFLOAD_SUCCESS)
342-
return TargetPointerResultTy{};
342+
if (LR.TPR.Flags.IsNewEntry ||
343+
LR.TPR.getEntry()->AllocKind != TARGET_ALLOC_SHARED) {
344+
DP("Moving %" PRId64 " bytes (hst:" DPxMOD ") -> (tgt:" DPxMOD ")\n",
345+
Size, DPxPTR(HstPtrBegin), DPxPTR(LR.TPR.TargetPointer));
346+
347+
// If we are mapping a descriptor/dope vector, we map it with always as
348+
// this information should always be up-to-date. Another issue is that
349+
// due to an edge-case with declare target preventing this information
350+
// being initialized on device we have force initialize it with always.
351+
// However, in these cases to prevent overwriting of the data pointer
352+
// breaking any pointer <-> data attachment that previous mappings may
353+
// have established, we skip over the data pointer stored in the dope
354+
// vector/descriptor, a subsequent seperate mapping of the pointer and
355+
// data by the compiler should correctly establish any required data
356+
// mappings, the descriptor mapping primarily just populates the relevant
357+
// descriptor data fields that the fortran runtime depends on for bounds
358+
// calculation and other relating things. The pointer is always in the
359+
// same place, the first field of the descriptor structure, so we skip
360+
// it by offsetting by 8-bytes. On architectures with more varied pointer
361+
// sizes this may need further thought, but so would a lot of the data
362+
// mapping I imagine if host/device pointers are mismatched sizes.
363+
if ((TypeFlags & OMP_TGT_MAPTYPE_DESCRIPTOR) && HasFlagAlways) {
364+
uintptr_t DescDataPtrOffset = 8;
365+
HstPtrBegin = (void *)((uintptr_t)HstPtrBegin + DescDataPtrOffset);
366+
LR.TPR.TargetPointer =
367+
(void *)((uintptr_t)LR.TPR.TargetPointer + DescDataPtrOffset);
368+
Size = Size - DescDataPtrOffset;
369+
}
370+
371+
int Ret = Device.submitData(LR.TPR.TargetPointer, HstPtrBegin, Size,
372+
AsyncInfo, LR.TPR.getEntry());
373+
if (Ret != OFFLOAD_SUCCESS) {
374+
REPORT("Copying data to device failed.\n");
375+
// We will also return nullptr if the data movement fails because that
376+
// pointer points to a corrupted memory region so it doesn't make any
377+
// sense to continue to use it.
378+
LR.TPR.TargetPointer = nullptr;
379+
} else if (LR.TPR.getEntry()->addEventIfNecessary(Device, AsyncInfo) !=
380+
OFFLOAD_SUCCESS)
381+
return TargetPointerResultTy{};
382+
}
343383
} else {
344384
// If not a host pointer and no present modifier, we need to wait for the
345385
// event if it exists.

offload/libomptarget/PluginManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ static int loadImagesOntoDevice(DeviceTy &Device) {
497497
CurrHostEntry->Size /*HstPtrEnd*/,
498498
(uintptr_t)CurrDeviceEntryAddr /*TgtAllocBegin*/,
499499
(uintptr_t)CurrDeviceEntryAddr /*TgtPtrBegin*/,
500-
false /*UseHoldRefCount*/, CurrHostEntry->SymbolName,
501-
true /*IsRefCountINF*/));
500+
false /*UseHoldRefCount*/, TARGET_ALLOC_DEFAULT /*AllocKind*/,
501+
CurrHostEntry->SymbolName, true /*IsRefCountINF*/));
502502

503503
// Notify about the new mapping.
504504
if (Device.notifyDataMapped(CurrHostEntry->Address,

offload/libomptarget/omptarget.cpp

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
422422
// when HasPresentModifier.
423423
PointerTpr = Device.getMappingInfo().getTargetPointer(
424424
HDTTMap, HstPtrBase, HstPtrBase, /*TgtPadding=*/0, sizeof(void *),
425-
/*HstPtrName=*/nullptr,
425+
ArgTypes[I], /*HstPtrName=*/nullptr,
426426
/*HasFlagTo=*/false, /*HasFlagAlways=*/false, IsImplicit, UpdateRef,
427427
HasCloseModifier, HasPresentModifier, HasHoldModifier, AsyncInfo,
428428
/*OwnedTPR=*/nullptr, /*ReleaseHDTTMap=*/false);
@@ -451,9 +451,10 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
451451
const bool HasFlagAlways = ArgTypes[I] & OMP_TGT_MAPTYPE_ALWAYS;
452452
// Note that HDTTMap will be released in getTargetPointer.
453453
auto TPR = Device.getMappingInfo().getTargetPointer(
454-
HDTTMap, HstPtrBegin, HstPtrBase, TgtPadding, DataSize, HstPtrName,
455-
HasFlagTo, HasFlagAlways, IsImplicit, UpdateRef, HasCloseModifier,
456-
HasPresentModifier, HasHoldModifier, AsyncInfo, PointerTpr.getEntry());
454+
HDTTMap, HstPtrBegin, HstPtrBase, TgtPadding, DataSize, ArgTypes[I],
455+
HstPtrName, HasFlagTo, HasFlagAlways, IsImplicit, UpdateRef,
456+
HasCloseModifier, HasPresentModifier, HasHoldModifier, AsyncInfo,
457+
PointerTpr.getEntry());
457458
void *TgtPtrBegin = TPR.TargetPointer;
458459
IsHostPtr = TPR.Flags.IsHostPointer;
459460
// If data_size==0, then the argument could be a zero-length pointer to
@@ -482,7 +483,9 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
482483

483484
if (PointerTpr.getEntry()->addShadowPointer(ShadowPtrInfoTy{
484485
(void **)PointerHstPtrBegin, HstPtrBase,
485-
(void **)PointerTgtPtrBegin, ExpectedTgtPtrBase})) {
486+
(void **)PointerTgtPtrBegin, ExpectedTgtPtrBase,
487+
static_cast<bool>(ArgTypes[I] &
488+
OMP_TGT_MAPTYPE_DESCRIPTOR_BASE_ADDR)})) {
486489
DP("Update pointer (" DPxMOD ") -> [" DPxMOD "]\n",
487490
DPxPTR(PointerTgtPtrBegin), DPxPTR(TgtPtrBegin));
488491

@@ -591,6 +594,12 @@ postProcessingTargetDataEnd(DeviceTy *Device,
591594
const bool HasFrom = ArgType & OMP_TGT_MAPTYPE_FROM;
592595
if (HasFrom) {
593596
Entry->foreachShadowPointerInfo([&](const ShadowPtrInfoTy &ShadowPtr) {
597+
// For Fortran descriptors/dope vectors, it is possible, we have
598+
// deallocated the data on host and the descriptor persists as it is
599+
// a separate entity, and we do not want to map back the data to host
600+
// in these cases when releasing the dope vector.
601+
if (*ShadowPtr.HstPtrAddr == nullptr && ShadowPtr.IsDescriptorBaseAddr)
602+
return OFFLOAD_SUCCESS;
594603
*ShadowPtr.HstPtrAddr = ShadowPtr.HstPtrVal;
595604
DP("Restoring original host pointer value " DPxMOD " for host "
596605
"pointer " DPxMOD "\n",
@@ -833,6 +842,13 @@ static int targetDataContiguous(ident_t *Loc, DeviceTy &Device, void *ArgsBase,
833842
AsyncInfo.addPostProcessingFunction([=]() -> int {
834843
int Ret = Entry->foreachShadowPointerInfo(
835844
[&](const ShadowPtrInfoTy &ShadowPtr) {
845+
// For Fortran descriptors/dope vectors, it is possible, we have
846+
// deallocated the data on host and the descriptor persists as it
847+
// is a separate entity, and we do not want to map back the data
848+
// to host in these cases when releasing the dope vector.
849+
if (*ShadowPtr.HstPtrAddr == nullptr &&
850+
ShadowPtr.IsDescriptorBaseAddr)
851+
return OFFLOAD_SUCCESS;
836852
*ShadowPtr.HstPtrAddr = ShadowPtr.HstPtrVal;
837853
DP("Restoring original host pointer value " DPxMOD
838854
" for host pointer " DPxMOD "\n",

offload/plugins-nextgen/amdgpu/src/rtl.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,9 +1906,11 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
19061906
OMPX_StreamBusyWait("LIBOMPTARGET_AMDGPU_STREAM_BUSYWAIT", 2000000),
19071907
OMPX_UseMultipleSdmaEngines(
19081908
"LIBOMPTARGET_AMDGPU_USE_MULTIPLE_SDMA_ENGINES", false),
1909-
OMPX_ApuMaps("OMPX_APU_MAPS", false), AMDGPUStreamManager(*this, Agent),
1910-
AMDGPUEventManager(*this), AMDGPUSignalManager(*this), Agent(Agent),
1911-
HostDevice(HostDevice) {}
1909+
OMPX_ApuMaps("OMPX_APU_MAPS", false),
1910+
OMPX_SharedDescriptorMaxSize("LIBOMPTARGET_SHARED_DESCRIPTOR_MAX_SIZE",
1911+
96),
1912+
AMDGPUStreamManager(*this, Agent), AMDGPUEventManager(*this),
1913+
AMDGPUSignalManager(*this), Agent(Agent), HostDevice(HostDevice) {}
19121914

19131915
~AMDGPUDeviceTy() {}
19141916

@@ -2813,6 +2815,10 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
28132815

28142816
bool useMultipleSdmaEngines() const { return OMPX_UseMultipleSdmaEngines; }
28152817

2818+
bool useSharedMemForDescriptor(int64_t Size) override {
2819+
return Size <= OMPX_SharedDescriptorMaxSize;
2820+
}
2821+
28162822
private:
28172823
using AMDGPUEventRef = AMDGPUResourceRef<AMDGPUEventTy>;
28182824
using AMDGPUEventManagerTy = GenericDeviceResourceManagerTy<AMDGPUEventRef>;
@@ -2911,6 +2917,10 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
29112917
/// automatic zero-copy behavior on non-APU GPUs.
29122918
BoolEnvar OMPX_ApuMaps;
29132919

2920+
/// Descriptors of size <= to this value will be allocated using shared
2921+
/// memory. Default value is 48.
2922+
UInt32Envar OMPX_SharedDescriptorMaxSize;
2923+
29142924
/// Stream manager for AMDGPU streams.
29152925
AMDGPUStreamManagerTy AMDGPUStreamManager;
29162926

offload/plugins-nextgen/common/include/PluginInterface.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,10 @@ struct GenericDeviceTy : public DeviceAllocatorTy {
942942
/// Allocate and construct a kernel object.
943943
virtual Expected<GenericKernelTy &> constructKernel(const char *Name) = 0;
944944

945+
/// Return true if a descriptor of size 'Size' should be allocated using
946+
/// shared memory. Default implementation returns 'false',
947+
virtual bool useSharedMemForDescriptor(int64_t Size);
948+
945949
/// Reference to the underlying plugin that created this device.
946950
GenericPluginTy &Plugin;
947951

@@ -1344,6 +1348,10 @@ struct GenericPluginTy {
13441348
int32_t get_function(__tgt_device_binary Binary, const char *Name,
13451349
void **KernelPtr);
13461350

1351+
/// Return true if a descriptor of size 'Size' should be allocated using
1352+
/// shared memory.
1353+
bool use_shared_mem_for_descriptor(int32_t DeviceId, int64_t Size);
1354+
13471355
private:
13481356
/// Indicates if the platform runtime has been fully initialized.
13491357
bool Initialized = false;

offload/plugins-nextgen/common/src/PluginInterface.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,8 @@ Error GenericDeviceTy::syncEvent(void *EventPtr) {
15971597

15981598
bool GenericDeviceTy::useAutoZeroCopy() { return useAutoZeroCopyImpl(); }
15991599

1600+
bool GenericDeviceTy::useSharedMemForDescriptor(int64_t Size) { return false; }
1601+
16001602
Error GenericPluginTy::init() {
16011603
if (Initialized)
16021604
return Plugin::success();
@@ -2199,3 +2201,8 @@ int32_t GenericPluginTy::get_function(__tgt_device_binary Binary,
21992201
*KernelPtr = &Kernel;
22002202
return OFFLOAD_SUCCESS;
22012203
}
2204+
2205+
bool GenericPluginTy::use_shared_mem_for_descriptor(int32_t DeviceId,
2206+
int64_t Size) {
2207+
return getDevice(DeviceId).useSharedMemForDescriptor(Size);
2208+
}

0 commit comments

Comments
 (0)