[llvm] [libsycl] Initial prefetch implementation for queue (PR #212104)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 07:26: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())
----------------
Robertkq wrote:
I'd like to wait for more comment here as I really wasn't sure how I can figure out in code what the queue should signal, as is the memory on host? (I think this is what getAllocDevice can help with), but also if the memory should be migrated from host to device or otherwise
https://github.com/llvm/llvm-project/pull/212104
More information about the llvm-commits
mailing list