<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: no</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: 18.04 LTS (Bionic Beaver)</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: source</li>
<li><strong>TensorFlow version (use command below)</strong>: v1.8.0-2217-g7ad3964dcb 1.8.0</li>
<li><strong>Python version</strong>: Python 3.6.5</li>
<li><strong>Bazel version (if compiling from source)</strong>: Build label: 0.13.1</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>: g++ (Ubuntu 7.3.0-16ubuntu3) 7.3.0</li>
<li><strong>CUDA/cuDNN version</strong>: NA</li>
<li><strong>GPU model and memory</strong>: AMD Radeon R9290</li>
<li><strong>Exact command to reproduce</strong>: bazel test -c opt --config=sycl --test_output=all //tensorflow/python/kernel_tests:basic_gpu_test</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">I built TF 1.8 from source with 'y' for OpenCL SYCL and ComputeCPP support in build configuration ('n' for other options). Build was complete successfully, but GPU device seems unavailable in TF, only CPU:0 is listed by<br>
<code class="notranslate">tensorflow.python.client.device_lib.device_lib.list_local_devices()</code><br>
and<br>
<code class="notranslate">tensorflow.contrib.eager.list_devices()</code><br>
Also, <code class="notranslate">tensorflow.matmul(a, b)</code> is placed on CPU:0, log_device_placement says: "Device mapping: no known devices."</p>
<p dir="auto"><code class="notranslate">bazel test -c opt --config=sycl --test_output=all //tensorflow/python/kernel_tests:basic_gpu_test</code><br>
fails with errors from SYCL.</p>
<p dir="auto">Bazel test, clinfo and computecpp_info logs are listed below.</p>
<p dir="auto">Requirements for OpenCL GPU support seem to be met, but it doesn't work. Am I missing something?</p>
<h3 dir="auto">Source code / logs</h3>
<p dir="auto">clinfo</p>
<blockquote>
<p dir="auto">Number of platforms                               1<br>
Platform Name                                   AMD Accelerated Parallel Processing<br>
Platform Vendor                                 Advanced Micro Devices, Inc.<br>
Platform Version                                OpenCL 2.1 AMD-APP (2633.3)<br>
Platform Profile                                FULL_PROFILE<br>
Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices<br>
Platform Host timer resolution                  1ns<br>
Platform Extensions function suffix             AMD<br>
Platform Name                                   AMD Accelerated Parallel Processing<br>
Number of devices                                 1<br>
Device Name                                     Hawaii<br>
Device Vendor                                   Advanced Micro Devices, Inc.<br>
Device Vendor ID                                0x1002<br>
Device Version                                  OpenCL 1.2 AMD-APP (2633.3)<br>
Driver Version                                  2633.3<br>
Device OpenCL C Version                         OpenCL C 1.2<br>
Device Type                                     GPU<br>
Device Board Name (AMD)                         AMD Radeon R9 200 Series<br>
Device Topology (AMD)                           PCI-E, 01:00.0<br>
Device Profile                                  FULL_PROFILE<br>
Device Available                                Yes<br>
Compiler Available                              Yes<br>
Linker Available                                Yes<br>
Max compute units                               40<br>
SIMD per compute unit (AMD)                     4<br>
SIMD width (AMD)                                16<br>
SIMD instruction width (AMD)                    1<br>
Max clock frequency                             947MHz<br>
Graphics IP (AMD)                               7.2<br>
Device Partition                                (core)<br>
Max number of sub-devices                     40<br>
Supported partition types                     none specified<br>
Max work item dimensions                        3<br>
Max work item sizes                             1024x1024x1024<br>
Max work group size                             256<br>
Preferred work group size (AMD)                 256<br>
Max work group size (AMD)                       1024<br>
Preferred work group size multiple              64<br>
Wavefront width (AMD)                           64<br>
Preferred / native vector sizes<br>
char                                                 4 / 4<br>
short                                                2 / 2<br>
int                                                  1 / 1<br>
long                                                 1 / 1<br>
half                                                 1 / 1        (n/a)<br>
float                                                1 / 1<br>
double                                               1 / 1        (cl_khr_fp64)<br>
Half-precision Floating-point support           (n/a)<br>
Single-precision Floating-point support         (core)<br>
Denormals                                     No<br>
Infinity and NANs                             Yes<br>
Round to nearest                              Yes<br>
Round to zero                                 Yes<br>
Round to infinity                             Yes<br>
IEEE754-2008 fused multiply-add               Yes<br>
Support is emulated in software               No<br>
Correctly-rounded divide and sqrt operations  Yes<br>
Double-precision Floating-point support         (cl_khr_fp64)<br>
Denormals                                     Yes<br>
Infinity and NANs                             Yes<br>
Round to nearest                              Yes<br>
Round to zero                                 Yes<br>
Round to infinity                             Yes<br>
IEEE754-2008 fused multiply-add               Yes<br>
Support is emulated in software               No<br>
Address bits                                    64, Little-Endian<br>
Global memory size                              2471116800 (2.301GiB)<br>
Global free memory (AMD)                        2398160 (2.287GiB)<br>
Global memory channels (AMD)                    16<br>
Global memory banks per channel (AMD)           16<br>
Global memory bank width (AMD)                  256 bytes<br>
Error Correction support                        No<br>
Max memory allocation                           2082456371 (1.939GiB)<br>
Unified memory for Host and Device              No<br>
Minimum alignment for any data type             128 bytes<br>
Alignment of base address                       2048 bits (256 bytes)<br>
Global Memory cache type                        Read/Write<br>
Global Memory cache size                        16384 (16KiB)<br>
Global Memory cache line size                   64 bytes<br>
Image support                                   Yes<br>
Max number of samplers per kernel             16<br>
Max size for 1D images from buffer            134217728 pixels<br>
Max 1D or 2D image array size                 2048 images<br>
Base address alignment for 2D image buffers   256 bytes<br>
Pitch alignment for 2D image buffers          256 pixels<br>
Max 2D image size                             16384x16384 pixels<br>
Max 3D image size                             2048x2048x2048 pixels<br>
Max number of read image args                 128<br>
Max number of write image args                8<br>
Local memory type                               Local<br>
Local memory size                               32768 (32KiB)<br>
Local memory syze per CU (AMD)                  65536 (64KiB)<br>
Local memory banks (AMD)                        32<br>
Max number of constant args                     8<br>
Max constant buffer size                        2082456371 (1.939GiB)<br>
Preferred constant buffer size (AMD)            16384 (16KiB)<br>
Max size of kernel argument                     1024<br>
Queue properties<br>
Out-of-order execution                        No<br>
Profiling                                     Yes<br>
Prefer user sync for interop                    Yes<br>
Profiling timer resolution                      1ns<br>
Profiling timer offset since Epoch (AMD)        1527256350447623220ns (Fri May 25 10:52:30 2018)<br>
Execution capabilities<br>
Run OpenCL kernels                            Yes<br>
Run native kernels                            No<br>
Thread trace supported (AMD)                  Yes<br>
Number of async queues (AMD)                  2<br>
Max real-time compute queues (AMD)            0<br>
Max real-time compute units (AMD)             0<br>
SPIR versions                                 1.2<br>
printf() buffer size                            4194304 (4MiB)<br>
Built-in kernels<br>
Device Extensions                               cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_khr_spir cl_khr_gl_event<br>
NULL platform behavior<br>
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform<br>
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform<br>
clCreateContext(NULL, ...) [default]            No platform<br>
clCreateContext(NULL, ...) [other]              Success [AMD]<br>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)<br>
Platform Name                                 AMD Accelerated Parallel Processing<br>
Device Name                                   Hawaii<br>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform<br>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)<br>
Platform Name                                 AMD Accelerated Parallel Processing<br>
Device Name                                   Hawaii<br>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform<br>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform<br>
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)<br>
Platform Name                                 AMD Accelerated Parallel Processing<br>
Device Name                                   Hawaii</p>
</blockquote>
<p dir="auto">/usr/local/computecpp/bin/computecpp_info</p>
<blockquote>
<p dir="auto">ComputeCpp Info (CE 0.8.0)<br>
Toolchain information:<br>
GLIBC version: 2.27<br>
GLIBCXX: 20160609<br>
This version of libstdc++ is supported.<br>
Device Info:<br>
Discovered 1 devices matching:<br>
platform    : <br>
device type : <br>
Device 0:<br>
Device is supported                     : UNTESTED - Untested OS<br>
CL_DEVICE_NAME                          : Hawaii<br>
CL_DEVICE_VENDOR                        : Advanced Micro Devices, Inc.<br>
CL_DRIVER_VERSION                       : 2633.3<br>
CL_DEVICE_TYPE                          : CL_DEVICE_TYPE_GPU</p>
</blockquote>
<p dir="auto">bazel test -c opt --config=sycl --test_output=all //tensorflow/python/kernel_tests:basic_gpu_test</p>
<blockquote>
<p dir="auto">INFO: Analysed target //tensorflow/python/kernel_tests:basic_gpu_test (0 packages loaded).<br>
INFO: Found 1 test target...<br>
ERROR: /home/dmitry/Soft/dev/source/TensorFlow/tensorflow/tensorflow/core/BUILD:715:1: C++ compilation of rule '//tensorflow/core:ctc_ops_op_lib' failed (Exit 1)<br>
In file included from tensorflow/core/ops/ctc_ops.cc:17:<br>
In file included from ./tensorflow/core/framework/shape_inference.h:20:<br>
In file included from ./tensorflow/core/framework/node_def_util.h:23:<br>
In file included from ./tensorflow/core/framework/attr_value_util.h:23:<br>
In file included from ./tensorflow/core/framework/partial_tensor_shape.h:20:<br>
In file included from ./tensorflow/core/framework/tensor_shape.h:21:<br>
In file included from ./third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:<br>
In file included from external/eigen_archive/unsupported/Eigen/CXX11/Tensor:99:<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:163:19: error: no matching member function for call to 'get_access'<br>
auto ptr =buf.get_access&lt;cl::sycl::access::mode::discard_write, cl::sycl::access::target::host_buffer&gt;().get_pointer();<br>
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
external/local_config_sycl/crosstool/../sycl/include/SYCL/buffer.h:593:3: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'accessMode'<br>
get_access() {<br>
^<br>
external/local_config_sycl/crosstool/../sycl/include/SYCL/buffer.h:611:53: note: candidate function template not viable: requires single argument 'cgh', but no arguments were provided<br>
accessor&lt;T, dimensions, accessMode, accessTarget&gt; get_access(<br>
^<br>
external/local_config_sycl/crosstool/../sycl/include/SYCL/buffer.h:633:53: note: candidate function template not viable: requires 3 arguments, but 0 were provided<br>
accessor&lt;T, dimensions, accessMode, accessTarget&gt; get_access(<br>
^<br>
external/local_config_sycl/crosstool/../sycl/include/SYCL/buffer.h:653:53: note: candidate function template not viable: requires at least 2 arguments, but 0 were provided<br>
accessor&lt;T, dimensions, accessMode, accessTarget&gt; get_access(<br>
^<br>
external/local_config_sycl/crosstool/../sycl/include/SYCL/buffer.h:670:68: note: candidate function template not viable: requires 2 arguments, but 0 were provided<br>
accessor&lt;T, dimensions, accessMode, access::target::host_buffer&gt; get_access(<br>
^<br>
external/local_config_sycl/crosstool/../sycl/include/SYCL/buffer.h:684:68: note: candidate function template not viable: requires at least argument 'range', but no arguments were provided<br>
accessor&lt;T, dimensions, accessMode, access::target::host_buffer&gt; get_access(<br>
^<br>
In file included from tensorflow/core/ops/ctc_ops.cc:17:<br>
In file included from ./tensorflow/core/framework/shape_inference.h:20:<br>
In file included from ./tensorflow/core/framework/node_def_util.h:23:<br>
In file included from ./tensorflow/core/framework/attr_value_util.h:23:<br>
In file included from ./tensorflow/core/framework/partial_tensor_shape.h:20:<br>
In file included from ./tensorflow/core/framework/tensor_shape.h:21:<br>
In file included from ./third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:<br>
In file included from external/eigen_archive/unsupported/Eigen/CXX11/Tensor:99:<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:195:61: error: no member named 'map_allocator' in namespace 'cl::sycl'<br>
auto src_buf = cl::sycl::buffer&lt;uint8_t, 1, cl::sycl::map_allocator&lt;uint8_t&gt; &gt;(static_cast&lt;uint8_t*&gt;(static_cast&lt;void*&gt;(const_cast&lt;Index*&gt;(src))), cl::sycl::range&lt;1&gt;(n));<br>
~~~~~~~~~~^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:195:75: error: unexpected type name 'uint8_t': expected expression<br>
auto src_buf = cl::sycl::buffer&lt;uint8_t, 1, cl::sycl::map_allocator&lt;uint8_t&gt; &gt;(static_cast&lt;uint8_t*&gt;(static_cast&lt;void*&gt;(const_cast&lt;Index*&gt;(src))), cl::sycl::range&lt;1&gt;(n));<br>
^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:195:86: warning: expression result unused [-Wunused-value]<br>
auto src_buf = cl::sycl::buffer&lt;uint8_t, 1, cl::sycl::map_allocator&lt;uint8_t&gt; &gt;(static_cast&lt;uint8_t*&gt;(static_cast&lt;void*&gt;(const_cast&lt;Index*&gt;(src))), cl::sycl::range&lt;1&gt;(n));<br>
^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:198:31: error: expected unqualified-id<br>
auto src_acc =src_buf.template get_access&lt;cl::sycl::access::mode::read, cl::sycl::access::target::global_buffer&gt;(cgh);<br>
^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:198:107: error: nested name specifier 'cl::sycl::access::target::' for declaration does not refer into a class, class template or class template partial specialization<br>
auto src_acc =src_buf.template get_access&lt;cl::sycl::access::mode::read, cl::sycl::access::target::global_buffer&gt;(cgh);<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:198:120: error: expected ';' at end of declaration<br>
auto src_acc =src_buf.template get_access&lt;cl::sycl::access::mode::read, cl::sycl::access::target::global_buffer&gt;(cgh);<br>
^<br>
;<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:217:62: error: no member named 'map_allocator' in namespace 'cl::sycl'<br>
auto dest_buf = cl::sycl::buffer&lt;uint8_t, 1, cl::sycl::map_allocator&lt;uint8_t&gt; &gt;(static_cast&lt;uint8_t*&gt;(dst), cl::sycl::range&lt;1&gt;(n));<br>
~~~~~~~~~~^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:217:76: error: unexpected type name 'uint8_t': expected expression<br>
auto dest_buf = cl::sycl::buffer&lt;uint8_t, 1, cl::sycl::map_allocator&lt;uint8_t&gt; &gt;(static_cast&lt;uint8_t*&gt;(dst), cl::sycl::range&lt;1&gt;(n));<br>
^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:217:87: warning: expression result unused [-Wunused-value]<br>
auto dest_buf = cl::sycl::buffer&lt;uint8_t, 1, cl::sycl::map_allocator&lt;uint8_t&gt; &gt;(static_cast&lt;uint8_t*&gt;(dst), cl::sycl::range&lt;1&gt;(n));<br>
^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:220:32: error: expected unqualified-id<br>
auto dst_acc =dest_buf.template get_access&lt;cl::sycl::access::mode::discard_write, cl::sycl::access::target::global_buffer&gt;(cgh);<br>
^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:220:117: error: nested name specifier 'cl::sycl::access::target::' for declaration does not refer into a class, class template or class template partial specialization<br>
auto dst_acc =dest_buf.template get_access&lt;cl::sycl::access::mode::discard_write, cl::sycl::access::target::global_buffer&gt;(cgh);<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~^<br>
external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h:220:130: error: expected ';' at end of declaration<br>
auto dst_acc =dest_buf.template get_access&lt;cl::sycl::access::mode::discard_write, cl::sycl::access::target::global_buffer&gt;(cgh);<br>
^<br>
;<br>
2 warnings and 11 errors generated.<br>
Target //tensorflow/python/kernel_tests:basic_gpu_test failed to build<br>
Use --verbose_failures to see the command lines of failed build steps.<br>
INFO: Elapsed time: 10.427s, Critical Path: 9.81s<br>
INFO: 4 processes, local.<br>
FAILED: Build did NOT complete successfully<br>
Executed 0 out of 1 test: 1 fails to build</p>
</blockquote>
<p dir="auto">I understand TensorFlow only supports CUDA. What would need to be done to add in OpenCL support?</p>