[llvm] [libsycl] Implement fill & memset queue API (PR #217933)

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 04:49:30 PDT 2026


================
@@ -413,6 +413,87 @@ class _LIBSYCL_EXPORT queue {
   event memcpy(void *dest, const void *src, std::size_t numBytes,
                const std::vector<event> &depEvents);
 
+  /// Submits a memset operation for USM accessible on the device associated
+  /// with the queue. Equivalent to a fill operation with an unsigned char
+  /// pattern.
+  ///
+  /// \param ptr is the pointer to memory to be set.
+  /// \param value is the value the memory should be filled with, interpreted
+  /// as an unsigned char.
+  /// \param numBytes is the number of bytes to set.
+  event memset(void *ptr, int value, std::size_t numBytes) {
+    return memset(ptr, value, numBytes, std::vector<event>{});
+  }
+
+  /// Submits a memset operation for USM accessible on the device associated
+  /// with the queue. Equivalent to a fill operation with an unsigned char
+  /// pattern.
+  ///
+  /// \param ptr is the pointer to memory to be set.
+  /// \param value is the value the memory should be filled with, interpreted
+  /// as an unsigned char.
+  /// \param numBytes is the number of bytes to set.
+  /// \param depEvent is an event that represents a dependency for the
+  /// operation.
+  event memset(void *ptr, int value, std::size_t numBytes, event depEvent) {
+    return memset(ptr, value, numBytes, std::vector<event>{depEvent});
+  }
+
+  /// Submits a memset operation for USM accessible on the device associated
+  /// with the queue. Equivalent to a fill operation with an unsigned char
+  /// pattern.
+  ///
+  /// \param ptr is the pointer to memory to be set.
+  /// \param value is the value the memory should be filled with, interpreted
+  /// as an unsigned char.
+  /// \param numBytes is the number of bytes to set.
+  /// \param depEvents is a vector of events that represent dependencies for the
+  /// operation.
+  event memset(void *ptr, int value, std::size_t numBytes,
+               const std::vector<event> &depEvents) {
+    return fill(ptr, static_cast<unsigned char>(value), numBytes, depEvents);
+  }
+
+  /// Submits a fill operation that replicates a pattern into USM accessible
+  /// on the device associated with the queue.
+  ///
+  /// \param ptr is the pointer to memory to be filled.
+  /// \param pattern is the pattern to be replicated.
+  /// \param count is the number of times the pattern is filled.
+  /// \param depEvents is a vector of events that represent dependencies for the
----------------
KseniyaTikhomirova wrote:

depEvents is not present in this overload

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


More information about the llvm-commits mailing list