[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
================
@@ -199,6 +199,35 @@ QueueImpl::memcpy(void *Dest, const void *Src, std::size_t NumBytes,
return createEvent();
}
+EventImplPtr QueueImpl::prefetch(void *Ptr, std::size_t NumBytes,
+ const std::vector<EventImplPtr> &DepEvents) {
+ checkEventsPlatformMatch(DepEvents, MDevice.getPlatformImpl());
+
+ if (NumBytes == 0) {
+ handleEventDependencies(DepEvents);
+ return createEvent();
+ }
+ if (!Ptr) {
+ throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
+ "Nullptr argument in prefetch operation");
+ }
+
+ auto [TargetDevice, IsHost] = getAllocDevice(Ptr);
+
+ std::size_t Count = 1;
+ const void *Mems[] = {Ptr};
+ const std::size_t Sizes[] = {NumBytes};
+
+ ol_mem_migration_flags_t Flag = (MDevice.isCPU())
----------------
KseniyaTikhomirova wrote:
liboffload has no "CPU" term so far, it is using a single "host" device (backend) to represent host side. I think we should stick to this paradigm and check if MDevice != "HostDevice" then. Or we can hardcode single value here since libsycl queues are always device queues.
@sergey-semenov what do you think about this?
https://github.com/llvm/llvm-project/pull/212104
More information about the llvm-commits
mailing list