Skip to content

[SYCL] Ignore usm prefetch dummy flag #4568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4589,22 +4589,20 @@ pi_result cuda_piextUSMEnqueueMemcpy(pi_queue queue, pi_bool blocking,
return result;
}

// flags is currently ignored as it is a placeholder for future features
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor, but it is not "ignored" anymore, so maybe the comment should be inside the function and be adapted to reflect the new behavior for unrecognized flags.

pi_result cuda_piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr,
size_t size,
pi_usm_migration_flags flags,
pi_uint32 num_events_in_waitlist,
const pi_event *events_waitlist,
pi_event *event) {
assert(queue != nullptr);
assert(!(flags & ~PI_USM_MIGRATION_TBD0), PI_INVALID_VALUE)
assert(queue != nullptr);
assert(ptr != nullptr);
CUstream cuStream = queue->get();
pi_result result = PI_SUCCESS;
std::unique_ptr<_pi_event> event_ptr{nullptr};

// TODO implement handling the flags once the expected behaviour
// of piextUSMEnqueuePrefetch is detailed in the USM extension
assert(flags == 0u);

try {
ScopedContext active(queue->get_context());
result = cuda_piEnqueueEventsWait(queue, num_events_in_waitlist,
Expand Down
6 changes: 2 additions & 4 deletions sycl/plugins/hip/pi_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4426,22 +4426,20 @@ pi_result hip_piextUSMEnqueueMemcpy(pi_queue queue, pi_bool blocking,
return result;
}

// flags is currently ignored as it is a placeholder for future features
pi_result hip_piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr,
size_t size, pi_usm_migration_flags flags,
pi_uint32 num_events_in_waitlist,
const pi_event *events_waitlist,
pi_event *event) {

assert(!(flags & ~PI_USM_MIGRATION_TBD0));
assert(queue != nullptr);
assert(ptr != nullptr);
hipStream_t hipStream = queue->get();
pi_result result = PI_SUCCESS;
std::unique_ptr<_pi_event> event_ptr{nullptr};

// TODO implement handling the flags once the expected behaviour
// of piextUSMEnqueuePrefetch is detailed in the USM extension
assert(flags == 0u);

try {
ScopedContext active(queue->get_context());
result = hip_piEnqueueEventsWait(queue, num_events_in_waitlist,
Expand Down
1 change: 1 addition & 0 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6628,6 +6628,7 @@ pi_result piextUSMEnqueueMemcpy(pi_queue Queue, pi_bool Blocking, void *DstPtr,
/// @param NumEventsInWaitlist is the number of events to wait on
/// @param EventsWaitlist is an array of events to wait on
/// @param Event is the event that represents this operation
// flags is currently ignored as it is a placeholder for future features
pi_result piextUSMEnqueuePrefetch(pi_queue Queue, const void *Ptr, size_t Size,
pi_usm_migration_flags Flags,
pi_uint32 NumEventsInWaitList,
Expand Down
4 changes: 3 additions & 1 deletion sycl/plugins/opencl/pi_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,14 +1005,16 @@ pi_result piextUSMEnqueueMemcpy(pi_queue queue, pi_bool blocking, void *dst_ptr,
/// \param num_events_in_waitlist is the number of events to wait on
/// \param events_waitlist is an array of events to wait on
/// \param event is the event that represents this operation
// flags is currently ignored as it is a placeholder for future features
pi_result piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr, size_t size,
pi_usm_migration_flags flags,
pi_uint32 num_events_in_waitlist,
const pi_event *events_waitlist,
pi_event *event) {
(void)ptr;
(void)size;
(void)flags;

assert(!(flags & ~PI_USM_MIGRATION_TBD0));

return cast<pi_result>(clEnqueueMarkerWithWaitList(
cast<cl_command_queue>(queue), num_events_in_waitlist,
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ void MemoryManager::prefetch_usm(void *Mem, QueueImplPtr Queue, size_t Length,
} else {
const detail::plugin &Plugin = Queue->getPlugin();
Plugin.call<PiApiKind::piextUSMEnqueuePrefetch>(
Queue->getHandleRef(), Mem, Length, PI_USM_MIGRATION_TBD0,
Queue->getHandleRef(), Mem, Length, _pi_usm_migration_flags(0),
DepEvents.size(), DepEvents.data(), &OutEvent);
}
}
Expand Down