@@ -128,10 +128,10 @@ void PluginManager::registerLib(__tgt_bin_desc *Desc) {
128
128
PM->RTLsMtx .lock ();
129
129
130
130
// Add in all the OpenMP requirements associated with this binary.
131
- for (__tgt_offload_entry &Entry :
131
+ for (llvm::offloading::EntryTy &Entry :
132
132
llvm::make_range (Desc->HostEntriesBegin , Desc->HostEntriesEnd ))
133
- if (Entry.flags == OMP_REGISTER_REQUIRES)
134
- PM->addRequirements (Entry.data );
133
+ if (Entry.Flags == OMP_REGISTER_REQUIRES)
134
+ PM->addRequirements (Entry.Data );
135
135
136
136
// Extract the exectuable image and extra information if availible.
137
137
for (int32_t i = 0 ; i < Desc->NumDeviceImages ; ++i)
@@ -268,9 +268,9 @@ void PluginManager::unregisterLib(__tgt_bin_desc *Desc) {
268
268
269
269
// Remove entries from PM->HostPtrToTableMap
270
270
PM->TblMapMtx .lock ();
271
- for (__tgt_offload_entry *Cur = Desc->HostEntriesBegin ;
271
+ for (llvm::offloading::EntryTy *Cur = Desc->HostEntriesBegin ;
272
272
Cur < Desc->HostEntriesEnd ; ++Cur) {
273
- PM->HostPtrToTableMap .erase (Cur->addr );
273
+ PM->HostPtrToTableMap .erase (Cur->Address );
274
274
}
275
275
276
276
// Remove translation table for this descriptor.
@@ -336,35 +336,36 @@ static int loadImagesOntoDevice(DeviceTy &Device) {
336
336
}
337
337
338
338
// 3) Create the translation table.
339
- llvm::SmallVector<__tgt_offload_entry > &DeviceEntries =
339
+ llvm::SmallVector<llvm::offloading::EntryTy > &DeviceEntries =
340
340
TransTable->TargetsEntries [DeviceId];
341
- for (__tgt_offload_entry &Entry :
341
+ for (llvm::offloading::EntryTy &Entry :
342
342
llvm::make_range (Img->EntriesBegin , Img->EntriesEnd )) {
343
343
__tgt_device_binary &Binary = *BinaryOrErr;
344
344
345
- __tgt_offload_entry DeviceEntry = Entry;
346
- if (Entry.size ) {
347
- if (Device.RTL ->get_global (Binary, Entry.size , Entry.name ,
348
- &DeviceEntry.addr ) != OFFLOAD_SUCCESS)
349
- REPORT (" Failed to load symbol %s\n " , Entry.name );
345
+ llvm::offloading::EntryTy DeviceEntry = Entry;
346
+ if (Entry.Size ) {
347
+ if (Device.RTL ->get_global (Binary, Entry.Size , Entry.SymbolName ,
348
+ &DeviceEntry.Address ) != OFFLOAD_SUCCESS)
349
+ REPORT (" Failed to load symbol %s\n " , Entry.SymbolName );
350
350
351
351
// If unified memory is active, the corresponding global is a device
352
352
// reference to the host global. We need to initialize the pointer on
353
353
// the device to point to the memory on the host.
354
354
if ((PM->getRequirements () & OMP_REQ_UNIFIED_SHARED_MEMORY) ||
355
355
(PM->getRequirements () & OMPX_REQ_AUTO_ZERO_COPY)) {
356
- if (Device.RTL ->data_submit (DeviceId, DeviceEntry.addr , Entry.addr ,
357
- Entry.size ) != OFFLOAD_SUCCESS)
358
- REPORT (" Failed to write symbol for USM %s\n " , Entry.name );
356
+ if (Device.RTL ->data_submit (DeviceId, DeviceEntry.Address ,
357
+ Entry.Address ,
358
+ Entry.Size ) != OFFLOAD_SUCCESS)
359
+ REPORT (" Failed to write symbol for USM %s\n " , Entry.SymbolName );
359
360
}
360
- } else if (Entry.addr ) {
361
- if (Device.RTL ->get_function (Binary, Entry.name , &DeviceEntry. addr ) !=
362
- OFFLOAD_SUCCESS)
363
- REPORT (" Failed to load kernel %s\n " , Entry.name );
361
+ } else if (Entry.Address ) {
362
+ if (Device.RTL ->get_function (Binary, Entry.SymbolName ,
363
+ &DeviceEntry. Address ) != OFFLOAD_SUCCESS)
364
+ REPORT (" Failed to load kernel %s\n " , Entry.SymbolName );
364
365
}
365
366
DP (" Entry point " DPxMOD " maps to%s %s (" DPxMOD " )\n " ,
366
- DPxPTR (Entry.addr ), (Entry.size ) ? " global" : " " , Entry. name ,
367
- DPxPTR (DeviceEntry.addr ));
367
+ DPxPTR (Entry.Address ), (Entry.Size ) ? " global" : " " ,
368
+ Entry. SymbolName , DPxPTR (DeviceEntry.Address ));
368
369
369
370
DeviceEntries.emplace_back (DeviceEntry);
370
371
}
@@ -396,30 +397,31 @@ static int loadImagesOntoDevice(DeviceTy &Device) {
396
397
Device.getMappingInfo ().HostDataToTargetMap .getExclusiveAccessor ();
397
398
398
399
__tgt_target_table *HostTable = &TransTable->HostTable ;
399
- for (__tgt_offload_entry *CurrDeviceEntry = TargetTable->EntriesBegin ,
400
- *CurrHostEntry = HostTable->EntriesBegin ,
401
- *EntryDeviceEnd = TargetTable->EntriesEnd ;
400
+ for (llvm::offloading::EntryTy *
401
+ CurrDeviceEntry = TargetTable->EntriesBegin ,
402
+ *CurrHostEntry = HostTable->EntriesBegin ,
403
+ *EntryDeviceEnd = TargetTable->EntriesEnd ;
402
404
CurrDeviceEntry != EntryDeviceEnd;
403
405
CurrDeviceEntry++, CurrHostEntry++) {
404
- if (CurrDeviceEntry->size == 0 )
406
+ if (CurrDeviceEntry->Size == 0 )
405
407
continue ;
406
408
407
- assert (CurrDeviceEntry->size == CurrHostEntry->size &&
409
+ assert (CurrDeviceEntry->Size == CurrHostEntry->Size &&
408
410
" data size mismatch" );
409
411
410
412
// Fortran may use multiple weak declarations for the same symbol,
411
413
// therefore we must allow for multiple weak symbols to be loaded from
412
414
// the fat binary. Treat these mappings as any other "regular"
413
415
// mapping. Add entry to map.
414
- if (Device.getMappingInfo ().getTgtPtrBegin (HDTTMap, CurrHostEntry-> addr ,
415
- CurrHostEntry->size ))
416
+ if (Device.getMappingInfo ().getTgtPtrBegin (
417
+ HDTTMap, CurrHostEntry-> Address , CurrHostEntry->Size ))
416
418
continue ;
417
419
418
- void *CurrDeviceEntryAddr = CurrDeviceEntry->addr ;
420
+ void *CurrDeviceEntryAddr = CurrDeviceEntry->Address ;
419
421
420
422
// For indirect mapping, follow the indirection and map the actual
421
423
// target.
422
- if (CurrDeviceEntry->flags & OMP_DECLARE_TARGET_INDIRECT) {
424
+ if (CurrDeviceEntry->Flags & OMP_DECLARE_TARGET_INDIRECT) {
423
425
AsyncInfoTy AsyncInfo (Device);
424
426
void *DevPtr;
425
427
Device.retrieveData (&DevPtr, CurrDeviceEntryAddr, sizeof (void *),
@@ -431,19 +433,21 @@ static int loadImagesOntoDevice(DeviceTy &Device) {
431
433
432
434
DP (" Add mapping from host " DPxMOD " to device " DPxMOD " with size %zu"
433
435
" , name \" %s\"\n " ,
434
- DPxPTR (CurrHostEntry->addr ), DPxPTR (CurrDeviceEntry->addr ),
435
- CurrDeviceEntry->size , CurrDeviceEntry->name );
436
+ DPxPTR (CurrHostEntry->Address ), DPxPTR (CurrDeviceEntry->Address ),
437
+ CurrDeviceEntry->Size , CurrDeviceEntry->SymbolName );
436
438
HDTTMap->emplace (new HostDataToTargetTy (
437
- (uintptr_t )CurrHostEntry->addr /* HstPtrBase*/ ,
438
- (uintptr_t )CurrHostEntry->addr /* HstPtrBegin*/ ,
439
- (uintptr_t )CurrHostEntry->addr + CurrHostEntry->size /* HstPtrEnd*/ ,
439
+ (uintptr_t )CurrHostEntry->Address /* HstPtrBase*/ ,
440
+ (uintptr_t )CurrHostEntry->Address /* HstPtrBegin*/ ,
441
+ (uintptr_t )CurrHostEntry->Address +
442
+ CurrHostEntry->Size /* HstPtrEnd*/ ,
440
443
(uintptr_t )CurrDeviceEntryAddr /* TgtAllocBegin*/ ,
441
444
(uintptr_t )CurrDeviceEntryAddr /* TgtPtrBegin*/ ,
442
- false /* UseHoldRefCount*/ , CurrHostEntry->name ,
445
+ false /* UseHoldRefCount*/ , CurrHostEntry->SymbolName ,
443
446
true /* IsRefCountINF*/ ));
444
447
445
448
// Notify about the new mapping.
446
- if (Device.notifyDataMapped (CurrHostEntry->addr , CurrHostEntry->size ))
449
+ if (Device.notifyDataMapped (CurrHostEntry->Address ,
450
+ CurrHostEntry->Size ))
447
451
return OFFLOAD_FAIL;
448
452
}
449
453
}
0 commit comments