<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 2 Oct 2017, at 21:23, Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu" class="">jan.vesely@rutgers.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Sun, 2017-10-01 at 20:12 +0200, Jeroen Ketema via Libclc-dev wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">Thanks for the review.<br class=""><br class="">I think it's allowed because it’s perfectly valid C, and I’m actually not aware of any<br class="">restrictions in the spec that stop you from writing this. It’s a bit odd though not to<br class="">get an error message when you pass an argument to get_work_dim.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Right, quite an obscure feature.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I remember getting "error: function with no prototype cannot use the</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">spir_function calling convention" from the link-program piglit on</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">beignet, so I thought it was CLC restriction.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>That could be. Compiling a call to the get_work_dim function without void in the</div><div>prototype results in an LLVM call instruction with a bitcast in it, and I don’t think</div><div>that’s allowed by SPIR. Thing is that the SPIR is a bit more strict in this respect</div><div>(and also in some other respects) than OpenCL C.</div><div><br class=""></div><div>Jeroen</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">anyway I learnt something new.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">thanks,</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Jan</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="">Jeroen<br class=""><br class="">P.S. I will check in this patch and the other myself, but it might take a bit, because<br class="">I’m somewhat behind the tip of the tree at the moment.<br class=""><br class=""><blockquote type="cite" class="">On 1 Oct 2017, at 20:04, Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu" class="">jan.vesely@rutgers.edu</a>> wrote:<br class=""><br class="">On Sun, 2017-10-01 at 19:23 +0200, Jeroen Ketema via Libclc-dev wrote:<br class=""><blockquote type="cite" class="">Without void, an arbitrary number of arguments is allowed to be<br class="">passed (per the C standard). This does not seem to be the intention<br class="">of the specification of this function.<br class=""></blockquote><br class="">I'm surprised CLC would allow programs to call functions without proper<br class="">prototype.<br class="">LGTM.<br class="">Reviewed-by: Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu" class="">jan.vesely@rutgers.edu</a><span class="Apple-converted-space"> </span><<a href="mailto:jan.vesely@rutgers.edu" class="">mailto:jan.vesely@rutgers.edu</a>>><br class=""><br class="">Jan<br class=""><br class=""><blockquote type="cite" class=""><br class="">Index: amdgcn/lib/workitem/get_work_dim.cl<br class="">===================================================================<br class="">--- amdgcn/lib/workitem/get_work_dim.cl<span class="Apple-tab-span" style="white-space: pre;">        </span>(revision 312402)<br class="">+++ amdgcn/lib/workitem/get_work_dim.cl<span class="Apple-tab-span" style="white-space: pre;">     </span>(working copy)<br class="">@@ -1,6 +1,6 @@<br class="">#include <clc/clc.h><br class=""><br class="">-_CLC_DEF uint get_work_dim()<br class="">+_CLC_DEF uint get_work_dim(void)<br class="">{<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>__attribute__((address_space(2))) uint * ptr =<br class=""><span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>(__attribute__((address_space(2))) uint *)<br class="">Index: generic/include/clc/workitem/get_work_dim.h<br class="">===================================================================<br class="">--- generic/include/clc/workitem/get_work_dim.h<span class="Apple-tab-span" style="white-space: pre;">     </span>(revision 312402)<br class="">+++ generic/include/clc/workitem/get_work_dim.h<span class="Apple-tab-span" style="white-space: pre;">     </span>(working copy)<br class="">@@ -1 +1 @@<br class="">-_CLC_DECL uint get_work_dim();<br class="">+_CLC_DECL uint get_work_dim(void);<br class="">Index: r600/lib/workitem/get_work_dim.cl<br class="">===================================================================<br class="">--- r600/lib/workitem/get_work_dim.cl<span class="Apple-tab-span" style="white-space: pre;"> </span>(revision 312402)<br class="">+++ r600/lib/workitem/get_work_dim.cl<span class="Apple-tab-span" style="white-space: pre;">       </span>(working copy)<br class="">@@ -1,6 +1,6 @@<br class="">#include <clc/clc.h><br class=""><br class="">-_CLC_DEF uint get_work_dim()<br class="">+_CLC_DEF uint get_work_dim(void)<br class="">{<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>__attribute__((address_space(7))) uint * ptr =<br class=""><span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>(__attribute__((address_space(7))) uint *)<br class=""><br class="">_______________________________________________<br class="">Libclc-dev mailing list<br class=""><a href="mailto:Libclc-dev@lists.llvm.org" class="">Libclc-dev@lists.llvm.org</a><span class="Apple-converted-space"> </span><<a href="mailto:Libclc-dev@lists.llvm.org" class="">mailto:Libclc-dev@lists.llvm.org</a>><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev</a><span class="Apple-converted-space"> </span><<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev</a>><br class=""></blockquote><br class="">--<span class="Apple-converted-space"> </span><br class="">Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu" class="">jan.vesely@rutgers.edu</a><span class="Apple-converted-space"> </span><<a href="mailto:jan.vesely@rutgers.edu" class="">mailto:jan.vesely@rutgers.edu</a>>><br class=""></blockquote><br class="">_______________________________________________<br class="">Libclc-dev mailing list<br class=""><a href="mailto:Libclc-dev@lists.llvm.org" class="">Libclc-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev</a></blockquote></div></blockquote></div><br class=""></body></html>