[llvm] [libsycl] Implement USM fill & memset queue API (PR #217933)
Kseniya Tikhomirova via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 06:55:59 PDT 2026
================
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include <cstdint>
+
+using namespace ::testing;
+
+TEST(Queue, Fill) {
+ mock::MockWrapper Mock;
+ sycl::queue Q;
+
+ int *Ptr = reinterpret_cast<int *>(1);
+ int Pattern = 42;
+ int *PatternPtr = &Pattern;
+ constexpr int FillCount = 32;
+ constexpr std::size_t FillBytes = FillCount * sizeof(int);
+
+ EXPECT_CALL(Mock.get(), olMemFill(_, Ptr, sizeof(int), PatternPtr, FillBytes))
+ .Times(3);
+ EXPECT_CALL(Mock.get(), olWaitEvents(_, _, 1)).Times(2);
+ sycl::event E = Q.fill(Ptr, Pattern, FillCount);
+ Q.fill(Ptr, Pattern, FillCount, E);
+ Q.fill(Ptr, Pattern, FillCount, std::vector<sycl::event>{E});
----------------
KseniyaTikhomirova wrote:
may be it makes sense to add Q.wait() to the end of test cases. these calls are fully synchronous now but it is not guaranteed to stay like this in future.
https://github.com/llvm/llvm-project/pull/217933
More information about the llvm-commits
mailing list