[Libclc-dev] Let get_work_dim take exactly 0 arguments

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Mon Oct 2 12:23:00 PDT 2017


On Sun, 2017-10-01 at 20:12 +0200, Jeroen Ketema via Libclc-dev wrote:
> Thanks for the review.
> 
> I think it's allowed because it’s perfectly valid C, and I’m actually not aware of any
> restrictions in the spec that stop you from writing this. It’s a bit odd though not to
> get an error message when you pass an argument to get_work_dim.

Right, quite an obscure feature.
I remember getting "error: function with no prototype cannot use the
spir_function calling convention" from the link-program piglit on
beignet, so I thought it was CLC restriction.
anyway I learnt something new.

thanks,
Jan

> 
> Jeroen
> 
> P.S. I will check in this patch and the other myself, but it might take a bit, because
> I’m somewhat behind the tip of the tree at the moment.
> 
> > On 1 Oct 2017, at 20:04, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> > 
> > On Sun, 2017-10-01 at 19:23 +0200, Jeroen Ketema via Libclc-dev wrote:
> > > Without void, an arbitrary number of arguments is allowed to be
> > > passed (per the C standard). This does not seem to be the intention
> > > of the specification of this function.
> > 
> > I'm surprised CLC would allow programs to call functions without proper
> > prototype.
> > LGTM.
> > Reviewed-by: Jan Vesely <jan.vesely at rutgers.edu <mailto:jan.vesely at rutgers.edu>>
> > 
> > Jan
> > 
> > > 
> > > Index: amdgcn/lib/workitem/get_work_dim.cl
> > > ===================================================================
> > > --- amdgcn/lib/workitem/get_work_dim.cl	(revision 312402)
> > > +++ amdgcn/lib/workitem/get_work_dim.cl	(working copy)
> > > @@ -1,6 +1,6 @@
> > > #include <clc/clc.h>
> > > 
> > > -_CLC_DEF uint get_work_dim()
> > > +_CLC_DEF uint get_work_dim(void)
> > > {
> > > 	__attribute__((address_space(2))) uint * ptr =
> > > 		(__attribute__((address_space(2))) uint *)
> > > Index: generic/include/clc/workitem/get_work_dim.h
> > > ===================================================================
> > > --- generic/include/clc/workitem/get_work_dim.h	(revision 312402)
> > > +++ generic/include/clc/workitem/get_work_dim.h	(working copy)
> > > @@ -1 +1 @@
> > > -_CLC_DECL uint get_work_dim();
> > > +_CLC_DECL uint get_work_dim(void);
> > > Index: r600/lib/workitem/get_work_dim.cl
> > > ===================================================================
> > > --- r600/lib/workitem/get_work_dim.cl	(revision 312402)
> > > +++ r600/lib/workitem/get_work_dim.cl	(working copy)
> > > @@ -1,6 +1,6 @@
> > > #include <clc/clc.h>
> > > 
> > > -_CLC_DEF uint get_work_dim()
> > > +_CLC_DEF uint get_work_dim(void)
> > > {
> > > 	__attribute__((address_space(7))) uint * ptr =
> > > 		(__attribute__((address_space(7))) uint *)
> > > 
> > > _______________________________________________
> > > Libclc-dev mailing list
> > > Libclc-dev at lists.llvm.org <mailto:Libclc-dev at lists.llvm.org>
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>
> > 
> > -- 
> > Jan Vesely <jan.vesely at rutgers.edu <mailto:jan.vesely at rutgers.edu>>
> 
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev
-------------- 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: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20171002/1e2e9c89/attachment.sig>


More information about the Libclc-dev mailing list