From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@freedesktop.org Subject: [Bug 100105] Make Theano OpenCL support work on Clover and RadeonSI Date: Wed, 04 Apr 2018 23:37:57 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1923786718==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id D92336E295 for ; Wed, 4 Apr 2018 23:37:56 +0000 (UTC) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1923786718== Content-Type: multipart/alternative; boundary="15228850760.eF63.3149" Content-Transfer-Encoding: 7bit --15228850760.eF63.3149 Date: Wed, 4 Apr 2018 23:37:56 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D100105 --- Comment #2 from Jan Vesely --- Latest update: diff --git a/src/cluda_opencl.h b/src/cluda_opencl.h index 6e0095c..8ba2d14 100644 --- a/src/cluda_opencl.h +++ b/src/cluda_opencl.h @@ -48,7 +48,7 @@ typedef struct _ga_half { } ga_half; #define ga_half2float(p) vload_half(0, &((p).data)) -static inline ga_half ga_float2half(ga_float f) { +inline ga_half ga_float2half(ga_float f) { ga_half r; vstore_half_rtn(f, 0, &r.data); return r; diff --git a/src/gpuarray_buffer_opencl.c b/src/gpuarray_buffer_opencl.c index 8f12811..2041ca2 100644 --- a/src/gpuarray_buffer_opencl.c +++ b/src/gpuarray_buffer_opencl.c @@ -146,7 +146,7 @@ cl_ctx *cl_make_ctx(cl_context ctx, gpucontext_props *p= ) { CL_CHECKN(global_err, clGetDeviceInfo(id, CL_DEVICE_VERSION, device_version_size, device_version, NULL)); - if (device_version[7] =3D=3D '1' && device_version[9] < '2') { + if (device_version[7] =3D=3D '1' && device_version[9] < '1') { error_set(global_err, GA_UNSUPPORTED_ERROR, "We only support OpenCL 1.2 and up"); return NULL >>> pygpu.test() pygpu is installed in /home/jvesely/.local/lib/python3.6/site-packages/pygpu-0.7.5+12.g6f0132c.di= rty-py3.6-linux-x86_64.egg/pygpu NumPy version 1.13.3 NumPy relaxed strides checking option: True NumPy is installed in /usr/lib64/python3.6/site-packages/numpy Python version 3.6.4 (default, Mar 13 2018, 18:18:20) [GCC 7.3.1 20180303 (= Red Hat 7.3.1-5)] nose version 1.3.7 *** Testing for AMD Radeon R7 Graphics (CARRIZO / DRM 3.23.0 / 4.15.14-300.fc27.x86_64, LLVM 6.0.0) ---------------------------------------------------------------------- Ran 6670 tests in 995.728s FAILED (SKIP=3D12, errors=3D580, failures=3D2) All errors are: TypeError: This is for CUDA arrays. The two failures are: FAIL: pygpu.tests.test_elemwise.test_elemwise_f16(, 'float16', 'float16', (50,)) FAIL: pygpu.tests.test_elemwise.test_elemwise_f16(, 'float16', 'float16', (50,)) Which fail on half precision rounding error. for example: 7.0390625+7.20703125 is expected to be 14.25 but gpu returns 14.2421875 the fp32 result is 14.24609375. The GPU result is rounded down (towards zero) The CPU result is rounded up (away from zero) It looks like our vstore_half_rtn is not working as expected, which is weird because it passes CTS. --=20 You are receiving this mail because: You are the assignee for the bug.= --15228850760.eF63.3149 Date: Wed, 4 Apr 2018 23:37:56 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated

Commen= t # 2 on bug 10010= 5 from Jan Vesely
Latest update:
diff --git a/src/cluda_opencl.h b/src/cluda_opencl.h
index 6e0095c..8ba2d14 100644
--- a/src/cluda_opencl.h
+++ b/src/cluda_opencl.h
@@ -48,7 +48,7 @@ typedef struct _ga_half {
 } ga_half;

 #define ga_half2float(p) vload_half(0, &((p).data))
-static inline ga_half ga_float2half(ga_float f) {
+inline ga_half ga_float2half(ga_float f) {
   ga_half r;
   vstore_half_rtn(f, 0, &r.data);
   return r;
diff --git a/src/gpuarray_buffer_opencl.c b/src/gpuarray_buffer_opencl.c
index 8f12811..2041ca2 100644
--- a/src/gpuarray_buffer_opencl.c
+++ b/src/gpuarray_buffer_opencl.c
@@ -146,7 +146,7 @@ cl_ctx *cl_make_ctx(cl_context ctx, gpu=
context_props *p) {
   CL_CHECKN(global_err, clGetDeviceInfo(id, CL_DEVICE_VERSION,
                                         device_version_size,
                                         device_version, NULL));
-  if (device_version[7] =3D=3D '1' && device_version[9] < '2') {
+  if (device_version[7] =3D=3D '1' && device_version[9] < '1') {
     error_set(global_err, GA_UNSUPPORTED_ERROR,
               "We only support OpenCL 1.2 and up");
     return NULL

>>> pygpu.test()
pygpu is installed in
/home/jvesely/.local/lib/python3.6/site-packages/pygpu-0.7.5+12.g6f0132c.di=
rty-py3.6-linux-x86_64.egg/pygpu
NumPy version 1.13.3
NumPy relaxed strides checking option: True
NumPy is installed in /usr/lib64/python3.6/site-packages/numpy
Python version 3.6.4 (default, Mar 13 2018, 18:18:20) [GCC 7.3.1 20180303 (=
Red
Hat 7.3.1-5)]
nose version 1.3.7
*** Testing for AMD Radeon R7 Graphics (CARRIZO / DRM 3.23.0 /
4.15.14-300.fc27.x86_64, LLVM 6.0.0)

----------------------------------------------------------------------
Ran 6670 tests in 995.728s

FAILED (SKIP=3D12, errors=3D580, failures=3D2)

All errors are: TypeError: This is for CUDA arrays.
The two failures are:
FAIL: pygpu.tests.test_elemwise.test_elemwise_f16(<built-in function add=
>,
'float16', 'float16', (50,))
FAIL: pygpu.tests.test_elemwise.test_elemwise_f16(<built-in function iad=
d>,
'float16', 'float16', (50,))

Which fail on half precision rounding error. for example:
7.0390625+7.20703125 is expected to be 14.25 but gpu returns 14.2421875
the fp32 result is 14.24609375.

The GPU result is rounded down (towards zero)
The CPU result is rounded up (away from zero)

It looks like our vstore_half_rtn is not working as expected, which is weird
because it passes CTS.


You are receiving this mail because:
  • You are the assignee for the bug.
= --15228850760.eF63.3149-- --===============1923786718== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1923786718==--