[Mesa-dev] [PATCH] clover: clEnqueue* should block when asked for
As a side effect, this fix clRetain/ReleaseEvent Piglit test --- src/gallium/state_trackers/clover/api/transfer.cpp | 29 -- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/clover/api/transfer.cpp b/src/gallium/state_trackers/clover/api/transfer.cpp index fdb9405..c2f4f13 100644 --- a/src/gallium/state_trackers/clover/api/transfer.cpp +++ b/src/gallium/state_trackers/clover/api/transfer.cpp @@ -295,6 +295,9 @@ clEnqueueReadBuffer(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, &mem, obj_origin, obj_pitch, region)); + if (blocking) + hev().wait(); + ret_object(rd_ev, hev); return CL_SUCCESS; @@ -325,6 +328,9 @@ clEnqueueWriteBuffer(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, ptr, {}, obj_pitch, region)); + if (blocking) + hev().wait(); + ret_object(rd_ev, hev); return CL_SUCCESS; @@ -362,6 +368,9 @@ clEnqueueReadBufferRect(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, &mem, obj_origin, obj_pitch, region)); + if (blocking) + hev().wait(); + ret_object(rd_ev, hev); return CL_SUCCESS; @@ -398,6 +407,8 @@ clEnqueueWriteBufferRect(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, soft_copy_op(q, &mem, obj_origin, obj_pitch, ptr, host_origin, host_pitch, region)); + if (blocking) + hev().wait(); ret_object(rd_ev, hev); return CL_SUCCESS; @@ -504,6 +515,9 @@ clEnqueueReadImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, &img, src_origin, src_pitch, region)); + if (blocking) + hev().wait(); + ret_object(rd_ev, hev); return CL_SUCCESS; @@ -537,6 +551,8 @@ clEnqueueWriteImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, soft_copy_op(q, &img, dst_origin, dst_pitch, ptr, {}, src_pitch, region)); + if (blocking) + hev().wait(); ret_object(rd_ev, hev); return CL_SUCCESS; @@ -666,8 +682,12 @@ clEnqueueMapBuffer(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, validate_map_flags(mem, flags); void *map = mem.resource(q).add_map(q, flags, blocking, obj_origin, region); + auto hev = create(q, CL_COMMAND_MAP_BUFFER, deps); + + if (blocking) + hev().wait(); - ret_object(rd_ev, create(q, CL_COMMAND_MAP_BUFFER, deps)); + ret_object(rd_ev, hev); ret_error(r_errcode, CL_SUCCESS); return map; @@ -695,7 +715,12 @@ clEnqueueMapImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, void *map = img.resource(q).add_map(q, flags, blocking, origin, region); - ret_object(rd_ev, create(q, CL_COMMAND_MAP_IMAGE, deps)); + auto hev = create(q, CL_COMMAND_MAP_IMAGE, deps); + + if (blocking) + hev().wait(); + + ret_object(rd_ev, hev); ret_error(r_errcode, CL_SUCCESS); return map; -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] clover: clEnqueue* should block when asked for
EdB writes: > As a side effect, this fix clRetain/ReleaseEvent Piglit test > --- > src/gallium/state_trackers/clover/api/transfer.cpp | 29 > -- > 1 file changed, 27 insertions(+), 2 deletions(-) > > diff --git a/src/gallium/state_trackers/clover/api/transfer.cpp > b/src/gallium/state_trackers/clover/api/transfer.cpp > index fdb9405..c2f4f13 100644 > --- a/src/gallium/state_trackers/clover/api/transfer.cpp > +++ b/src/gallium/state_trackers/clover/api/transfer.cpp > @@ -295,6 +295,9 @@ clEnqueueReadBuffer(cl_command_queue d_q, cl_mem d_mem, > cl_bool blocking, > &mem, obj_origin, obj_pitch, > region)); > > + if (blocking) > + hev().wait(); > + > ret_object(rd_ev, hev); > return CL_SUCCESS; > > @@ -325,6 +328,9 @@ clEnqueueWriteBuffer(cl_command_queue d_q, cl_mem d_mem, > cl_bool blocking, > ptr, {}, obj_pitch, > region)); > > + if (blocking) > + hev().wait(); > + > ret_object(rd_ev, hev); > return CL_SUCCESS; > > @@ -362,6 +368,9 @@ clEnqueueReadBufferRect(cl_command_queue d_q, cl_mem > d_mem, cl_bool blocking, > &mem, obj_origin, obj_pitch, > region)); > > + if (blocking) > + hev().wait(); > + > ret_object(rd_ev, hev); > return CL_SUCCESS; > > @@ -398,6 +407,8 @@ clEnqueueWriteBufferRect(cl_command_queue d_q, cl_mem > d_mem, cl_bool blocking, >soft_copy_op(q, &mem, obj_origin, obj_pitch, > ptr, host_origin, host_pitch, > region)); > + if (blocking) > + hev().wait(); > > ret_object(rd_ev, hev); > return CL_SUCCESS; > @@ -504,6 +515,9 @@ clEnqueueReadImage(cl_command_queue d_q, cl_mem d_mem, > cl_bool blocking, > &img, src_origin, src_pitch, > region)); > > + if (blocking) > + hev().wait(); > + > ret_object(rd_ev, hev); > return CL_SUCCESS; > > @@ -537,6 +551,8 @@ clEnqueueWriteImage(cl_command_queue d_q, cl_mem d_mem, > cl_bool blocking, >soft_copy_op(q, &img, dst_origin, dst_pitch, > ptr, {}, src_pitch, > region)); > + if (blocking) > + hev().wait(); > > ret_object(rd_ev, hev); > return CL_SUCCESS; > @@ -666,8 +682,12 @@ clEnqueueMapBuffer(cl_command_queue d_q, cl_mem d_mem, > cl_bool blocking, > validate_map_flags(mem, flags); > > void *map = mem.resource(q).add_map(q, flags, blocking, obj_origin, > region); > + auto hev = create(q, CL_COMMAND_MAP_BUFFER, deps); > + > + if (blocking) > + hev().wait(); > > - ret_object(rd_ev, create(q, CL_COMMAND_MAP_BUFFER, deps)); > + ret_object(rd_ev, hev); > ret_error(r_errcode, CL_SUCCESS); > return map; > > @@ -695,7 +715,12 @@ clEnqueueMapImage(cl_command_queue d_q, cl_mem d_mem, > cl_bool blocking, > > void *map = img.resource(q).add_map(q, flags, blocking, origin, region); > > - ret_object(rd_ev, create(q, CL_COMMAND_MAP_IMAGE, deps)); > + auto hev = create(q, CL_COMMAND_MAP_IMAGE, deps); > + > + if (blocking) > + hev().wait(); > + > + ret_object(rd_ev, hev); > ret_error(r_errcode, CL_SUCCESS); > return map; > > -- > 2.1.0 This has come up several times already, and the naive fix has a number of problems -- Last time [1] I proposed an alternative solution to avoid them, not sure if Grigori is still planning to look into it. [1] http://lists.freedesktop.org/archives/mesa-dev/2015-June/086110.html signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] clover: clEnqueue* should block when asked for
On Mon, Aug 03, 2015 at 12:53:32PM +0300, Francisco Jerez wrote: > EdB writes: > > > As a side effect, this fix clRetain/ReleaseEvent Piglit test > > --- > > src/gallium/state_trackers/clover/api/transfer.cpp | 29 > > -- > > 1 file changed, 27 insertions(+), 2 deletions(-) > > > > diff --git a/src/gallium/state_trackers/clover/api/transfer.cpp > > b/src/gallium/state_trackers/clover/api/transfer.cpp > > index fdb9405..c2f4f13 100644 > > --- a/src/gallium/state_trackers/clover/api/transfer.cpp > > +++ b/src/gallium/state_trackers/clover/api/transfer.cpp > > @@ -295,6 +295,9 @@ clEnqueueReadBuffer(cl_command_queue d_q, cl_mem d_mem, > > cl_bool blocking, > > &mem, obj_origin, obj_pitch, > > region)); > > > > + if (blocking) > > + hev().wait(); > > + > > ret_object(rd_ev, hev); > > return CL_SUCCESS; > > > > @@ -325,6 +328,9 @@ clEnqueueWriteBuffer(cl_command_queue d_q, cl_mem > > d_mem, cl_bool blocking, > > ptr, {}, obj_pitch, > > region)); > > > > + if (blocking) > > + hev().wait(); > > + > > ret_object(rd_ev, hev); > > return CL_SUCCESS; > > > > @@ -362,6 +368,9 @@ clEnqueueReadBufferRect(cl_command_queue d_q, cl_mem > > d_mem, cl_bool blocking, > > &mem, obj_origin, obj_pitch, > > region)); > > > > + if (blocking) > > + hev().wait(); > > + > > ret_object(rd_ev, hev); > > return CL_SUCCESS; > > > > @@ -398,6 +407,8 @@ clEnqueueWriteBufferRect(cl_command_queue d_q, cl_mem > > d_mem, cl_bool blocking, > >soft_copy_op(q, &mem, obj_origin, obj_pitch, > > ptr, host_origin, host_pitch, > > region)); > > + if (blocking) > > + hev().wait(); > > > > ret_object(rd_ev, hev); > > return CL_SUCCESS; > > @@ -504,6 +515,9 @@ clEnqueueReadImage(cl_command_queue d_q, cl_mem d_mem, > > cl_bool blocking, > > &img, src_origin, src_pitch, > > region)); > > > > + if (blocking) > > + hev().wait(); > > + > > ret_object(rd_ev, hev); > > return CL_SUCCESS; > > > > @@ -537,6 +551,8 @@ clEnqueueWriteImage(cl_command_queue d_q, cl_mem d_mem, > > cl_bool blocking, > >soft_copy_op(q, &img, dst_origin, dst_pitch, > > ptr, {}, src_pitch, > > region)); > > + if (blocking) > > + hev().wait(); > > > > ret_object(rd_ev, hev); > > return CL_SUCCESS; > > @@ -666,8 +682,12 @@ clEnqueueMapBuffer(cl_command_queue d_q, cl_mem d_mem, > > cl_bool blocking, > > validate_map_flags(mem, flags); > > > > void *map = mem.resource(q).add_map(q, flags, blocking, obj_origin, > > region); > > + auto hev = create(q, CL_COMMAND_MAP_BUFFER, deps); > > + > > + if (blocking) > > + hev().wait(); > > > > - ret_object(rd_ev, create(q, CL_COMMAND_MAP_BUFFER, deps)); > > + ret_object(rd_ev, hev); > > ret_error(r_errcode, CL_SUCCESS); > > return map; > > > > @@ -695,7 +715,12 @@ clEnqueueMapImage(cl_command_queue d_q, cl_mem d_mem, > > cl_bool blocking, > > > > void *map = img.resource(q).add_map(q, flags, blocking, origin, region); > > > > - ret_object(rd_ev, create(q, CL_COMMAND_MAP_IMAGE, deps)); > > + auto hev = create(q, CL_COMMAND_MAP_IMAGE, deps); > > + > > + if (blocking) > > + hev().wait(); > > + > > + ret_object(rd_ev, hev); > > ret_error(r_errcode, CL_SUCCESS); > > return map; > > > > -- > > 2.1.0 > > This has come up several times already, and the naive fix has a number > of problems -- Last time [1] I proposed an alternative solution to avoid > them, not sure if Grigori is still planning to look into it. > I think someone should add a comment to these functions, so we don't keep getting this same patch. -Tom > [1] http://lists.freedesktop.org/archives/mesa-dev/2015-June/086110.html > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev