[Openmp-commits] [openmp] ea93957 - [OpenMP][NFC] Clang format the libomptarget plugins

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 16 13:37:51 PST 2021


Author: Johannes Doerfert
Date: 2021-02-16T15:37:46-06:00
New Revision: ea9395716ecc9923beb74b3af3df9f673364a76e

URL: https://github.com/llvm/llvm-project/commit/ea9395716ecc9923beb74b3af3df9f673364a76e
DIFF: https://github.com/llvm/llvm-project/commit/ea9395716ecc9923beb74b3af3df9f673364a76e.diff

LOG: [OpenMP][NFC] Clang format the libomptarget plugins

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D96445

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp b/openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
index 625518f46cca..eb6ebc1c35c1 100644
--- a/openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
@@ -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 @@ class RTLDeviceInfoTy {
     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;
 }

diff  --git a/openmp/libomptarget/plugins/ve/src/rtl.cpp b/openmp/libomptarget/plugins/ve/src/rtl.cpp
index 284ee04c850b..186247db20ec 100644
--- a/openmp/libomptarget/plugins/ve/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/ve/src/rtl.cpp
@@ -83,11 +83,8 @@ class RTLDeviceInfoTy {
       } 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;
     }
   }


        


More information about the Openmp-commits mailing list