[llvm] [libsycl] Initial prefetch implementation for queue (PR #212104)

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 04:09:28 PDT 2026


================
@@ -0,0 +1,56 @@
+#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, TwoPrefetches) {
+  constexpr std::size_t NumBytes = 1024;
+  constexpr int NPrefetches = 2;
+
+  mock::MockWrapper Mock;
+  queue Q;
+
+  void *Ptr = reinterpret_cast<void *>(1);
+
+  bool IsCpu = Q.get_device().is_cpu();
+  ol_mem_migration_flags_t ExpectedFlag =
+      IsCpu ? OL_MEM_MIGRATION_FLAG_DEVICE_TO_HOST
+            : OL_MEM_MIGRATION_FLAG_HOST_TO_DEVICE;
+
+  EXPECT_CALL(Mock.get(), olMemPrefetch(_, 1, _, _, ExpectedFlag))
----------------
KseniyaTikhomirova wrote:

AFAIK: 1 and ExpectedFlag are non-default matchers that means that with current usage checks on lines 31 and 34 useless.
https://google.github.io/googletest/gmock_cook_book.html#performing-different-actions-based-on-the-arguments

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


More information about the llvm-commits mailing list