[Openmp-commits] [openmp] [OpenMP][libomptarget][RFC] extend libomptarget with mechanism to execute fill memory on the target (PR #73801)

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 29 08:55:38 PST 2023


================
@@ -672,6 +672,16 @@ int32_t DeviceTy::dataExchange(void *SrcPtr, DeviceTy &DstDev, void *DstPtr,
                                   DstPtr, Size, AsyncInfo);
 }
 
+// Run a "fill memory" operation (aka "memset") on the target device
+int32_t DeviceTy::fillMemory(void *Ptr, int32_t Val, uint64_t NumValues,
+                             AsyncInfoTy &AsyncInfo) {
+  if (!AsyncInfo || !RTL->fill_memory_async || !RTL->synchronize) {
+    assert(RTL->fill_memory && "RTL->fill_memory is nullptr");
+    return RTL->fill_memory(RTLDeviceID, Ptr, Val, NumValues);
----------------
jdoerfert wrote:

It seems the function is not optional, maybe we should follow this up by moving the default logic (shadow array) into the Plugin. At least we can think about it.

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


More information about the Openmp-commits mailing list