[Beignet] [PATCH] Refine mem.h and improve the related macro defination.

He Junyan junyan.he at inbox.com
Thu Dec 22 10:49:48 UTC 2016


According to my understanding, PIPE is also a mem object.
clGetMemObjectInfo can be used to query all kinds of mem object.
clGetPipeInfo just query additional PIPE info.
According to CL spec, it just says query CL_MEM_HOST_PTR return
the host ptr if image/buffer created by CL_MEM_USE_HOST_PTR is specified,
otherwise, return NULL.
So, as a PIPE, I think it just retuns NULL and it that correct?


On Tue, Dec 20, 2016 at 09:05:41AM +0100, Simon Richter wrote:
> Date: Tue, 20 Dec 2016 09:05:41 +0100
> From: Simon Richter <Simon.Richter at hogyros.de>
> To: beignet at lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH] Refine mem.h and improve the related macro
>  defination.
> 
> Hi,
> 
> On 20.12.2016 04:23, He Junyan wrote:
> 
> >>> +    if (!CL_OBJECT_IS_BUFFER(memobj)) {
> 
> >> That would match pipes as well, is that intended?
> 
> > Already redefine CL_OBJECT_IS_BUFFER to just match buffer and subbuffer.
> 
> > +#define CL_OBJECT_IS_BUFFER(mem) ((mem &&                                                 \
> > +                                   ((cl_base_object)mem)->magic == CL_OBJECT_MEM_MAGIC && \
> > +                                   CL_OBJECT_GET_REF(mem) >= 1 &&                         \
> > +                                   ((cl_mem)mem)->type <= CL_MEM_SUBBUFFER_TYPE))
> 
> Exactly my point. A pipe object would not match CL_OBJECT_IS_BUFFER(),
> so the negated test would return true, and the code would look at
> memobj->host_ptr in a pipe object, which is wrong.
> 
>    Simon
> 
> 




> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet





More information about the Beignet mailing list