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 all 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
3 changes: 3 additions & 0 deletions sycl/include/CL/sycl/detail/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,9 @@ typedef enum : pi_bitfield {
PI_MEM_ALLOC_FLAGS = CL_MEM_ALLOC_FLAGS_INTEL
} _pi_usm_mem_properties;

// Flag is used for piProgramUSMEnqueuePrefetch. PI_USM_MIGRATION_TBD0 is a
// placeholder for future developments and should not change the behaviour of
// piProgramUSMEnqueuePrefetch
typedef enum : pi_bitfield {
PI_USM_MIGRATION_TBD0 = (1 << 0)
} _pi_usm_migration_flags;
Expand Down
8 changes: 4 additions & 4 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4595,16 +4595,16 @@ pi_result cuda_piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr,
pi_uint32 num_events_in_waitlist,
const pi_event *events_waitlist,
pi_event *event) {

// flags is currently unused so fail if set
if (flags != 0)
return 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
7 changes: 3 additions & 4 deletions sycl/plugins/hip/pi_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4432,16 +4432,15 @@ pi_result hip_piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr,
const pi_event *events_waitlist,
pi_event *event) {

// flags is currently unused so fail if set
if (flags != 0)
return PI_INVALID_VALUE;
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
4 changes: 3 additions & 1 deletion sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6633,7 +6633,9 @@ pi_result piextUSMEnqueuePrefetch(pi_queue Queue, const void *Ptr, size_t Size,
pi_uint32 NumEventsInWaitList,
const pi_event *EventWaitList,
pi_event *Event) {
PI_ASSERT(!(Flags & ~PI_USM_MIGRATION_TBD0), PI_INVALID_VALUE);

// flags is currently unused so fail if set
PI_ASSERT(Flags == 0, PI_INVALID_VALUE);
PI_ASSERT(Queue, PI_INVALID_QUEUE);
PI_ASSERT(Event, PI_INVALID_EVENT);

Expand Down
5 changes: 4 additions & 1 deletion sycl/plugins/opencl/pi_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,10 @@ pi_result piextUSMEnqueuePrefetch(pi_queue queue, const void *ptr, size_t size,
pi_event *event) {
(void)ptr;
(void)size;
(void)flags;

// flags is currently unused so fail if set
if (flags != 0)
return PI_INVALID_VALUE;

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