[cfe-dev] [OpenCL] Representing kernel attributes by LLVM target-dependent attribute-value pairs instead of metadata

Liu, Yaxun (Sam) via cfe-dev cfe-dev at lists.llvm.org
Mon May 30 11:02:36 PDT 2016


>> If the kernel_arg_type is optional, we will not be able to know that a sampler type kernel argument is a sampler type, since it becomes int type in LLVM. Is that OK for the backend and runtime?
> Would representing as metadata help here?

It is OK as long as it is not dropped by some passes before consumed by the backend.

Sam

-----Original Message-----
From: Anastasia Stulova [mailto:Anastasia.Stulova at arm.com] 
Sent: Wednesday, May 25, 2016 12:04 PM
To: Liu, Yaxun (Sam) <Yaxun.Liu at amd.com>; Tom Stellard <tom at stellard.net>
Cc: cfe-dev (cfe-dev at lists.llvm.org) <cfe-dev at lists.llvm.org>; Pan, Xiuli <xiuli.pan at intel.com>; Bader, Alexey (alexey.bader at intel.com) <alexey.bader at intel.com>; Mekhanoshin, Stanislav <Stanislav.Mekhanoshin at amd.com>; Stellard, Thomas <Tom.Stellard at amd.com>; Sumner, Brian <Brian.Sumner at amd.com>; nd <nd at arm.com>
Subject: RE: [cfe-dev] [OpenCL] Representing kernel attributes by LLVM target-dependent attribute-value pairs instead of metadata

I agree with Tom that the function metadata seems to be more appropriate for this purpose.

> If the kernel_arg_type is optional, we will not be able to know that a sampler type kernel argument is a sampler type, since it becomes int type in LLVM. Is that OK for the backend and runtime?
Would representing as metadata help here?

-----Original Message-----
From: Liu, Yaxun (Sam) [mailto:Yaxun.Liu at amd.com] 
Sent: 13 May 2016 15:18
To: Tom Stellard
Cc: cfe-dev (cfe-dev at lists.llvm.org); Anastasia Stulova; Pan, Xiuli; Bader, Alexey (alexey.bader at intel.com); Mekhanoshin, Stanislav; Stellard, Thomas; Sumner, Brian
Subject: RE: [cfe-dev] [OpenCL] Representing kernel attributes by LLVM target-dependent attribute-value pairs instead of metadata

If the kernel_arg_type is optional, we will not be able to know that a sampler type kernel argument is a sampler type, since it becomes int type in LLVM. Is that OK for the backend and runtime?

Thanks.

Sam

-----Original Message-----
From: Tom Stellard [mailto:tom at stellard.net] 
Sent: Thursday, May 12, 2016 11:55 AM
To: Liu, Yaxun (Sam) <Yaxun.Liu at amd.com>
Cc: cfe-dev (cfe-dev at lists.llvm.org) <cfe-dev at lists.llvm.org>; 'anastasia.stulova at arm.com' <anastasia.stulova at arm.com>; Pan, Xiuli <xiuli.pan at intel.com>; Bader, Alexey (alexey.bader at intel.com) <alexey.bader at intel.com>; Mekhanoshin, Stanislav <Stanislav.Mekhanoshin at amd.com>; Stellard, Thomas <Tom.Stellard at amd.com>; Sumner, Brian <Brian.Sumner at amd.com>
Subject: Re: [cfe-dev] [OpenCL] Representing kernel attributes by LLVM target-dependent attribute-value pairs instead of metadata

On Mon, May 09, 2016 at 08:05:11PM +0000, Liu, Yaxun (Sam) via cfe-dev wrote:
> Hi,
> 
> When SPIR 1.2/2.0 spec was developed, there was no target-dependent attribute-value pair in LLVM. As such, kernel attributes were represented as metadata.
> 
> This caused lots of inconvenience since these metadata are difficult to manipulate/change when kernel functions went through transformations in backends.
> 
> Now LLVM supports target-dependent attribute-value pair, I am wondering whether it is time to use that to represent kernel attributes.
> 
> e.g. something like (just to give an idea, not exact llvm IR)
> 
> kernel void foo(global int*a, sampler_t s); #1
> #1 = {
> reqd_work_group_size="1 1 1",
> kernel_arg_type="int *, sampler_t",
> ...
> }

I don't really think the argument type information should be included in the target attributes.  It's optional information that the backend doesn't need.  It seems like metadata is more appropriate.

-Tom

> 
> basically we keep the info conveyed by the original metadata but attach them to the kernel function as attribute/value pair. This will make these attributes much easier to manipulate/change.
> 
> Any feedbacks? Thanks.
> 
> Sam


> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list