[Openmp-commits] [openmp] [Libomptarget] Factor functions out of 'Plugin' interface (PR #86528)
via Openmp-commits
openmp-commits at lists.llvm.org
Mon Mar 25 09:38:48 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 46a737cef2a709d5c121ab616fc80088ce2eed46 44c087ef4b0cb8056717e7f2e0ba9be59301c099 -- openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp openmp/libomptarget/plugins-nextgen/host/src/rtl.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp b/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp
index fe937e9845..4db787a2ea 100644
--- a/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp
@@ -1636,7 +1636,9 @@ int32_t __tgt_rtl_init_device(int32_t DeviceId) {
return OFFLOAD_SUCCESS;
}
-int32_t __tgt_rtl_number_of_devices() { return PluginTy::get().getNumDevices(); }
+int32_t __tgt_rtl_number_of_devices() {
+ return PluginTy::get().getNumDevices();
+}
int64_t __tgt_rtl_init_requires(int64_t RequiresFlags) {
PluginTy::get().setRequiresFlag(RequiresFlags);
@@ -1709,8 +1711,8 @@ void *__tgt_rtl_data_alloc(int32_t DeviceId, int64_t Size, void *HostPtr,
}
int32_t __tgt_rtl_data_delete(int32_t DeviceId, void *TgtPtr, int32_t Kind) {
- auto Err =
- PluginTy::get().getDevice(DeviceId).dataDelete(TgtPtr, (TargetAllocTy)Kind);
+ auto Err = PluginTy::get().getDevice(DeviceId).dataDelete(
+ TgtPtr, (TargetAllocTy)Kind);
if (Err) {
REPORT("Failure to deallocate device pointer %p: %s\n", TgtPtr,
toString(std::move(Err)).data());
@@ -1782,8 +1784,8 @@ int32_t __tgt_rtl_data_submit(int32_t DeviceId, void *TgtPtr, void *HstPtr,
int32_t __tgt_rtl_data_submit_async(int32_t DeviceId, void *TgtPtr,
void *HstPtr, int64_t Size,
__tgt_async_info *AsyncInfoPtr) {
- auto Err = PluginTy::get().getDevice(DeviceId).dataSubmit(TgtPtr, HstPtr, Size,
- AsyncInfoPtr);
+ auto Err = PluginTy::get().getDevice(DeviceId).dataSubmit(TgtPtr, HstPtr,
+ Size, AsyncInfoPtr);
if (Err) {
REPORT("Failure to copy data from host to device. Pointers: host "
"= " DPxMOD ", device = " DPxMOD ", size = %" PRId64 ": %s\n",
@@ -1804,8 +1806,8 @@ int32_t __tgt_rtl_data_retrieve(int32_t DeviceId, void *HstPtr, void *TgtPtr,
int32_t __tgt_rtl_data_retrieve_async(int32_t DeviceId, void *HstPtr,
void *TgtPtr, int64_t Size,
__tgt_async_info *AsyncInfoPtr) {
- auto Err = PluginTy::get().getDevice(DeviceId).dataRetrieve(HstPtr, TgtPtr,
- Size, AsyncInfoPtr);
+ auto Err = PluginTy::get().getDevice(DeviceId).dataRetrieve(
+ HstPtr, TgtPtr, Size, AsyncInfoPtr);
if (Err) {
REPORT("Faliure to copy data from device to host. Pointers: host "
"= " DPxMOD ", device = " DPxMOD ", size = %" PRId64 ": %s\n",
diff --git a/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
index 298783fd35..d43c723c35 100644
--- a/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
@@ -529,7 +529,8 @@ struct CUDADeviceTy : public GenericDeviceTy {
return std::move(Err);
// Allocate and initialize the image object.
- CUDADeviceImageTy *CUDAImage = PluginTy::get().allocate<CUDADeviceImageTy>();
+ CUDADeviceImageTy *CUDAImage =
+ PluginTy::get().allocate<CUDADeviceImageTy>();
new (CUDAImage) CUDADeviceImageTy(ImageId, *this, TgtImage);
// Load the CUDA module.
``````````
</details>
https://github.com/llvm/llvm-project/pull/86528
More information about the Openmp-commits
mailing list