Skip to content

Commit ea93957

Browse files
committed
[OpenMP][NFC] Clang format the libomptarget plugins
Reviewed By: tianshilei1992 Differential Revision: https://reviews.llvm.org/D96445
1 parent ad94fce commit ea93957

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
#include <cassert>
1414
#include <cstdio>
15-
#include <cstring>
1615
#include <cstdlib>
16+
#include <cstring>
1717
#include <dlfcn.h>
1818
#include <ffi.h>
1919
#include <gelf.h>
@@ -93,10 +93,7 @@ class RTLDeviceInfoTy {
9393
return &E.Table;
9494
}
9595

96-
RTLDeviceInfoTy(int32_t num_devices) {
97-
98-
FuncGblEntries.resize(num_devices);
99-
}
96+
RTLDeviceInfoTy(int32_t num_devices) { FuncGblEntries.resize(num_devices); }
10097

10198
~RTLDeviceInfoTy() {
10299
// Close dynamic libraries
@@ -230,7 +227,7 @@ __tgt_target_table *__tgt_rtl_load_binary(int32_t device_id,
230227
Elf64_Addr entries_addr = libInfo->l_addr + entries_offset;
231228

232229
DP("Pointer to first entry to be loaded is (" DPxMOD ").\n",
233-
DPxPTR(entries_addr));
230+
DPxPTR(entries_addr));
234231

235232
// Table of pointers to all the entries in the target.
236233
__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,
245242
}
246243

247244
DP("Entries table range is (" DPxMOD ")->(" DPxMOD ")\n",
248-
DPxPTR(entries_begin), DPxPTR(entries_end));
245+
DPxPTR(entries_begin), DPxPTR(entries_end));
249246
DeviceInfo.createOffloadTable(device_id, entries_begin, entries_end);
250247

251248
elf_end(e);
@@ -307,7 +304,7 @@ int32_t __tgt_rtl_run_target_team_region(int32_t device_id, void *tgt_entry_ptr,
307304
DP("Running entry point at " DPxMOD "...\n", DPxPTR(tgt_entry_ptr));
308305

309306
void (*entry)(void);
310-
*((void**) &entry) = tgt_entry_ptr;
307+
*((void **)&entry) = tgt_entry_ptr;
311308
ffi_call(&cif, entry, NULL, &args[0]);
312309
return OFFLOAD_SUCCESS;
313310
}

openmp/libomptarget/plugins/ve/src/rtl.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,8 @@ class RTLDeviceInfoTy {
8383
} else {
8484
DP("Found symbol %s successfully in target image (addr: %p)\n",
8585
SymbolName, reinterpret_cast<void *>(SymbolTargetAddr));
86-
Entry = { reinterpret_cast<void *>(SymbolTargetAddr),
87-
i->name,
88-
i->size,
89-
i->flags,
90-
0 };
86+
Entry = {reinterpret_cast<void *>(SymbolTargetAddr), i->name, i->size,
87+
i->flags, 0};
9188
}
9289

9390
T.push_back(Entry);
@@ -178,7 +175,6 @@ static int target_run_function_wait(uint32_t DeviceID, uint64_t FuncAddr,
178175
return OFFLOAD_SUCCESS;
179176
}
180177

181-
182178
// Return the number of available devices of the type supported by the
183179
// target RTL.
184180
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) {
353349
DP("Allocate target memory: device=%d, target addr=%p, size=%" PRIu64 "\n",
354350
ID, reinterpret_cast<void *>(addr), Size);
355351
if (ret != 0) {
356-
DP("veo_alloc_mem(%d, %p, %" PRIu64 ") failed with error code %d\n",
357-
ID, reinterpret_cast<void *>(addr), Size, ret);
352+
DP("veo_alloc_mem(%d, %p, %" PRIu64 ") failed with error code %d\n", ID,
353+
reinterpret_cast<void *>(addr), Size, ret);
358354
return NULL;
359355
}
360356

@@ -390,7 +386,7 @@ int32_t __tgt_rtl_data_retrieve(int32_t ID, void *HostPtr, void *TargetPtr,
390386
// De-allocate the data referenced by target ptr on the device. In case of
391387
// success, return zero. Otherwise, return an error code.
392388
int32_t __tgt_rtl_data_delete(int32_t ID, void *TargetPtr) {
393-
int ret = veo_free_mem(DeviceInfo.ProcHandles[ID], (uint64_t)TargetPtr);
389+
int ret = veo_free_mem(DeviceInfo.ProcHandles[ID], (uint64_t)TargetPtr);
394390

395391
if (ret != 0) {
396392
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,
422418
ret = veo_args_set_u64(TargetArgs, i, (intptr_t)Args[i]);
423419

424420
if (ret != 0) {
425-
DP("veo_args_set_u64() has returned %d for argnum=%d and value %p\n",
426-
ret, i, Args[i]);
421+
DP("veo_args_set_u64() has returned %d for argnum=%d and value %p\n", ret,
422+
i, Args[i]);
427423
return OFFLOAD_FAIL;
428424
}
429425
}

0 commit comments

Comments
 (0)