[Mesa-dev] [PATCH v4 1/1] clover: Wait for requested operation if blocking flag is set
Jan Vesely
jan.vesely at rutgers.edu
Sat Sep 16 01:46:05 UTC 2017
On Thu, 2017-09-14 at 14:39 -0700, Francisco Jerez wrote:
> Jan Vesely <jan.vesely at rutgers.edu> writes:
>
> > On Mon, 2017-09-04 at 13:23 -0700, Francisco Jerez wrote:
> > > Jan Vesely <jan.vesely at rutgers.edu> writes:
> > >
> > > > v2: wait in map_buffer and map_image as well
> > > > v3: use event::wait instead of wait (skips fence wait for hard_event)
> > > > v4: use wait_signalled()
> > > >
> > > > Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> > > > ---
> > > > Hi Francisco,
> > > >
> > > > once again sorry for the delay, and thanks for you patience.
> > > > This patch applies on top of the two you attached during our email
> > > > discussion.
> > > > From what I can tell, the functionality is identical to v3 after your
> > > > two patches are applied ("event:wait()" calls "wait_signalled()"), but I
> > > > suppose calling non-virtual function is preferrable. if not, feel free
> > > > to use v3.
> > > >
> > >
> > > Yeah, I find v4 more readable than calling the base class'
> > > implementation of wait(). Patch is:
> > >
> > > Reviewed-by: Francisco Jerez <currojerez at riseup.net>
> >
> > thanks. will you include with the other 2 patches, or should I push it
> > separately after those 2 are in?
> >
>
> I don't have review tags for the other two, but assuming they get your
> R-b feel free to push all the three patches yourself.
they look good to me, now that I understand how they work.
although I'd prefer external review given how long it took me.
@Aaron, do you mind taking a look at the two attached patches?
thanks,
Jan
>
> > regards,
> > Jan
> >
> > >
> > > Thanks.
> > >
> > > > thanks,
> > > > Jan
> > > >
> > > > src/gallium/state_trackers/clover/api/transfer.cpp | 30 ++++++++++++++++++++--
> > > > 1 file changed, 28 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/src/gallium/state_trackers/clover/api/transfer.cpp b/src/gallium/state_trackers/clover/api/transfer.cpp
> > > > index f7046253be..34559042ae 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_signalled();
> > > > +
> > > > 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_signalled();
> > > > +
> > > > 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_signalled();
> > > > +
> > > > ret_object(rd_ev, hev);
> > > > return CL_SUCCESS;
> > > >
> > > > @@ -399,6 +408,9 @@ clEnqueueWriteBufferRect(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking,
> > > > ptr, host_origin, host_pitch,
> > > > region));
> > > >
> > > > + if (blocking)
> > > > + hev().wait_signalled();
> > > > +
> > > > ret_object(rd_ev, hev);
> > > > return CL_SUCCESS;
> > > >
> > > > @@ -504,6 +516,9 @@ clEnqueueReadImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking,
> > > > &img, src_origin, src_pitch,
> > > > region));
> > > >
> > > > + if (blocking)
> > > > + hev().wait_signalled();
> > > > +
> > > > ret_object(rd_ev, hev);
> > > > return CL_SUCCESS;
> > > >
> > > > @@ -538,6 +553,9 @@ clEnqueueWriteImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking,
> > > > ptr, {}, src_pitch,
> > > > region));
> > > >
> > > > + if (blocking)
> > > > + hev().wait_signalled();
> > > > +
> > > > ret_object(rd_ev, hev);
> > > > return CL_SUCCESS;
> > > >
> > > > @@ -667,7 +685,11 @@ clEnqueueMapBuffer(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking,
> > > >
> > > > void *map = mem.resource(q).add_map(q, flags, blocking, obj_origin, region);
> > > >
> > > > - ret_object(rd_ev, create<hard_event>(q, CL_COMMAND_MAP_BUFFER, deps));
> > > > + auto hev = create<hard_event>(q, CL_COMMAND_MAP_BUFFER, deps);
> > > > + if (blocking)
> > > > + hev().wait_signalled();
> > > > +
> > > > + ret_object(rd_ev, hev);
> > > > ret_error(r_errcode, CL_SUCCESS);
> > > > return map;
> > > >
> > > > @@ -695,7 +717,11 @@ 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<hard_event>(q, CL_COMMAND_MAP_IMAGE, deps));
> > > > + auto hev = create<hard_event>(q, CL_COMMAND_MAP_IMAGE, deps);
> > > > + if (blocking)
> > > > + hev().wait_signalled();
> > > > +
> > > > + ret_object(rd_ev, hev);
> > > > ret_error(r_errcode, CL_SUCCESS);
> > > > return map;
> > > >
> > > > --
> > > > 2.13.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-clover-Wrap-event-wait_count-in-a-method-taking-care.patch
Type: text/x-patch
Size: 2834 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170915/70b9e67f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-clover-Run-the-associated-action-before-an-event-is-.patch
Type: text/x-patch
Size: 2878 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170915/70b9e67f/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170915/70b9e67f/attachment.sig>
More information about the mesa-dev
mailing list