<div dir="ltr">> <span style="font-size:12.8000001907349px">I’m not keeping track of the back-end, but has work been done there to support this?</span><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Yes, but it is a work in progress at the moment.</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">> Why is the indirection needed in this case and many of the following cases? </span><span style="font-size:12.8000001907349px">Why not simply define</span></div><span style="font-size:12.8000001907349px">> int get_image_width(image2d_t image) __asm("llvm.opencl.image.get.</span><span style="font-size:12.8000001907349px">width.2d”);</span><div><span style="font-size:12.8000001907349px">> </span><span style="font-size:12.8000001907349px">in clc/image/image.h?</span><span style="font-size:12.8000001907349px"><br></span><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Good point, I'll move those defs to the header then.</span></div></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Zoltan</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 9, 2015 at 1:11 AM, Jeroen Ketema <span dir="ltr"><<a href="mailto:j.ketema@imperial.ac.uk" target="_blank">j.ketema@imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I’m not keeping track of the back-end, but has work been done there to support this?<br>
<span class=""><br>
> On 08 Jun 2015, at 15:46, Zoltan Gilian <<a href="mailto:zoltan.gilian@gmail.com">zoltan.gilian@gmail.com</a>> wrote:<br>
><br>
> Added get_image_* OpenCL builtins to the headers along with a dummy<br>
> implementation. The builtins need to be replaced by the compiler.<br>
> ---<br>
> generic/include/clc/clc.h         |  4 +++<br>
> generic/include/clc/image/image.h | 16 ++++++++++++<br>
> generic/lib/SOURCES               |  1 +<br>
> generic/lib/image/<a href="http://image.cl" target="_blank">image.cl</a>        | 54 +++++++++++++++++++++++++++++++++++++++<br>
> 4 files changed, 75 insertions(+)<br>
> create mode 100644 generic/include/clc/image/image.h<br>
> create mode 100644 generic/lib/image/<a href="http://image.cl" target="_blank">image.cl</a><br>
><br>
> diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h<br>
> index cab751d..5848a98 100644<br>
> --- a/generic/include/clc/clc.h<br>
> +++ b/generic/include/clc/clc.h<br>
> @@ -180,6 +180,10 @@<br>
> #include <clc/atomic/atomic_xchg.h><br>
> #include <clc/atomic/atomic_xor.h><br>
><br>
> +/* 6.11.13 Image Read and Write Functions */<br>
> +<br>
> +#include <clc/image/image.h><br>
> +<br>
<br>
</span>I think this must be moved slightly. It now breaks the inclusion of the atomic headers into two parts.<br>
<div><div class="h5"><br>
> /* cl_khr_global_int32_base_atomics Extension Functions */<br>
> #include <clc/cl_khr_global_int32_base_atomics/atom_add.h><br>
> #include <clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h><br>
> diff --git a/generic/include/clc/image/image.h b/generic/include/clc/image/image.h<br>
> new file mode 100644<br>
> index 0000000..23d2367<br>
> --- /dev/null<br>
> +++ b/generic/include/clc/image/image.h<br>
> @@ -0,0 +1,16 @@<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_width (image2d_t image);<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_width (image3d_t image);<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_height (image2d_t image);<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_height (image3d_t image);<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_depth (image3d_t image);<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_channel_data_type (image2d_t image);<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_channel_data_type (image3d_t image);<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_channel_order (image2d_t image);<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_channel_order (image3d_t image);<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int2 get_image_dim (image2d_t image);<br>
> +_CLC_OVERLOAD _CLC_DEF int4 get_image_dim (image3d_t image);<br>
> diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES<br>
> index 1e63994..a284747 100644<br>
> --- a/generic/lib/SOURCES<br>
> +++ b/generic/lib/SOURCES<br>
> @@ -127,3 +127,4 @@ shared/<a href="http://vload.cl" target="_blank">vload.cl</a><br>
> shared/<a href="http://vstore.cl" target="_blank">vstore.cl</a><br>
> workitem/<a href="http://get_global_id.cl" target="_blank">get_global_id.cl</a><br>
> workitem/<a href="http://get_global_size.cl" target="_blank">get_global_size.cl</a><br>
> +image/<a href="http://image.cl" target="_blank">image.cl</a><br>
> diff --git a/generic/lib/image/<a href="http://image.cl" target="_blank">image.cl</a> b/generic/lib/image/<a href="http://image.cl" target="_blank">image.cl</a><br>
> new file mode 100644<br>
> index 0000000..0e89423<br>
> --- /dev/null<br>
> +++ b/generic/lib/image/<a href="http://image.cl" target="_blank">image.cl</a><br>
> @@ -0,0 +1,54 @@<br>
> +#include <clc/clc.h><br>
> +<br>
> +// An llvm pass will substitute these to the correct llvm register.<br>
> +// Use intrinsics to mark the places for substitution.<br>
> +int __clc_get_image_width_2d(image2d_t) __asm("llvm.opencl.image.get.width.2d");<br>
> +int __clc_get_image_width_3d(image3d_t) __asm("llvm.opencl.image.get.width.3d");<br>
> +int __clc_get_image_height_2d(image2d_t) __asm("llvm.opencl.image.get.height.2d");<br>
> +int __clc_get_image_height_3d(image3d_t) __asm("llvm.opencl.image.get.height.3d");<br>
> +int __clc_get_image_depth_3d(image3d_t) __asm("llvm.opencl.image.get.depth.3d");<br>
> +int __clc_get_image_channel_data_type_2d(image2d_t) __asm("llvm.opencl.image.get.channel_data_type.2d");<br>
> +int __clc_get_image_channel_data_type_3d(image3d_t) __asm("llvm.opencl.image.get.channel_data_type.3d");<br>
> +int __clc_get_image_channel_order_2d(image2d_t) __asm("llvm.opencl.image.get.channel_order.2d");<br>
> +int __clc_get_image_channel_order_3d(image3d_t) __asm("llvm.opencl.image.get.channel_order.3d");<br>
> +<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_width(image2d_t image) {<br>
> +  return __clc_get_image_width_2d(image);<br>
> +}<br>
<br>
</div></div>Why is the indirection needed in this case and many of the following cases? Why not simply define<br>
<br>
int get_image_width(image2d_t image) __asm("llvm.opencl.image.get.width.2d”);<br>
<br>
in clc/image/image.h? That would follow what was initially done for some of the math builtins.<br>
<br>
Jeroen<br>
<div><div class="h5"><br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_width(image3d_t image) {<br>
> +  return __clc_get_image_width_3d(image);<br>
> +}<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_height(image2d_t image) {<br>
> +  return __clc_get_image_height_2d(image);<br>
> +}<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_height(image3d_t image) {<br>
> +  return __clc_get_image_height_3d(image);<br>
> +}<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_depth(image3d_t image) {<br>
> +  return __clc_get_image_depth_3d(image);<br>
> +}<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_channel_data_type(image2d_t image) {<br>
> +  return __clc_get_image_channel_data_type_2d(image);<br>
> +}<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_channel_data_type(image3d_t image) {<br>
> +  return __clc_get_image_channel_data_type_3d(image);<br>
> +}<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_channel_order(image2d_t image) {<br>
> +  return __clc_get_image_channel_order_2d(image);<br>
> +}<br>
> +_CLC_OVERLOAD _CLC_DEF int get_image_channel_order(image3d_t image) {<br>
> +  return __clc_get_image_channel_order_3d(image);<br>
> +}<br>
> +<br>
> +_CLC_OVERLOAD _CLC_DEF int2 get_image_dim (image2d_t image) {<br>
> +  return (int2)(get_image_width(image), get_image_height(image));<br>
> +}<br>
> +_CLC_OVERLOAD _CLC_DEF int4 get_image_dim (image3d_t image) {<br>
> +  return (int4)(get_image_width(image), get_image_height(image),<br>
> +                get_image_depth(image), 0);<br>
> +}<br>
> --<br>
> 2.4.2<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Libclc-dev mailing list<br>
> <a href="mailto:Libclc-dev@pcc.me.uk">Libclc-dev@pcc.me.uk</a><br>
> <a href="http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev" target="_blank">http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev</a><br>
<br>
</blockquote></div><br></div>