Skip to content

Commit

Permalink
[SYCL][CUDA] Missing return event on map/unmap (#1658)
Browse files Browse the repository at this point in the history
Signed-off-by: Ruyman Reyes <[email protected]>
  • Loading branch information
Ruyk authored May 12, 2020
1 parent 67d3d9e commit bf1b5b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
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

0 comments on commit bf1b5b6

Please sign in to comment.