[Openmp-commits] [openmp] [libomptarget][OpenMP] Initial implementation of omp_target_memset() and omp_target_memset_async() (PR #68706)

via Openmp-commits openmp-commits at lists.llvm.org
Tue Oct 10 08:29:09 PDT 2023


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 0e1481439f11c4b9d7a27ef7df7404c0990044b4 7933bfa051acaecd801eb95bddcdbae8456d06c3 -- openmp/libomptarget/test/api/omp_target_memset.c openmp/libomptarget/include/omptarget.h openmp/libomptarget/src/api.cpp openmp/libomptarget/src/private.h openmp/runtime/src/kmp_ftn_os.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/openmp/libomptarget/src/api.cpp b/openmp/libomptarget/src/api.cpp
index c8e74ee89bf1..484a4433f950 100644
--- a/openmp/libomptarget/src/api.cpp
+++ b/openmp/libomptarget/src/api.cpp
@@ -301,7 +301,8 @@ static int libomp_helper_memset_task_creation(TargetMemsetArgsTy *Args,
   return Rc;
 }
 
-EXTERN void *omp_target_memset(void *Ptr, int ByteVal, size_t NumBytes, int DeviceNum) {
+EXTERN void *omp_target_memset(void *Ptr, int ByteVal, size_t NumBytes,
+                               int DeviceNum) {
   TIMESCOPE();
   DP("Call to omp_target_memset, device %d, device pointer %p, size %zu\n",
      DeviceNum, Ptr, NumBytes);
@@ -325,7 +326,8 @@ EXTERN void *omp_target_memset(void *Ptr, int ByteVal, size_t NumBytes, int Devi
     int InitialDevice = omp_get_initial_device();
     void *Shadow = omp_target_alloc(NumBytes, InitialDevice);
     (void)memset(Shadow, ByteVal, NumBytes);
-    (void)omp_target_memcpy(Ptr, Shadow, NumBytes, 0, 0, DeviceNum, InitialDevice);
+    (void)omp_target_memcpy(Ptr, Shadow, NumBytes, 0, 0, DeviceNum,
+                            InitialDevice);
     (void)omp_target_free(Shadow, InitialDevice);
   }
 
@@ -333,8 +335,8 @@ EXTERN void *omp_target_memset(void *Ptr, int ByteVal, size_t NumBytes, int Devi
   return Ptr;
 }
 
-EXTERN void *omp_target_memset_async(void *Ptr, int ByteVal, size_t NumBytes, int DeviceNum,
-                                     int DepObjCount,
+EXTERN void *omp_target_memset_async(void *Ptr, int ByteVal, size_t NumBytes,
+                                     int DeviceNum, int DepObjCount,
                                      omp_depend_t *DepObjList) {
   DP("Call to omp_target_memset_async, device %d, device pointer %p, size %zu",
      DeviceNum, Ptr, NumBytes);

``````````

</details>


https://github.com/llvm/llvm-project/pull/68706


More information about the Openmp-commits mailing list