[Libclc-dev] Let get_work_dim take exactly 0 arguments
Jeroen Ketema via Libclc-dev
libclc-dev at lists.llvm.org
Mon Oct 2 12:32:33 PDT 2017
> On 2 Oct 2017, at 21:23, Jan Vesely <jan.vesely at rutgers.edu> wrote:
>
> 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.
That could be. Compiling a call to the get_work_dim function without void in the
prototype results in an LLVM call instruction with a bitcast in it, and I don’t think
that’s allowed by SPIR. Thing is that the SPIR is a bit more strict in this respect
(and also in some other respects) than OpenCL C.
Jeroen
> 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> <mailto: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> <mailto: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> <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> <mailto:jan.vesely at rutgers.edu <mailto:jan.vesely at rutgers.edu>>>
>>
>> _______________________________________________
>> 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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20171002/a7267bd6/attachment.html>
More information about the Libclc-dev
mailing list