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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 07:22:49 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))
----------------
Robertkq wrote:

fixed

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


More information about the llvm-commits mailing list