|
@@ -40,6 +40,7 @@ static int copy_opencl_to_ram(void *src_interface, unsigned src_node, void *dst_
|
|
|
static int copy_opencl_to_opencl(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node STARPU_ATTRIBUTE_UNUSED);
|
|
|
static int copy_ram_to_opencl_async(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, cl_event *event);
|
|
|
static int copy_opencl_to_ram_async(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, cl_event *event);
|
|
|
+static int copy_opencl_to_opencl_async(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, cl_event *event);
|
|
|
#endif
|
|
|
|
|
|
static struct starpu_data_copy_methods variable_copy_data_methods_s =
|
|
@@ -64,6 +65,7 @@ static struct starpu_data_copy_methods variable_copy_data_methods_s =
|
|
|
.opencl_to_opencl = copy_opencl_to_opencl,
|
|
|
.ram_to_opencl_async = copy_ram_to_opencl_async,
|
|
|
.opencl_to_ram_async = copy_opencl_to_ram_async,
|
|
|
+ .opencl_to_opencl_async = copy_opencl_to_opencl_async,
|
|
|
#endif
|
|
|
};
|
|
|
|
|
@@ -353,36 +355,24 @@ static int copy_opencl_to_ram(void *src_interface, unsigned src_node STARPU_ATTR
|
|
|
return copy_opencl_to_ram_async(src_interface, src_node, dst_interface, dst_node, NULL);
|
|
|
}
|
|
|
|
|
|
-static int copy_opencl_to_opencl(void *src_interface, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst_interface, unsigned dst_node STARPU_ATTRIBUTE_UNUSED)
|
|
|
+static int copy_opencl_to_opencl_async(void *src_interface, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst_interface, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, cl_event *event)
|
|
|
{
|
|
|
- cl_int err;
|
|
|
-
|
|
|
struct starpu_variable_interface *src_variable = src_interface;
|
|
|
struct starpu_variable_interface *dst_variable = dst_interface;
|
|
|
+ int err,ret;
|
|
|
|
|
|
- cl_mem src_ptr = (cl_mem)src_variable->ptr;
|
|
|
- cl_mem dst_ptr = (cl_mem)dst_variable->ptr;
|
|
|
-
|
|
|
- cl_command_queue cq;
|
|
|
- starpu_opencl_get_current_queue(&cq);
|
|
|
- cl_event event;
|
|
|
-
|
|
|
- STARPU_ASSERT(src_variable->elemsize == dst_variable->elemsize);
|
|
|
- err= clEnqueueCopyBuffer(cq, src_ptr, dst_ptr, 0, 0, src_variable->elemsize, 0, NULL, &event);
|
|
|
- if (STARPU_UNLIKELY(err))
|
|
|
- STARPU_OPENCL_REPORT_ERROR(err);
|
|
|
-
|
|
|
- err = clWaitForEvents(1, &event);
|
|
|
- if (STARPU_UNLIKELY(err))
|
|
|
- STARPU_OPENCL_REPORT_ERROR(err);
|
|
|
-
|
|
|
- err = clReleaseEvent(event);
|
|
|
- if (STARPU_UNLIKELY(err))
|
|
|
- STARPU_OPENCL_REPORT_ERROR(err);
|
|
|
+ err = starpu_opencl_copy_opencl_to_opencl((cl_mem) src_variable->ptr, src_node, (cl_mem) dst_variable->ptr, dst_node, src_variable->elemsize, 0, event, &ret);
|
|
|
+ if (STARPU_UNLIKELY(err))
|
|
|
+ STARPU_OPENCL_REPORT_ERROR(err);
|
|
|
|
|
|
_STARPU_TRACE_DATA_COPY(src_node, dst_node, src_variable->elemsize);
|
|
|
|
|
|
- return 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+static int copy_opencl_to_opencl(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
|
|
|
+{
|
|
|
+ return copy_opencl_to_opencl_async(src_interface, src_node, dst_interface, dst_node, NULL);
|
|
|
}
|
|
|
|
|
|
#endif
|