[OpenMP][NFC] Clang format the libomptarget plugins

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D96445
This commit is contained in:
Johannes Doerfert 2021-02-10 14:16:18 -06:00
parent ad94fce845
commit ea9395716e
2 changed files with 12 additions and 19 deletions

View File

@ -12,8 +12,8 @@
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cstring>
#include <dlfcn.h>
#include <ffi.h>
#include <gelf.h>
@ -93,10 +93,7 @@ public:
return &E.Table;
}
RTLDeviceInfoTy(int32_t num_devices) {
FuncGblEntries.resize(num_devices);
}
RTLDeviceInfoTy(int32_t num_devices) { FuncGblEntries.resize(num_devices); }
~RTLDeviceInfoTy() {
// Close dynamic libraries
@ -230,7 +227,7 @@ __tgt_target_table *__tgt_rtl_load_binary(int32_t device_id,
Elf64_Addr entries_addr = libInfo->l_addr + entries_offset;
DP("Pointer to first entry to be loaded is (" DPxMOD ").\n",
DPxPTR(entries_addr));
DPxPTR(entries_addr));
// Table of pointers to all the entries in the target.
__tgt_offload_entry *entries_table = (__tgt_offload_entry *)entries_addr;
@ -245,7 +242,7 @@ __tgt_target_table *__tgt_rtl_load_binary(int32_t device_id,
}
DP("Entries table range is (" DPxMOD ")->(" DPxMOD ")\n",
DPxPTR(entries_begin), DPxPTR(entries_end));
DPxPTR(entries_begin), DPxPTR(entries_end));
DeviceInfo.createOffloadTable(device_id, entries_begin, entries_end);
elf_end(e);
@ -307,7 +304,7 @@ int32_t __tgt_rtl_run_target_team_region(int32_t device_id, void *tgt_entry_ptr,
DP("Running entry point at " DPxMOD "...\n", DPxPTR(tgt_entry_ptr));
void (*entry)(void);
*((void**) &entry) = tgt_entry_ptr;
*((void **)&entry) = tgt_entry_ptr;
ffi_call(&cif, entry, NULL, &args[0]);
return OFFLOAD_SUCCESS;
}

View File

@ -83,11 +83,8 @@ public:
} else {
DP("Found symbol %s successfully in target image (addr: %p)\n",
SymbolName, reinterpret_cast<void *>(SymbolTargetAddr));
Entry = { reinterpret_cast<void *>(SymbolTargetAddr),
i->name,
i->size,
i->flags,
0 };
Entry = {reinterpret_cast<void *>(SymbolTargetAddr), i->name, i->size,
i->flags, 0};
}
T.push_back(Entry);
@ -178,7 +175,6 @@ static int target_run_function_wait(uint32_t DeviceID, uint64_t FuncAddr,
return OFFLOAD_SUCCESS;
}
// Return the number of available devices of the type supported by the
// target RTL.
int32_t __tgt_rtl_number_of_devices(void) { return DeviceInfo.NodeIds.size(); }
@ -353,8 +349,8 @@ void *__tgt_rtl_data_alloc(int32_t ID, int64_t Size, void *HostPtr) {
DP("Allocate target memory: device=%d, target addr=%p, size=%" PRIu64 "\n",
ID, reinterpret_cast<void *>(addr), Size);
if (ret != 0) {
DP("veo_alloc_mem(%d, %p, %" PRIu64 ") failed with error code %d\n",
ID, reinterpret_cast<void *>(addr), Size, ret);
DP("veo_alloc_mem(%d, %p, %" PRIu64 ") failed with error code %d\n", ID,
reinterpret_cast<void *>(addr), Size, ret);
return NULL;
}
@ -390,7 +386,7 @@ int32_t __tgt_rtl_data_retrieve(int32_t ID, void *HostPtr, void *TargetPtr,
// De-allocate the data referenced by target ptr on the device. In case of
// success, return zero. Otherwise, return an error code.
int32_t __tgt_rtl_data_delete(int32_t ID, void *TargetPtr) {
int ret = veo_free_mem(DeviceInfo.ProcHandles[ID], (uint64_t)TargetPtr);
int ret = veo_free_mem(DeviceInfo.ProcHandles[ID], (uint64_t)TargetPtr);
if (ret != 0) {
DP("veo_free_mem() failed with error code %d\n", ret);
@ -422,8 +418,8 @@ int32_t __tgt_rtl_run_target_team_region(int32_t ID, void *Entry, void **Args,
ret = veo_args_set_u64(TargetArgs, i, (intptr_t)Args[i]);
if (ret != 0) {
DP("veo_args_set_u64() has returned %d for argnum=%d and value %p\n",
ret, i, Args[i]);
DP("veo_args_set_u64() has returned %d for argnum=%d and value %p\n", ret,
i, Args[i]);
return OFFLOAD_FAIL;
}
}