[llvm-branch-commits] [llvm] [Offload][Lang] Add Memset to LLVMOffloading library (PR #216825)

Kevin Sala Penades via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 17 18:54:44 PDT 2026


================
@@ -100,6 +101,24 @@ Error_t Memcpy(void *Dst, const void *Src, size_t Size, MemcpyKind Kind) {
   return convertAndSetLastError(Result);
 }
 
+Error_t Memset(void *DevPtr, int Value, size_t Count) {
+  ol_device_handle_t Device = ThreadState::getDefaultDevice();
+  StreamTy *DefaultStream = ThreadState::getDefaultStream();
+  if (!Device || !DefaultStream)
+    return setLastError(ErrorInvalidDevice);
+
+  ol_result_t Result = waitOnBlockingStreams(DefaultStream, Device);
+  if (Result != OL_SUCCESS)
+    return convertAndSetLastError(Result);
----------------
kevinsala wrote:

I'm afraid this code will be repeated in similar blocking functions. We probably want to encapsulate it too; now or in the future. What do you think?

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


More information about the llvm-branch-commits mailing list