[OpenCL] OpenCL build error for device=0x7f4340331660


#1

Hi,

I tried to import a ReLU (input was a vector with 6 floats) from TensorFlow and run it on OpenCL target.
The following was my code:

# tvm and nnvm
import nnvm
import tvm

# os and numpy
import numpy as np
import os.path

# Tensorflow imports
import tensorflow as tf
from tensorflow.core.framework import graph_pb2
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import tensor_util

# Tensorflow utility functions
import nnvm.testing.tf

from google.protobuf import text_format


# Target settings

target = 'opencl'
target_host = 'llvm'
layout = None
ctx = tvm.opencl(0)


with tf.gfile.FastGFile(os.path.join("./", 'tf_relu_example.pb'), 'rb') as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())
    graph = tf.import_graph_def(graph_def, name='')
    # Call the utility to import the graph definition into default graph.
    graph_def = nnvm.testing.tf.ProcessGraphDefParam(graph_def)
    # Add shapes to the graph.
    graph_def = nnvm.testing.tf.AddShapesToGraphDef('Relu')


sym, params = nnvm.frontend.from_tensorflow(graph_def, layout=layout)

print ("Tensorflow protobuf imported as nnvm graph")


import nnvm.compiler
graph, lib, params = nnvm.compiler.build(sym, target=target, target_host=target_host, params=params)


from tvm.contrib import graph_runtime
dtype = 'uint8'
m = graph_runtime.create(graph, lib, ctx)
# set inputs
m.set_input(**params)
# execute
m.run()
# get outputs
tvm_output = m.get_output(0, tvm.nd.empty([6], 'float32'))
print(tvm_output.asnumpy())

However, I encountered an error:

Traceback (most recent call last):
  File "nnvm_import_tf_relu_example.py", line 97, in <module>
    m.run()
  File "/home/sagi1210/Projects/tvm/python/tvm/contrib/graph_runtime.py", line 155, in run
    self._run()
  File "/home/sagi1210/Projects/tvm/python/tvm/_ffi/_ctypes/function.py", line 185, in __call__
    ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
  File "/home/sagi1210/Projects/tvm/python/tvm/_ffi/base.py", line 68, in check_call
    raise TVMError(py_str(_LIB.TVMGetLastError()))
tvm._ffi.base.TVMError: [15:14:04] /home/sagi1210/Projects/tvm/src/runtime/module_util.cc:53: Check failed: ret == 0 (-1 vs. 0) [15:14:04] /home/sagi1210/Projects/tvm/src/runtime/opencl/opencl_module.cc:216: OpenCL build error for device=0x7f4340331660fatal error: PCH file '/usr/lib64/beignet//beignet.pch' not found: module file not found


Stack trace returned 10 entries:
[bt] (0) /home/sagi1210/Projects/tvm/build/libtvm.so(dmlc::StackTrace[abi:cxx11]()+0x42) [0x7f43790506a9]
[bt] (1) /home/sagi1210/Projects/tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x31) [0x7f437905095b]
[bt] (2) /home/sagi1210/Projects/tvm/build/libtvm.so(+0x121ce00) [0x7f43796e1e00]
[bt] (3) /home/sagi1210/Projects/tvm/build/libtvm.so(+0x121d085) [0x7f43796e2085]
[bt] (4) /home/sagi1210/Projects/tvm/build/libtvm.so(std::function<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)>::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const+0x5a) [0x7f43790aa2d2]
[bt] (5) /home/sagi1210/Projects/tvm/build/libtvm.so(tvm::runtime::PackedFunc::CallPacked(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const+0x30) [0x7f4379145f56]
[bt] (6) /home/sagi1210/Projects/tvm/build/libtvm.so(+0x124edf0) [0x7f4379713df0]
[bt] (7) /home/sagi1210/Projects/tvm/build/libtvm.so(+0x125115e) [0x7f437971615e]
[bt] (8) /home/sagi1210/Projects/tvm/build/libtvm.so(std::function<void ()>::operator()() const+0x32) [0x7f43793bff5e]
[bt] (9) /home/sagi1210/Projects/tvm/build/libtvm.so(tvm::runtime::GraphRuntime::Run()+0x79) [0x7f4379711a1b]

And here were from my clinfo output:

Number of platforms                               1
  Platform Name                                   Intel Gen OCL Driver
  Platform Vendor                                 Intel
  Platform Version                                OpenCL 2.0 beignet 1.3
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             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_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_spir cl_khr_icd cl_intel_accelerator cl_intel_subgroups cl_intel_subgroups_short cl_khr_gl_sharing
  Platform Extensions function suffix             Intel

  Platform Name                                   Intel Gen OCL Driver
Number of devices                                 1
  Device Name                                     Intel(R) HD Graphics Kabylake Desktop GT1.5
  Device Vendor                                   Intel
  Device Vendor ID                                0x8086
  Device Version                                  OpenCL 2.0 beignet 1.3
  Driver Version                                  1.3
  Device OpenCL C Version                         OpenCL C 2.0 beignet 1.3
  Device Type                                     GPU
  Device Available                                Yes
  Device Profile                                  FULL_PROFILE

How could I solve the runtime error?

Thanks.