Skip to content

[SYCL][CUDA] Missing return event on map/unmap #1658

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 2 commits into from
May 12, 2020
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
23 changes: 16 additions & 7 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2867,11 +2867,9 @@ pi_result cuda_piEnqueueEventsWait(pi_queue command_queue,
}

if (event) {
auto new_event =
_pi_event::make_native(PI_COMMAND_TYPE_MARKER, command_queue);
new_event->start();
new_event->record();
*event = new_event;
*event = _pi_event::make_native(PI_COMMAND_TYPE_MARKER, command_queue);
(*event)->start();
(*event)->record();
}

return PI_SUCCESS;
Expand Down Expand Up @@ -3281,7 +3279,6 @@ pi_result cuda_piEnqueueMemBufferFill(pi_queue command_queue, pi_mem buffer,
return PI_ERROR_UNKNOWN;
}
}

/// \TODO Not implemented in CUDA, requires untie from OpenCL
pi_result cuda_piEnqueueMemImageRead(
pi_queue command_queue, pi_mem image, pi_bool blocking_read,
Expand Down Expand Up @@ -3359,6 +3356,12 @@ pi_result cuda_piEnqueueMemBufferMap(pi_queue command_queue, pi_mem buffer,
ret_err = cuda_piEnqueueMemBufferRead(
command_queue, buffer, blocking_map, offset, size, hostPtr,
num_events_in_wait_list, event_wait_list, retEvent);
} else {
if (retEvent) {
*retEvent =
_pi_event::make_native(PI_COMMAND_TYPE_MEM_BUFFER_MAP, command_queue);
(*retEvent)->record();
}
}

return ret_err;
Expand All @@ -3372,7 +3375,7 @@ pi_result cuda_piEnqueueMemUnmap(pi_queue command_queue, pi_mem memobj,
pi_uint32 num_events_in_wait_list,
const pi_event *event_wait_list,
pi_event *retEvent) {
pi_result ret_err = PI_INVALID_OPERATION;
pi_result ret_err = PI_SUCCESS;

assert(mapped_ptr != nullptr);
assert(memobj != nullptr);
Expand All @@ -3385,6 +3388,12 @@ pi_result cuda_piEnqueueMemUnmap(pi_queue command_queue, pi_mem memobj,
command_queue, memobj, true, memobj->get_map_offset(mapped_ptr),
memobj->get_size(), mapped_ptr, num_events_in_wait_list, event_wait_list,
retEvent);
} else {
if (retEvent) {
*retEvent = _pi_event::make_native(PI_COMMAND_TYPE_MEM_BUFFER_UNMAP,
command_queue);
(*retEvent)->record();
}
}

memobj->unmap(mapped_ptr);
Expand Down
3 changes: 0 additions & 3 deletions sycl/test/scheduler/DataMovement.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// XFAIL: cuda
// TODO: Fix accidential error return when unmapping read-only memory objects.
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -I %sycl_source_dir %s -o %t.out -g
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down