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

Sergey Semenov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 06:06:52 PDT 2026


https://github.com/sergey-semenov updated https://github.com/llvm/llvm-project/pull/217933

>From dde5424a48bdb96e7f3f2c780747f91f0e9389ab Mon Sep 17 00:00:00 2001
From: Sergey Semenov <sergey.semenov at intel.com>
Date: Fri, 21 Aug 2026 05:57:50 -0700
Subject: [PATCH 1/6] [libsycl] Implement fill & memset queue API

---
 libsycl/include/sycl/__impl/queue.hpp  | 93 ++++++++++++++++++++++++++
 libsycl/src/detail/queue_impl.cpp      | 22 +++++-
 libsycl/src/detail/queue_impl.hpp      | 11 +++
 libsycl/src/queue.cpp                  |  8 +++
 libsycl/test/usm/fill.cpp              | 10 +++
 libsycl/test/usm/memset.cpp            | 11 +++
 libsycl/unittests/mock/helpers.cpp     | 14 ++++
 libsycl/unittests/mock/helpers.hpp     |  3 +
 libsycl/unittests/mock/mock.cpp        |  6 ++
 libsycl/unittests/queue/CMakeLists.txt |  4 +-
 libsycl/unittests/queue/fill.cpp       | 38 +++++++++++
 libsycl/unittests/queue/memset.cpp     | 37 ++++++++++
 12 files changed, 255 insertions(+), 2 deletions(-)
 create mode 100644 libsycl/test/usm/fill.cpp
 create mode 100644 libsycl/test/usm/memset.cpp
 create mode 100644 libsycl/unittests/queue/fill.cpp
 create mode 100644 libsycl/unittests/queue/memset.cpp

diff --git a/libsycl/include/sycl/__impl/queue.hpp b/libsycl/include/sycl/__impl/queue.hpp
index bd6613e95324b..46e7d726fbebc 100644
--- a/libsycl/include/sycl/__impl/queue.hpp
+++ b/libsycl/include/sycl/__impl/queue.hpp
@@ -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
+  /// operation.
+  template <typename T>
+  event fill(void *ptr, const T &pattern, std::size_t count) {
+    return fill(ptr, pattern, count, std::vector<event>{});
+  }
+
+  /// 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 depEvent is an event that represents a dependency for the
+  /// operation.
+  template <typename T>
+  event fill(void *ptr, const T &pattern, std::size_t count, event depEvent) {
+    return fill(ptr, pattern, count, std::vector<event>{depEvent});
+  }
+
+  /// 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
+  /// operation.
+  template <typename T>
+  event fill(void *ptr, const T &pattern, std::size_t count,
+             const std::vector<event> &depEvents) {
+    return fillImpl(ptr, &pattern, sizeof(T), count, depEvents);
+  }
+
   /// Provides hints to the runtime library that data can be made available
   /// on a device earlier than Unified Shared Memory would normally require it
   /// to be available.
@@ -560,6 +641,18 @@ class _LIBSYCL_EXPORT queue {
   /// \return an event representing last kernel invocation.
   event getLastEvent();
 
+  /// 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 PatternSize is the size of the pattern in bytes.
+  /// \param Count is the number of times the pattern is filled.
+  /// \param DepEvents is a vector of events that represent dependencies for the
+  /// operation.
+  event fillImpl(void *Ptr, const void *Pattern, std::size_t PatternSize,
+                 std::size_t Count, const std::vector<event> &DepEvents);
+
   queue(const std::shared_ptr<detail::QueueImpl> &Impl) : impl(Impl) {}
   std::shared_ptr<detail::QueueImpl> impl;
 
diff --git a/libsycl/src/detail/queue_impl.cpp b/libsycl/src/detail/queue_impl.cpp
index e0700129c0fa5..bb39eaa4b5f84 100644
--- a/libsycl/src/detail/queue_impl.cpp
+++ b/libsycl/src/detail/queue_impl.cpp
@@ -194,6 +194,27 @@ QueueImpl::memcpy(void *Dest, const void *Src, std::size_t NumBytes,
   return createEvent();
 }
 
+EventImplPtr QueueImpl::fill(void *Ptr, const void *Pattern,
+                             std::size_t PatternSize, std::size_t Count,
+                             const std::vector<EventImplPtr> &DepEvents) {
+  assert(PatternSize > 0);
+  checkEventsPlatformMatch(DepEvents, MDevice.getPlatformImpl());
+  if (Count == 0) {
+    handleEventDependencies(DepEvents);
+    return createEvent();
+  }
+
+  if (!Ptr) {
+    throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
+                          "Nullptr argument in fill/memset operation");
+  }
+
+  handleEventDependencies(DepEvents);
+  callAndThrow(olMemFill, MOffloadQueue, Ptr, PatternSize, Pattern,
+               Count * PatternSize);
+  return createEvent();
+}
+
 EventImplPtr QueueImpl::prefetch(void *Ptr, std::size_t NumBytes,
                                  const std::vector<EventImplPtr> &DepEvents) {
   checkEventsPlatformMatch(DepEvents, MDevice.getPlatformImpl());
@@ -216,7 +237,6 @@ EventImplPtr QueueImpl::prefetch(void *Ptr, std::size_t NumBytes,
 
   handleEventDependencies(DepEvents);
   callAndThrow(olMemPrefetch, MOffloadQueue, Count, Mems, Sizes, Flag);
-
   return createEvent();
 }
 
diff --git a/libsycl/src/detail/queue_impl.hpp b/libsycl/src/detail/queue_impl.hpp
index c889a189a7ff4..069a211c2ec97 100644
--- a/libsycl/src/detail/queue_impl.hpp
+++ b/libsycl/src/detail/queue_impl.hpp
@@ -117,6 +117,17 @@ class QueueImpl : public std::enable_shared_from_this<QueueImpl> {
   EventImplPtr memcpy(void *Dest, const void *Src, std::size_t NumBytes,
                       const std::vector<EventImplPtr> &DepEvents);
 
+  /// Submits a fill operation that replicates a pattern into USM.
+  ///
+  /// \param Ptr is the pointer to memory to be filled.
+  /// \param Pattern is the pattern to be replicated.
+  /// \param PatternSize is the size of the pattern.
+  /// \param Count is the number of times the pattern is filled.
+  /// \param DepEvents is a vector of dependencies for the operation.
+  EventImplPtr fill(void *Ptr, const void *Pattern, std::size_t PatternSize,
+                    std::size_t Count,
+                    const std::vector<EventImplPtr> &DepEvents);
+
   /// Submits a prefetch operation for a USM pointer.
   ///
   /// \param Ptr is a USM pointer to the memory to be prefetched to the device.
diff --git a/libsycl/src/queue.cpp b/libsycl/src/queue.cpp
index c257a09367f3f..36238609c12f9 100644
--- a/libsycl/src/queue.cpp
+++ b/libsycl/src/queue.cpp
@@ -69,4 +69,12 @@ void queue::submitKernelImpl(detail::DeviceKernelInfo &KernelInfo,
   impl->submitKernelImpl(KernelInfo, ArgData, ArgSize);
 }
 
+event queue::fillImpl(void *Ptr, const void *Pattern, std::size_t PatternSize,
+                      std::size_t Count, const std::vector<event> &DepEvents) {
+  std::shared_ptr<detail::EventImpl> EventImplPtr = impl->fill(
+      Ptr, Pattern, PatternSize, Count, detail::getSyclObjImpls(DepEvents));
+  assert(EventImplPtr);
+  return detail::createSyclObjFromImpl<event>(EventImplPtr);
+}
+
 _LIBSYCL_END_NAMESPACE_SYCL
diff --git a/libsycl/test/usm/fill.cpp b/libsycl/test/usm/fill.cpp
new file mode 100644
index 0000000000000..9379013c91b55
--- /dev/null
+++ b/libsycl/test/usm/fill.cpp
@@ -0,0 +1,10 @@
+// REQUIRES: any-device
+// RUN: %clangxx -fsycl %s -o %t.out
+// RUN: %t.out
+
+#include "include/fill_memset_common.hpp"
+
+int main() {
+  queue Q;
+  runTests<int>(Q, [&](void *Ptr) { Q.fill(Ptr, Pattern, DataSize); });
+}
diff --git a/libsycl/test/usm/memset.cpp b/libsycl/test/usm/memset.cpp
new file mode 100644
index 0000000000000..4045b34b77564
--- /dev/null
+++ b/libsycl/test/usm/memset.cpp
@@ -0,0 +1,11 @@
+// REQUIRES: any-device
+// RUN: %clangxx -fsycl %s -o %t.out
+// RUN: %t.out
+
+#include "include/fill_memset_common.hpp"
+
+int main() {
+  queue Q;
+  runTests<unsigned char>(Q,
+                          [&](void *Ptr) { Q.memset(Ptr, Pattern, DataSize); });
+}
diff --git a/libsycl/unittests/mock/helpers.cpp b/libsycl/unittests/mock/helpers.cpp
index 2898b39daafad..1762e344219ed 100644
--- a/libsycl/unittests/mock/helpers.cpp
+++ b/libsycl/unittests/mock/helpers.cpp
@@ -308,6 +308,19 @@ void mock::MockLiboffload::initDefault() {
         EXPECT_NE(SrcDevice, nullptr);
         return OL_SUCCESS;
       });
+
+  ON_CALL(*this, olMemFill)
+      .WillByDefault([](ol_queue_handle_t Queue, void *Ptr, size_t PatternSize,
+                        const void *PatternPtr,
+                        size_t FillSize) -> ol_result_t {
+        EXPECT_NE(Queue, nullptr);
+        EXPECT_NE(Ptr, nullptr);
+        EXPECT_GT(PatternSize, 0);
+        EXPECT_NE(PatternPtr, nullptr);
+        EXPECT_GT(FillSize, 0);
+        return OL_SUCCESS;
+      });
+
   ON_CALL(*this, olMemPrefetch)
       .WillByDefault([this](ol_queue_handle_t Queue, size_t Count,
                             const void **Mems, const size_t *Sizes,
@@ -321,6 +334,7 @@ void mock::MockLiboffload::initDefault() {
         EXPECT_EQ(Flags, OL_MEM_MIGRATION_FLAG_HOST_TO_DEVICE);
         return OL_SUCCESS;
       });
+
   ON_CALL(*this, olGetMemInfo)
       .WillByDefault([this](const void *Ptr, ol_mem_info_t PropName,
                             size_t PropSize, void *PropValue) -> ol_result_t {
diff --git a/libsycl/unittests/mock/helpers.hpp b/libsycl/unittests/mock/helpers.hpp
index 50ff09b2b02c8..e29ed55b8c475 100644
--- a/libsycl/unittests/mock/helpers.hpp
+++ b/libsycl/unittests/mock/helpers.hpp
@@ -126,6 +126,9 @@ class MockLiboffload {
               (ol_queue_handle_t Queue, void *DstPtr,
                ol_device_handle_t DstDevice, const void *SrcPtr,
                ol_device_handle_t SrcDevice, size_t Size));
+  MOCK_METHOD(ol_result_t, olMemFill,
+              (ol_queue_handle_t Queue, void *Ptr, size_t PatternSize,
+               const void *PatternPtr, size_t FillSize));
   MOCK_METHOD(ol_result_t, olMemPrefetch,
               (ol_queue_handle_t Queue, size_t Count, const void **Mems,
                const size_t *Sizes, ol_mem_migration_flags_t Flags));
diff --git a/libsycl/unittests/mock/mock.cpp b/libsycl/unittests/mock/mock.cpp
index 551c14e568701..973150c25a7c9 100644
--- a/libsycl/unittests/mock/mock.cpp
+++ b/libsycl/unittests/mock/mock.cpp
@@ -117,6 +117,12 @@ ol_result_t olMemcpy(ol_queue_handle_t Queue, void *DstPtr,
                                             SrcDevice, Size);
 }
 
+ol_result_t olMemFill(ol_queue_handle_t Queue, void *Ptr, size_t PatternSize,
+                      const void *PatternPtr, size_t FillSize) {
+  return mock::getMockLiboffload().olMemFill(Queue, Ptr, PatternSize,
+                                             PatternPtr, FillSize);
+}
+
 ol_result_t olMemPrefetch(ol_queue_handle_t Queue, size_t Count,
                           const void **Mems, const size_t *Sizes,
                           ol_mem_migration_flags_t Flags) {
diff --git a/libsycl/unittests/queue/CMakeLists.txt b/libsycl/unittests/queue/CMakeLists.txt
index 418fd1789ca76..8a1adf625237c 100644
--- a/libsycl/unittests/queue/CMakeLists.txt
+++ b/libsycl/unittests/queue/CMakeLists.txt
@@ -1,6 +1,8 @@
 add_sycl_unittest(QueueTests
-    prefetch.cpp
+    fill.cpp
     memcpy.cpp
+    memset.cpp
+    prefetch.cpp
     queue.cpp
     sycl_kernel_launch.cpp
 )
diff --git a/libsycl/unittests/queue/fill.cpp b/libsycl/unittests/queue/fill.cpp
new file mode 100644
index 0000000000000..873b0bdb97486
--- /dev/null
+++ b/libsycl/unittests/queue/fill.cpp
@@ -0,0 +1,38 @@
+#include <mock/helpers.hpp>
+
+#include <sycl/__impl/queue.hpp>
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using namespace sycl;
+using namespace ::testing;
+
+TEST(Queue, Fill) {
+  mock::MockWrapper Mock;
+  queue Q;
+
+  int a;
+  int *Ptr = &a;
+  int Pattern;
+  int *PatternPtr = &Pattern;
+  constexpr int FillCount = 32;
+  constexpr int FillBytes = FillCount * sizeof(int);
+
+  EXPECT_CALL(Mock.get(), olMemFill(_, Ptr, sizeof(int), PatternPtr, FillBytes))
+      .Times(3);
+  EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
+  event E = Q.fill(Ptr, Pattern, FillCount);
+  Q.fill(Ptr, Pattern, FillCount, E);
+  Q.fill(Ptr, Pattern, FillCount, std::vector<event>{E});
+}
+
+TEST(Queue, FillZeroBytes) {
+  mock::MockWrapper Mock;
+  queue Q;
+  EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
+  EXPECT_CALL(Mock.get(), olMemFill(_, _, _, _, _)).Times(0);
+  event E = Q.fill(nullptr, 1, 0);
+  Q.fill(nullptr, 1, 0, E);
+  Q.fill(nullptr, 1, 0, std::vector<event>{E});
+}
diff --git a/libsycl/unittests/queue/memset.cpp b/libsycl/unittests/queue/memset.cpp
new file mode 100644
index 0000000000000..7a6444811a85c
--- /dev/null
+++ b/libsycl/unittests/queue/memset.cpp
@@ -0,0 +1,37 @@
+#include <mock/helpers.hpp>
+
+#include <sycl/__impl/queue.hpp>
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using namespace sycl;
+using namespace ::testing;
+
+TEST(Queue, Memset) {
+  mock::MockWrapper Mock;
+  queue Q;
+
+  int a;
+  int *Ptr = &a;
+  constexpr int FillCount = 32;
+  int Pattern = 42;
+
+  EXPECT_CALL(Mock.get(),
+              olMemFill(_, Ptr, sizeof(unsigned char), _, FillCount))
+      .Times(3);
+  EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
+  event E = Q.memset(Ptr, Pattern, FillCount);
+  Q.memset(Ptr, Pattern, FillCount, E);
+  Q.memset(Ptr, Pattern, FillCount, std::vector<event>{E});
+}
+
+TEST(Queue, MemsetZeroBytes) {
+  mock::MockWrapper Mock;
+  queue Q;
+  EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
+  EXPECT_CALL(Mock.get(), olMemFill(_, _, _, _, _)).Times(0);
+  event E = Q.memset(nullptr, 1, 0);
+  Q.memset(nullptr, 1, 0, E);
+  Q.memset(nullptr, 1, 0, std::vector<event>{E});
+}

>From 482d3dfb07b581c121d2293a69b3138101feb4e8 Mon Sep 17 00:00:00 2001
From: Sergey Semenov <sergey.semenov at intel.com>
Date: Thu, 3 Sep 2026 08:03:13 -0700
Subject: [PATCH 2/6] Apply comments

---
 libsycl/include/sycl/__impl/queue.hpp         |  8 +++-
 .../test/usm/include/fill_memset_common.hpp   | 42 +++++++++++++++++++
 libsycl/unittests/mock/helpers.cpp            |  1 +
 libsycl/unittests/queue/fill.cpp              | 21 ++++++----
 libsycl/unittests/queue/memset.cpp            |  8 ++++
 5 files changed, 71 insertions(+), 9 deletions(-)
 create mode 100644 libsycl/test/usm/include/fill_memset_common.hpp

diff --git a/libsycl/include/sycl/__impl/queue.hpp b/libsycl/include/sycl/__impl/queue.hpp
index 6ca7e18b7e9fa..c117fb5062581 100644
--- a/libsycl/include/sycl/__impl/queue.hpp
+++ b/libsycl/include/sycl/__impl/queue.hpp
@@ -450,6 +450,7 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
   /// \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.
+  /// \return an event that represents the status of the operation.
   event memset(void *ptr, int value, std::size_t numBytes) {
     return memset(ptr, value, numBytes, std::vector<event>{});
   }
@@ -464,6 +465,7 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
   /// \param numBytes is the number of bytes to set.
   /// \param depEvent is an event that represents a dependency for the
   /// operation.
+  /// \return an event that represents the status of the operation.
   event memset(void *ptr, int value, std::size_t numBytes, event depEvent) {
     return memset(ptr, value, numBytes, std::vector<event>{depEvent});
   }
@@ -478,6 +480,7 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
   /// \param numBytes is the number of bytes to set.
   /// \param depEvents is a vector of events that represent dependencies for the
   /// operation.
+  /// \return an event that represents the status of 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);
@@ -489,8 +492,7 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<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
-  /// operation.
+  /// \return an event that represents the status of the operation.
   template <typename T>
   event fill(void *ptr, const T &pattern, std::size_t count) {
     return fill(ptr, pattern, count, std::vector<event>{});
@@ -504,6 +506,7 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
   /// \param count is the number of times the pattern is filled.
   /// \param depEvent is an event that represents a dependency for the
   /// operation.
+  /// \return an event that represents the status of the operation.
   template <typename T>
   event fill(void *ptr, const T &pattern, std::size_t count, event depEvent) {
     return fill(ptr, pattern, count, std::vector<event>{depEvent});
@@ -517,6 +520,7 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
   /// \param count is the number of times the pattern is filled.
   /// \param depEvents is a vector of events that represent dependencies for the
   /// operation.
+  /// \return an event that represents the status of the operation.
   template <typename T>
   event fill(void *ptr, const T &pattern, std::size_t count,
              const std::vector<event> &depEvents) {
diff --git a/libsycl/test/usm/include/fill_memset_common.hpp b/libsycl/test/usm/include/fill_memset_common.hpp
new file mode 100644
index 0000000000000..42bea7ad9cbf9
--- /dev/null
+++ b/libsycl/test/usm/include/fill_memset_common.hpp
@@ -0,0 +1,42 @@
+#include <sycl/sycl.hpp>
+
+#include <array>
+#include <cassert>
+
+using namespace sycl;
+
+constexpr std::size_t DataSize = 1024;
+constexpr int Pattern = 42;
+
+template <typename DataT> bool verify(DataT *Ptr) {
+  for (int I = 0; I < DataSize; ++I)
+    if (Ptr[I] != Pattern)
+      return false;
+  return true;
+}
+
+template <bool VerifyOnDevice, typename DataT, typename OpT>
+void test(queue &Q, DataT *Ptr, OpT Op) {
+  Op(Ptr);
+  Q.wait();
+
+  if constexpr (VerifyOnDevice) {
+    bool *Result = malloc_shared<bool>(1, Q);
+    Q.single_task<class Verify>([=]() { verify(Ptr); });
+    Q.wait();
+    assert(Result);
+    sycl::free(Result, Q);
+  } else {
+    Q.wait();
+    assert(verify(Ptr));
+  }
+  sycl::free(Ptr, Q);
+}
+
+template <typename DataT, typename OpT> void runTests(queue &Q, OpT Op) {
+  test<false>(Q, malloc_host<DataT>(1024, Q), Op);
+  test<true>(Q, malloc_host<DataT>(1024, Q), Op);
+  test<false>(Q, malloc_shared<DataT>(1024, Q), Op);
+  test<true>(Q, malloc_shared<DataT>(1024, Q), Op);
+  test<true>(Q, malloc_device<DataT>(1024, Q), Op);
+}
\ No newline at end of file
diff --git a/libsycl/unittests/mock/helpers.cpp b/libsycl/unittests/mock/helpers.cpp
index 58093052e6468..e45214a1d3215 100644
--- a/libsycl/unittests/mock/helpers.cpp
+++ b/libsycl/unittests/mock/helpers.cpp
@@ -315,6 +315,7 @@ void mock::MockLiboffload::initDefault() {
         EXPECT_GT(PatternSize, 0);
         EXPECT_NE(PatternPtr, nullptr);
         EXPECT_GT(FillSize, 0);
+        EXPECT_EQ(FillSize % PatternSize, 0);
         return OL_SUCCESS;
       });
 
diff --git a/libsycl/unittests/queue/fill.cpp b/libsycl/unittests/queue/fill.cpp
index 873b0bdb97486..d41785def7026 100644
--- a/libsycl/unittests/queue/fill.cpp
+++ b/libsycl/unittests/queue/fill.cpp
@@ -1,3 +1,11 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
 #include <mock/helpers.hpp>
 
 #include <sycl/__impl/queue.hpp>
@@ -5,12 +13,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-using namespace sycl;
 using namespace ::testing;
 
 TEST(Queue, Fill) {
   mock::MockWrapper Mock;
-  queue Q;
+  sycl::queue Q;
 
   int a;
   int *Ptr = &a;
@@ -22,17 +29,17 @@ TEST(Queue, Fill) {
   EXPECT_CALL(Mock.get(), olMemFill(_, Ptr, sizeof(int), PatternPtr, FillBytes))
       .Times(3);
   EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
-  event E = Q.fill(Ptr, Pattern, FillCount);
+  sycl::event E = Q.fill(Ptr, Pattern, FillCount);
   Q.fill(Ptr, Pattern, FillCount, E);
-  Q.fill(Ptr, Pattern, FillCount, std::vector<event>{E});
+  Q.fill(Ptr, Pattern, FillCount, std::vector<sycl::event>{E});
 }
 
 TEST(Queue, FillZeroBytes) {
   mock::MockWrapper Mock;
-  queue Q;
+  sycl::queue Q;
   EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
   EXPECT_CALL(Mock.get(), olMemFill(_, _, _, _, _)).Times(0);
-  event E = Q.fill(nullptr, 1, 0);
+  sycl::event E = Q.fill(nullptr, 1, 0);
   Q.fill(nullptr, 1, 0, E);
-  Q.fill(nullptr, 1, 0, std::vector<event>{E});
+  Q.fill(nullptr, 1, 0, std::vector<sycl::event>{E});
 }
diff --git a/libsycl/unittests/queue/memset.cpp b/libsycl/unittests/queue/memset.cpp
index 7a6444811a85c..9b510eb894f0b 100644
--- a/libsycl/unittests/queue/memset.cpp
+++ b/libsycl/unittests/queue/memset.cpp
@@ -1,3 +1,11 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
 #include <mock/helpers.hpp>
 
 #include <sycl/__impl/queue.hpp>

>From 7e9ab9b85bf13a1879b1e23fa01a170dfbbc560d Mon Sep 17 00:00:00 2001
From: Sergey Semenov <sergey.semenov at intel.com>
Date: Thu, 3 Sep 2026 09:56:47 -0700
Subject: [PATCH 3/6] Apply another one

---
 libsycl/unittests/queue/memset.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libsycl/unittests/queue/memset.cpp b/libsycl/unittests/queue/memset.cpp
index 9b510eb894f0b..0f049d2b8679b 100644
--- a/libsycl/unittests/queue/memset.cpp
+++ b/libsycl/unittests/queue/memset.cpp
@@ -13,12 +13,11 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-using namespace sycl;
 using namespace ::testing;
 
 TEST(Queue, Memset) {
   mock::MockWrapper Mock;
-  queue Q;
+  sycl::queue Q;
 
   int a;
   int *Ptr = &a;
@@ -29,17 +28,17 @@ TEST(Queue, Memset) {
               olMemFill(_, Ptr, sizeof(unsigned char), _, FillCount))
       .Times(3);
   EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
-  event E = Q.memset(Ptr, Pattern, FillCount);
+  sycl::event E = Q.memset(Ptr, Pattern, FillCount);
   Q.memset(Ptr, Pattern, FillCount, E);
-  Q.memset(Ptr, Pattern, FillCount, std::vector<event>{E});
+  Q.memset(Ptr, Pattern, FillCount, std::vector<sycl::event>{E});
 }
 
 TEST(Queue, MemsetZeroBytes) {
   mock::MockWrapper Mock;
-  queue Q;
+  sycl::queue Q;
   EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
   EXPECT_CALL(Mock.get(), olMemFill(_, _, _, _, _)).Times(0);
-  event E = Q.memset(nullptr, 1, 0);
+  sycl::event E = Q.memset(nullptr, 1, 0);
   Q.memset(nullptr, 1, 0, E);
-  Q.memset(nullptr, 1, 0, std::vector<event>{E});
+  Q.memset(nullptr, 1, 0, std::vector<sycl::event>{E});
 }

>From 4a04c87145e4aab05cd6f77713156a47030a2805 Mon Sep 17 00:00:00 2001
From: Sergey Semenov <sergey.semenov at intel.com>
Date: Thu, 3 Sep 2026 09:58:29 -0700
Subject: [PATCH 4/6] Add newline at EOF

---
 libsycl/test/usm/include/fill_memset_common.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libsycl/test/usm/include/fill_memset_common.hpp b/libsycl/test/usm/include/fill_memset_common.hpp
index 42bea7ad9cbf9..64b22129321d3 100644
--- a/libsycl/test/usm/include/fill_memset_common.hpp
+++ b/libsycl/test/usm/include/fill_memset_common.hpp
@@ -39,4 +39,4 @@ template <typename DataT, typename OpT> void runTests(queue &Q, OpT Op) {
   test<false>(Q, malloc_shared<DataT>(1024, Q), Op);
   test<true>(Q, malloc_shared<DataT>(1024, Q), Op);
   test<true>(Q, malloc_device<DataT>(1024, Q), Op);
-}
\ No newline at end of file
+}

>From d857b9d3ef08fa4ec22fa11536e6c6db82e36348 Mon Sep 17 00:00:00 2001
From: Sergey Semenov <sergey.semenov at intel.com>
Date: Thu, 3 Sep 2026 10:08:33 -0700
Subject: [PATCH 5/6] Drop using namespace sycl from lit test

---
 libsycl/test/usm/fill.cpp                      |  2 +-
 .../test/usm/include/fill_memset_common.hpp    | 18 ++++++++----------
 libsycl/test/usm/memset.cpp                    |  2 +-
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/libsycl/test/usm/fill.cpp b/libsycl/test/usm/fill.cpp
index 9379013c91b55..7313c2f194616 100644
--- a/libsycl/test/usm/fill.cpp
+++ b/libsycl/test/usm/fill.cpp
@@ -5,6 +5,6 @@
 #include "include/fill_memset_common.hpp"
 
 int main() {
-  queue Q;
+  sycl::queue Q;
   runTests<int>(Q, [&](void *Ptr) { Q.fill(Ptr, Pattern, DataSize); });
 }
diff --git a/libsycl/test/usm/include/fill_memset_common.hpp b/libsycl/test/usm/include/fill_memset_common.hpp
index 64b22129321d3..bbab779e1aaa1 100644
--- a/libsycl/test/usm/include/fill_memset_common.hpp
+++ b/libsycl/test/usm/include/fill_memset_common.hpp
@@ -3,8 +3,6 @@
 #include <array>
 #include <cassert>
 
-using namespace sycl;
-
 constexpr std::size_t DataSize = 1024;
 constexpr int Pattern = 42;
 
@@ -16,12 +14,12 @@ template <typename DataT> bool verify(DataT *Ptr) {
 }
 
 template <bool VerifyOnDevice, typename DataT, typename OpT>
-void test(queue &Q, DataT *Ptr, OpT Op) {
+void test(sycl::queue &Q, DataT *Ptr, OpT Op) {
   Op(Ptr);
   Q.wait();
 
   if constexpr (VerifyOnDevice) {
-    bool *Result = malloc_shared<bool>(1, Q);
+    bool *Result = sycl::malloc_shared<bool>(1, Q);
     Q.single_task<class Verify>([=]() { verify(Ptr); });
     Q.wait();
     assert(Result);
@@ -33,10 +31,10 @@ void test(queue &Q, DataT *Ptr, OpT Op) {
   sycl::free(Ptr, Q);
 }
 
-template <typename DataT, typename OpT> void runTests(queue &Q, OpT Op) {
-  test<false>(Q, malloc_host<DataT>(1024, Q), Op);
-  test<true>(Q, malloc_host<DataT>(1024, Q), Op);
-  test<false>(Q, malloc_shared<DataT>(1024, Q), Op);
-  test<true>(Q, malloc_shared<DataT>(1024, Q), Op);
-  test<true>(Q, malloc_device<DataT>(1024, Q), Op);
+template <typename DataT, typename OpT> void runTests(sycl::queue &Q, OpT Op) {
+  test<false>(Q, sycl::malloc_host<DataT>(1024, Q), Op);
+  test<true>(Q, sycl::malloc_host<DataT>(1024, Q), Op);
+  test<false>(Q, sycl::malloc_shared<DataT>(1024, Q), Op);
+  test<true>(Q, sycl::malloc_shared<DataT>(1024, Q), Op);
+  test<true>(Q, sycl::malloc_device<DataT>(1024, Q), Op);
 }
diff --git a/libsycl/test/usm/memset.cpp b/libsycl/test/usm/memset.cpp
index 4045b34b77564..bc5dd2eee3c78 100644
--- a/libsycl/test/usm/memset.cpp
+++ b/libsycl/test/usm/memset.cpp
@@ -5,7 +5,7 @@
 #include "include/fill_memset_common.hpp"
 
 int main() {
-  queue Q;
+  sycl::queue Q;
   runTests<unsigned char>(Q,
                           [&](void *Ptr) { Q.memset(Ptr, Pattern, DataSize); });
 }

>From 6909eafbcdbf426f89f7a572452284b5a75e3092 Mon Sep 17 00:00:00 2001
From: Sergey Semenov <sergey.semenov at intel.com>
Date: Mon, 7 Sep 2026 06:06:21 -0700
Subject: [PATCH 6/6] Apply comments

---
 libsycl/include/sycl/__impl/queue.hpp         | 43 ++++++++++---------
 libsycl/src/detail/queue_impl.cpp             |  8 +++-
 libsycl/src/detail/queue_impl.hpp             |  3 +-
 libsycl/src/queue.cpp                         |  8 ++--
 .../test/usm/include/fill_memset_common.hpp   | 18 ++++----
 libsycl/unittests/queue/fill.cpp              |  9 ++--
 libsycl/unittests/queue/memset.cpp            |  3 +-
 7 files changed, 48 insertions(+), 44 deletions(-)

diff --git a/libsycl/include/sycl/__impl/queue.hpp b/libsycl/include/sycl/__impl/queue.hpp
index c117fb5062581..086e19abf5abc 100644
--- a/libsycl/include/sycl/__impl/queue.hpp
+++ b/libsycl/include/sycl/__impl/queue.hpp
@@ -442,9 +442,9 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<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.
+  /// Submits a memset operation on a USM allocation that must be 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
@@ -455,9 +455,9 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
     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.
+  /// Submits a memset operation on a USM allocation that must be 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
@@ -470,9 +470,9 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
     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.
+  /// Submits a memset operation on a USM allocation that must be 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
@@ -486,24 +486,24 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
     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.
+  /// Submits a fill operation that replicates a pattern into a USM allocation
+  /// that must be 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 count is the number of times the pattern is replicated.
   /// \return an event that represents the status of the operation.
   template <typename T>
   event fill(void *ptr, const T &pattern, std::size_t count) {
     return fill(ptr, pattern, count, std::vector<event>{});
   }
 
-  /// Submits a fill operation that replicates a pattern into USM accessible
-  /// on the device associated with the queue.
+  /// Submits a fill operation that replicates a pattern into a USM allocation
+  /// that must be 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 count is the number of times the pattern is replicated.
   /// \param depEvent is an event that represents a dependency for the
   /// operation.
   /// \return an event that represents the status of the operation.
@@ -512,12 +512,12 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
     return fill(ptr, pattern, count, std::vector<event>{depEvent});
   }
 
-  /// Submits a fill operation that replicates a pattern into USM accessible
-  /// on the device associated with the queue.
+  /// Submits a fill operation that replicates a pattern into a USM allocation
+  /// that must be 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 count is the number of times the pattern is replicated.
   /// \param depEvents is a vector of events that represent dependencies for the
   /// operation.
   /// \return an event that represents the status of the operation.
@@ -620,15 +620,16 @@ class _LIBSYCL_EXPORT queue : private detail::KernelSubmissionBase<queue> {
   /// \return an event representing last kernel invocation.
   event getLastEvent();
 
-  /// Submits a fill operation that replicates a pattern into USM accessible
-  /// on the device associated with the queue.
+  /// Submits a fill operation that replicates a pattern into a USM allocation
+  /// that must be 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 PatternSize is the size of the pattern in bytes.
-  /// \param Count is the number of times the pattern is filled.
+  /// \param Count is the number of times the pattern is replicated.
   /// \param DepEvents is a vector of events that represent dependencies for the
   /// operation.
+  /// \return an event that represents the status of the operation.
   event fillImpl(void *Ptr, const void *Pattern, std::size_t PatternSize,
                  std::size_t Count, const std::vector<event> &DepEvents);
 
diff --git a/libsycl/src/detail/queue_impl.cpp b/libsycl/src/detail/queue_impl.cpp
index 1def95918ea27..3b2e139e43bdd 100644
--- a/libsycl/src/detail/queue_impl.cpp
+++ b/libsycl/src/detail/queue_impl.cpp
@@ -16,6 +16,7 @@
 #include <detail/program_manager.hpp>
 
 #include <algorithm>
+#include <cstdint>
 
 _LIBSYCL_BEGIN_NAMESPACE_SYCL
 
@@ -175,7 +176,7 @@ QueueImpl::memcpy(void *Dest, const void *Src, std::size_t NumBytes,
 EventImplPtr QueueImpl::fill(void *Ptr, const void *Pattern,
                              std::size_t PatternSize, std::size_t Count,
                              const std::vector<EventImplPtr> &DepEvents) {
-  assert(PatternSize > 0);
+  assert(PatternSize > 0 && "Pattern size has to be greater than zero");
   checkEventsPlatformMatch(DepEvents, MDevice.getPlatformImpl());
   if (Count == 0) {
     handleEventDependencies(DepEvents);
@@ -186,6 +187,11 @@ EventImplPtr QueueImpl::fill(void *Ptr, const void *Pattern,
     throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
                           "Nullptr argument in fill/memset operation");
   }
+  if (Count > SIZE_MAX / PatternSize) {
+    throw sycl::exception(
+        sycl::make_error_code(sycl::errc::invalid),
+        "Total number of bytes to be filled exceeds SIZE_MAX");
+  }
 
   handleEventDependencies(DepEvents);
   callAndThrow(olMemFill, MOffloadQueue, Ptr, PatternSize, Pattern,
diff --git a/libsycl/src/detail/queue_impl.hpp b/libsycl/src/detail/queue_impl.hpp
index dd179141b745b..1cf406c91bef6 100644
--- a/libsycl/src/detail/queue_impl.hpp
+++ b/libsycl/src/detail/queue_impl.hpp
@@ -130,9 +130,10 @@ class QueueImpl : public std::enable_shared_from_this<QueueImpl> {
   ///
   /// \param Ptr is the pointer to memory to be filled.
   /// \param Pattern is the pattern to be replicated.
-  /// \param PatternSize is the size of the pattern.
+  /// \param PatternSize is the size of the pattern in bytes.
   /// \param Count is the number of times the pattern is filled.
   /// \param DepEvents is a vector of dependencies for the operation.
+  /// \return an event impl object that represents the status of the operation.
   EventImplPtr fill(void *Ptr, const void *Pattern, std::size_t PatternSize,
                     std::size_t Count,
                     const std::vector<EventImplPtr> &DepEvents);
diff --git a/libsycl/src/queue.cpp b/libsycl/src/queue.cpp
index 40c9fb50bf27c..a8b183c7289bc 100644
--- a/libsycl/src/queue.cpp
+++ b/libsycl/src/queue.cpp
@@ -69,10 +69,6 @@ void queue::submitKernelImpl(detail::DeviceKernelInfo &KernelInfo,
   impl->submitKernelImpl(KernelInfo, ArgData, ArgSize);
 }
 
-event queue::submitWithHandler(const TypelessCGF &CGF) {
-  return detail::createSyclObjFromImpl<event>(impl->submitWithHandler(CGF));
-}
-
 event queue::fillImpl(void *Ptr, const void *Pattern, std::size_t PatternSize,
                       std::size_t Count, const std::vector<event> &DepEvents) {
   std::shared_ptr<detail::EventImpl> EventImplPtr = impl->fill(
@@ -81,4 +77,8 @@ event queue::fillImpl(void *Ptr, const void *Pattern, std::size_t PatternSize,
   return detail::createSyclObjFromImpl<event>(EventImplPtr);
 }
 
+event queue::submitWithHandler(const TypelessCGF &CGF) {
+  return detail::createSyclObjFromImpl<event>(impl->submitWithHandler(CGF));
+}
+
 _LIBSYCL_END_NAMESPACE_SYCL
diff --git a/libsycl/test/usm/include/fill_memset_common.hpp b/libsycl/test/usm/include/fill_memset_common.hpp
index bbab779e1aaa1..acf141cef5588 100644
--- a/libsycl/test/usm/include/fill_memset_common.hpp
+++ b/libsycl/test/usm/include/fill_memset_common.hpp
@@ -1,13 +1,12 @@
 #include <sycl/sycl.hpp>
 
-#include <array>
 #include <cassert>
 
 constexpr std::size_t DataSize = 1024;
 constexpr int Pattern = 42;
 
 template <typename DataT> bool verify(DataT *Ptr) {
-  for (int I = 0; I < DataSize; ++I)
+  for (std::size_t I = 0; I < DataSize; ++I)
     if (Ptr[I] != Pattern)
       return false;
   return true;
@@ -20,21 +19,20 @@ void test(sycl::queue &Q, DataT *Ptr, OpT Op) {
 
   if constexpr (VerifyOnDevice) {
     bool *Result = sycl::malloc_shared<bool>(1, Q);
-    Q.single_task<class Verify>([=]() { verify(Ptr); });
+    Q.single_task<class Verify>([=]() { *Result = verify(Ptr); });
     Q.wait();
-    assert(Result);
+    assert(*Result);
     sycl::free(Result, Q);
   } else {
-    Q.wait();
     assert(verify(Ptr));
   }
   sycl::free(Ptr, Q);
 }
 
 template <typename DataT, typename OpT> void runTests(sycl::queue &Q, OpT Op) {
-  test<false>(Q, sycl::malloc_host<DataT>(1024, Q), Op);
-  test<true>(Q, sycl::malloc_host<DataT>(1024, Q), Op);
-  test<false>(Q, sycl::malloc_shared<DataT>(1024, Q), Op);
-  test<true>(Q, sycl::malloc_shared<DataT>(1024, Q), Op);
-  test<true>(Q, sycl::malloc_device<DataT>(1024, Q), Op);
+  test<false>(Q, sycl::malloc_host<DataT>(DataSize, Q), Op);
+  test<true>(Q, sycl::malloc_host<DataT>(DataSize, Q), Op);
+  test<false>(Q, sycl::malloc_shared<DataT>(DataSize, Q), Op);
+  test<true>(Q, sycl::malloc_shared<DataT>(DataSize, Q), Op);
+  test<true>(Q, sycl::malloc_device<DataT>(DataSize, Q), Op);
 }
diff --git a/libsycl/unittests/queue/fill.cpp b/libsycl/unittests/queue/fill.cpp
index d41785def7026..bc29a341449ce 100644
--- a/libsycl/unittests/queue/fill.cpp
+++ b/libsycl/unittests/queue/fill.cpp
@@ -19,12 +19,11 @@ TEST(Queue, Fill) {
   mock::MockWrapper Mock;
   sycl::queue Q;
 
-  int a;
-  int *Ptr = &a;
-  int Pattern;
+  int *Ptr = reinterpret_cast<int *>(1);
+  int Pattern = 42;
   int *PatternPtr = &Pattern;
   constexpr int FillCount = 32;
-  constexpr int FillBytes = FillCount * sizeof(int);
+  constexpr std::size_t FillBytes = FillCount * sizeof(int);
 
   EXPECT_CALL(Mock.get(), olMemFill(_, Ptr, sizeof(int), PatternPtr, FillBytes))
       .Times(3);
@@ -34,7 +33,7 @@ TEST(Queue, Fill) {
   Q.fill(Ptr, Pattern, FillCount, std::vector<sycl::event>{E});
 }
 
-TEST(Queue, FillZeroBytes) {
+TEST(Queue, FillZeroCount) {
   mock::MockWrapper Mock;
   sycl::queue Q;
   EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
diff --git a/libsycl/unittests/queue/memset.cpp b/libsycl/unittests/queue/memset.cpp
index 0f049d2b8679b..80629659dc226 100644
--- a/libsycl/unittests/queue/memset.cpp
+++ b/libsycl/unittests/queue/memset.cpp
@@ -19,8 +19,7 @@ TEST(Queue, Memset) {
   mock::MockWrapper Mock;
   sycl::queue Q;
 
-  int a;
-  int *Ptr = &a;
+  int *Ptr = reinterpret_cast<int *>(1);
   constexpr int FillCount = 32;
   int Pattern = 42;
 



More information about the llvm-commits mailing list