<div dir="ltr">Backend support for this has been submitted to llvm.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 16, 2015 at 4:33 PM, Zoltan Gilian <span dir="ltr"><<a href="mailto:zoltan.gilian@gmail.com" target="_blank">zoltan.gilian@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Added get_image_* OpenCL builtins to the headers along with a dummy<br>
</span>implementation to the R600 libs.<br>
<span class="">The builtins need to be replaced by the compiler.<br>
---<br>
</span> 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://get_image_dim.cl" rel="noreferrer" target="_blank">get_image_dim.cl</a>            |  9 +++++++++<br>
 r600/lib/SOURCES                              |  5 +++++<br>
 r600/lib/image/<a href="http://get_image_channel_data_type.cl" rel="noreferrer" target="_blank">get_image_channel_data_type.cl</a> | 13 +++++++++++++<br>
 r600/lib/image/<a href="http://get_image_channel_order.cl" rel="noreferrer" target="_blank">get_image_channel_order.cl</a>     | 13 +++++++++++++<br>
 r600/lib/image/<a href="http://get_image_depth.cl" rel="noreferrer" target="_blank">get_image_depth.cl</a>             |  8 ++++++++<br>
 r600/lib/image/<a href="http://get_image_height.cl" rel="noreferrer" target="_blank">get_image_height.cl</a>            | 13 +++++++++++++<br>
 r600/lib/image/<a href="http://get_image_width.cl" rel="noreferrer" target="_blank">get_image_width.cl</a>             | 13 +++++++++++++<br>
 10 files changed, 95 insertions(+)<br>
 create mode 100644 generic/include/clc/image/image.h<br>
 create mode 100644 generic/lib/image/<a href="http://get_image_dim.cl" rel="noreferrer" target="_blank">get_image_dim.cl</a><br>
 create mode 100644 r600/lib/image/<a href="http://get_image_channel_data_type.cl" rel="noreferrer" target="_blank">get_image_channel_data_type.cl</a><br>
 create mode 100644 r600/lib/image/<a href="http://get_image_channel_order.cl" rel="noreferrer" target="_blank">get_image_channel_order.cl</a><br>
 create mode 100644 r600/lib/image/<a href="http://get_image_depth.cl" rel="noreferrer" target="_blank">get_image_depth.cl</a><br>
 create mode 100644 r600/lib/image/<a href="http://get_image_height.cl" rel="noreferrer" target="_blank">get_image_height.cl</a><br>
 create mode 100644 r600/lib/image/<a href="http://get_image_width.cl" rel="noreferrer" target="_blank">get_image_width.cl</a><br>
<br>
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h<br>
index cab751d..4199842 100644<br>
--- a/generic/include/clc/clc.h<br>
+++ b/generic/include/clc/clc.h<br>
@@ -210,6 +210,10 @@<br>
 #include <clc/cl_khr_local_int32_extended_atomics/atom_or.h><br>
 #include <clc/cl_khr_local_int32_extended_atomics/atom_xor.h><br>
<span class=""><br>
+/* 6.11.13 Image Read and Write Functions */<br>
+<br>
+#include <clc/image/image.h><br>
+<br>
</span> /* libclc internal defintions */<br>
 #ifdef __CLC_INTERNAL<br>
 #include <math/clc_nextafter.h><br>
<span class="">diff --git a/generic/include/clc/image/image.h b/generic/include/clc/image/image.h<br>
new file mode 100644<br>
</span>index 0000000..9c97563<br>
<span class="">--- /dev/null<br>
+++ b/generic/include/clc/image/image.h<br>
@@ -0,0 +1,16 @@<br>
</span>+_CLC_OVERLOAD _CLC_DECL int get_image_width (image2d_t image);<br>
+_CLC_OVERLOAD _CLC_DECL int get_image_width (image3d_t image);<br>
+<br>
+_CLC_OVERLOAD _CLC_DECL int get_image_height (image2d_t image);<br>
+_CLC_OVERLOAD _CLC_DECL int get_image_height (image3d_t image);<br>
+<br>
+_CLC_OVERLOAD _CLC_DECL int get_image_depth (image3d_t image);<br>
+<br>
+_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image2d_t image);<br>
+_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image3d_t image);<br>
+<br>
+_CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image2d_t image);<br>
+_CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image3d_t image);<br>
+<br>
+_CLC_OVERLOAD _CLC_DECL int2 get_image_dim (image2d_t image);<br>
+_CLC_OVERLOAD _CLC_DECL int4 get_image_dim (image3d_t image);<br>
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES<br>
index 1e63994..3712785 100644<br>
<span class="">--- a/generic/lib/SOURCES<br>
+++ b/generic/lib/SOURCES<br>
@@ -127,3 +127,4 @@ shared/<a href="http://vload.cl" rel="noreferrer" target="_blank">vload.cl</a><br>
 shared/<a href="http://vstore.cl" rel="noreferrer" target="_blank">vstore.cl</a><br>
 workitem/<a href="http://get_global_id.cl" rel="noreferrer" target="_blank">get_global_id.cl</a><br>
 workitem/<a href="http://get_global_size.cl" rel="noreferrer" target="_blank">get_global_size.cl</a><br>
</span>+image/<a href="http://get_image_dim.cl" rel="noreferrer" target="_blank">get_image_dim.cl</a><br>
diff --git a/generic/lib/image/<a href="http://get_image_dim.cl" rel="noreferrer" target="_blank">get_image_dim.cl</a> b/generic/lib/image/<a href="http://get_image_dim.cl" rel="noreferrer" target="_blank">get_image_dim.cl</a><br>
new file mode 100644<br>
index 0000000..26dbd00<br>
--- /dev/null<br>
+++ b/generic/lib/image/<a href="http://get_image_dim.cl" rel="noreferrer" target="_blank">get_image_dim.cl</a><br>
@@ -0,0 +1,9 @@<br>
+#include <clc/clc.h><br>
<span class="">+<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>
</span>diff --git a/r600/lib/SOURCES b/r600/lib/SOURCES<br>
index 0f1227e..a909608 100644<br>
--- a/r600/lib/SOURCES<br>
+++ b/r600/lib/SOURCES<br>
@@ -9,3 +9,8 @@ workitem/get_global_size.ll<br>
 workitem/get_work_dim.ll<br>
 synchronization/<a href="http://barrier.cl" rel="noreferrer" target="_blank">barrier.cl</a><br>
 synchronization/barrier_impl.ll<br>
+image/<a href="http://get_image_width.cl" rel="noreferrer" target="_blank">get_image_width.cl</a><br>
+image/<a href="http://get_image_height.cl" rel="noreferrer" target="_blank">get_image_height.cl</a><br>
+image/<a href="http://get_image_depth.cl" rel="noreferrer" target="_blank">get_image_depth.cl</a><br>
+image/<a href="http://get_image_channel_data_type.cl" rel="noreferrer" target="_blank">get_image_channel_data_type.cl</a><br>
+image/<a href="http://get_image_channel_order.cl" rel="noreferrer" target="_blank">get_image_channel_order.cl</a><br>
diff --git a/r600/lib/image/<a href="http://get_image_channel_data_type.cl" rel="noreferrer" target="_blank">get_image_channel_data_type.cl</a> b/r600/lib/image/<a href="http://get_image_channel_data_type.cl" rel="noreferrer" target="_blank">get_image_channel_data_type.cl</a><br>
new file mode 100644<br>
index 0000000..b82da5a<br>
--- /dev/null<br>
+++ b/r600/lib/image/<a href="http://get_image_channel_data_type.cl" rel="noreferrer" target="_blank">get_image_channel_data_type.cl</a><br>
@@ -0,0 +1,13 @@<br>
+#include <clc/clc.h><br>
+<br>
+int __clc_get_image_channel_data_type_2d(image2d_t) __asm("llvm.r600.get.image.channel.data.type");<br>
+int __clc_get_image_channel_data_type_3d(image3d_t) __asm("llvm.r600.get.image.channel.data.type");<br>
+<br>
+_CLC_OVERLOAD _CLC_DEF int<br>
+get_image_channel_data_type(image2d_t image) {<br>
<span class="">+       return __clc_get_image_channel_data_type_2d(image);<br>
+}<br>
+_CLC_OVERLOAD _CLC_DEF int<br>
</span>+get_image_channel_data_type(image3d_t image) {<br>
+       return __clc_get_image_channel_data_type_3d(image);<br>
+}<br>
diff --git a/r600/lib/image/<a href="http://get_image_channel_order.cl" rel="noreferrer" target="_blank">get_image_channel_order.cl</a> b/r600/lib/image/<a href="http://get_image_channel_order.cl" rel="noreferrer" target="_blank">get_image_channel_order.cl</a><br>
new file mode 100644<br>
index 0000000..0c31e20<br>
--- /dev/null<br>
+++ b/r600/lib/image/<a href="http://get_image_channel_order.cl" rel="noreferrer" target="_blank">get_image_channel_order.cl</a><br>
@@ -0,0 +1,13 @@<br>
+#include <clc/clc.h><br>
+<br>
+int __clc_get_image_channel_order_2d(image2d_t) __asm("llvm.r600.get.image.channel.order");<br>
+int __clc_get_image_channel_order_3d(image3d_t) __asm("llvm.r600.get.image.channel.order");<br>
+<br>
+_CLC_OVERLOAD _CLC_DEF int<br>
+get_image_channel_order(image2d_t image) {<br>
<span class="">+       return __clc_get_image_channel_order_2d(image);<br>
+}<br>
+_CLC_OVERLOAD _CLC_DEF int<br>
</span>+get_image_channel_order(image3d_t image) {<br>
+       return __clc_get_image_channel_order_3d(image);<br>
+}<br>
diff --git a/r600/lib/image/<a href="http://get_image_depth.cl" rel="noreferrer" target="_blank">get_image_depth.cl</a> b/r600/lib/image/<a href="http://get_image_depth.cl" rel="noreferrer" target="_blank">get_image_depth.cl</a><br>
new file mode 100644<br>
index 0000000..4b41ff9<br>
--- /dev/null<br>
+++ b/r600/lib/image/<a href="http://get_image_depth.cl" rel="noreferrer" target="_blank">get_image_depth.cl</a><br>
@@ -0,0 +1,8 @@<br>
+#include <clc/clc.h><br>
+<br>
+int __clc_get_image_depth_3d(image3d_t) __asm("llvm.r600.get.image.depth");<br>
+<br>
+_CLC_OVERLOAD _CLC_DEF int<br>
+get_image_depth(image3d_t image) {<br>
+       return __clc_get_image_depth_3d(image);<br>
+}<br>
diff --git a/r600/lib/image/<a href="http://get_image_height.cl" rel="noreferrer" target="_blank">get_image_height.cl</a> b/r600/lib/image/<a href="http://get_image_height.cl" rel="noreferrer" target="_blank">get_image_height.cl</a><br>
new file mode 100644<br>
index 0000000..6b9aa91<br>
--- /dev/null<br>
+++ b/r600/lib/image/<a href="http://get_image_height.cl" rel="noreferrer" target="_blank">get_image_height.cl</a><br>
@@ -0,0 +1,13 @@<br>
+#include <clc/clc.h><br>
+<br>
+int __clc_get_image_height_2d(image2d_t) __asm("llvm.r600.get.image.height");<br>
+int __clc_get_image_height_3d(image3d_t) __asm("llvm.r600.get.image.height");<br>
+<br>
+_CLC_OVERLOAD _CLC_DEF int<br>
+get_image_height(image2d_t image) {<br>
<span class="">+       return __clc_get_image_height_2d(image);<br>
+}<br>
+_CLC_OVERLOAD _CLC_DEF int<br>
</span>+get_image_height(image3d_t image) {<br>
+       return __clc_get_image_height_3d(image);<br>
+}<br>
diff --git a/r600/lib/image/<a href="http://get_image_width.cl" rel="noreferrer" target="_blank">get_image_width.cl</a> b/r600/lib/image/<a href="http://get_image_width.cl" rel="noreferrer" target="_blank">get_image_width.cl</a><br>
new file mode 100644<br>
index 0000000..58a1c73<br>
--- /dev/null<br>
+++ b/r600/lib/image/<a href="http://get_image_width.cl" rel="noreferrer" target="_blank">get_image_width.cl</a><br>
@@ -0,0 +1,13 @@<br>
+#include <clc/clc.h><br>
+<br>
+int __clc_get_image_width_2d(image2d_t) __asm("llvm.r600.get.image.width");<br>
+int __clc_get_image_width_3d(image3d_t) __asm("llvm.r600.get.image.width");<br>
+<br>
+_CLC_OVERLOAD _CLC_DEF int<br>
+get_image_width(image2d_t image) {<br>
+       return __clc_get_image_width_2d(image);<br>
+}<br>
+_CLC_OVERLOAD _CLC_DEF int<br>
+get_image_width(image3d_t image) {<br>
+       return __clc_get_image_width_3d(image);<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.4.2<br>
<br>
</font></span></blockquote></div><br></div>