question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get_started.py error: src/codegen/codegen.cc:27: Check failed: bf != nullptr Target llvm is not enabled

See original GitHub issue

Is llvm necessary? I saw these lines in config.mk:

# whether build with LLVM support
# Requires LLVM version >= 4.0
# Set LLVM_CONFIG to your version, uncomment to build with llvm support
#
# LLVM_CONFIG = llvm-config

It seems llvm is not necessary and it’s commented out defaultly. However, I’m confused because of this error: nullptr Target llvm is not enabled

Env.

I installed tvm on my laptop. Ubuntu 16.04 64bit

clinfo


yuens@Spark:~$ clinfo                                                                                                                                                                                                                                                                                                   [16/16]
Number of platforms                               1
  Platform Name                                   Intel Gen OCL Driver
  Platform Vendor                                 Intel
  Platform Version                                OpenCL 1.2 beignet 1.1.1
  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_spir cl_khr_icd
  Platform Extensions function suffix             Intel

  Platform Name                                   Intel Gen OCL Driver
Number of devices                                 1
  Device Name                                     Intel(R) HD Graphics IvyBridge M GT2
  Device Vendor                                   Intel
  Device Vendor ID                                0x8086
  Device Version                                  OpenCL 1.2 beignet 1.1.1
  Driver Version                                  1.1.1
  Device OpenCL C Version                         OpenCL C 1.2 beignet 1.1.1
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Max compute units                               16
  Max clock frequency                             1000MHz
  Device Partition                                (core)
    Max number of sub-devices                     1
    Supported partition types                     None, None, None
  Max work item dimensions                        3
  Max work item sizes                             512x512x512
  Max work group size                             512
  Preferred work group size multiple              16
  Preferred / native vector sizes                 
    char                                                16 / 8       
    short                                                8 / 8       
    int                                                  4 / 4       
    long                                                 2 / 2       
    half                                                 0 / 8        (n/a)
    float                                                4 / 4       
    double                                               0 / 2        (n/a)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  Double-precision Floating-point support         (n/a)
  Address bits                                    32, Little-Endian
  Global memory size                              2147483648 (2GiB)
  Error Correction support                        No
  Max memory allocation                           1073741824 (1024MiB)
  Unified memory for Host and Device              Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        8192
  Global Memory cache line                        64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            65536 pixels
    Max 1D or 2D image array size                 2048 images
    Max 2D image size                             8192x8192 pixels
    Max 3D image size                             8192x8192x2048 pixels
    Max number of read image args                 128
    Max number of write image args                8
  Local memory type                               Global
  Local memory size                               65536 (64KiB)
  Max constant buffer size                        134217728 (128MiB)
  Max number of constant args                     8
  Max size of kernel argument                     1024
  Queue properties                                
    Out-of-order execution                        No
    Profiling                                     Yes
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      80ns
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            Yes
    SPIR versions                                 <printDeviceInfo:138: get   SPIR versions size : error -30>
  printf() buffer size                            1048576 (1024KiB)
  Built-in kernels                                __cl_copy_region_align4;__cl_copy_region_align16;__cl_cpy_region_unalign_same_offset;__cl_copy_region_unalign_dst_offset;__cl_copy_region_unalign_src_offset;__cl_copy_buffer_rect;__cl_copy_image_1d_to_1d;__cl_copy_image_2d_to_2d;__cl_copy_image_3d_to_2d;__cl_copy_image
_2d_to_3d;__cl_copy_image_3d_to_3d;__cl_copy_image_2d_to_buffer;__cl_copy_image_3d_to_buffer;__cl_copy_buffer_to_image_2d;__cl_copy_buffer_to_image_3d;__cl_fill_region_unalign;__cl_fill_region_align2;__cl_fill_region_align4;__cl_fill_region_align8_2;__cl_fill_region_align8_4;__cl_fill_region_align8_8;__cl_fill_region_
align8_16;__cl_fill_region_align128;__cl_fill_image_1d;__cl_fill_image_1d_array;__cl_fill_image_2d;__cl_fill_image_2d_array;__cl_fill_image_3d;
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Device 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_spir cl_khr_icd

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Intel Gen OCL Driver
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [Intel]
  clCreateContext(NULL, ...) [default]            Success [Intel]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 Intel Gen OCL Driver
    Device Name                                   Intel(R) HD Graphics IvyBridge M GT2
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 Intel Gen OCL Driver
    Device Name                                   Intel(R) HD Graphics IvyBridge M GT2

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.8
  ICD loader Profile                              OpenCL 1.2
        NOTE:   your OpenCL library declares to support OpenCL 1.2,
                but it seems to support up to OpenCL 2.1 too.

config.mk

I copy ./make/config.mk to root directory and modified lines below:

DEBUG = 1
USE_OPENCL = 1 # I installed opencl previously
USE_BLAS = openblas

After successful build, I set the environment variable and executed cd python; python setup.py install --user according to tvm/install.md.

Error Log

yuens@Spark:~/Software/tvm/tutorials/python$ python get_started.py 
<class 'tvm.tensor.Tensor'>
[15:44:03] /home/yuens/Software/tvm/dmlc-core/include/dmlc/logging.h:308: [15:44:03] src/codegen/codegen.cc:27: Check failed: bf != nullptr Target llvm is not enabled

Stack trace returned 10 entries:
[bt] (0) /home/yuens/Software/tvm/lib/libtvm.so(_ZN3tvm7codegen5BuildERKNS_5ArrayINS_11LoweredFuncEvEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x10b1) [0x7feac33eea41]
[bt] (1) /home/yuens/Software/tvm/lib/libtvm.so(+0x302eb9) [0x7feac339aeb9]
[bt] (2) /home/yuens/Software/tvm/lib/libtvm.so(TVMFuncCall+0x5e) [0x7feac35977ce]
[bt] (3) /usr/local/lib/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(ffi_call_unix64+0x4c) [0x7feacbef357c]
[bt] (4) /usr/local/lib/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(ffi_call+0x1f5) [0x7feacbef2cd5]
[bt] (5) /usr/local/lib/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(_ctypes_callproc+0x3e6) [0x7feacbeea376]
[bt] (6) /usr/local/lib/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(+0x9db3) [0x7feacbee1db3]
[bt] (7) /usr/local/lib/anaconda2/bin/../lib/libpython2.7.so.1.0(PyObject_Call+0x53) [0x7feacd4cde93]
[bt] (8) /usr/local/lib/anaconda2/bin/../lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x715d) [0x7feacd58080d]
[bt] (9) /usr/local/lib/anaconda2/bin/../lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x89e) [0x7feacd582c3e]

Traceback (most recent call last):
  File "get_started.py", line 111, in <module>
    fadd_cuda = tvm.build(s, [A, B, C], "cuda", target_host="llvm", name="myadd")
  File "/home/yuens/Software/tvm/python/tvm/build_module.py", line 349, in build
    mhost = codegen.build_module(fhost, target_host)
  File "/home/yuens/Software/tvm/python/tvm/codegen.py", line 20, in build_module
    return _Build(lowered_func, target)
  File "/home/yuens/Software/tvm/python/tvm/_ffi/function.py", line 255, in my_api_func
    return flocal(*args)
  File "/home/yuens/Software/tvm/python/tvm/_ffi/_ctypes/function.py", line 183, in __call__
    ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
  File "/home/yuens/Software/tvm/python/tvm/_ffi/base.py", line 62, in check_call
    raise TVMError(py_str(_LIB.TVMGetLastError()))
tvm._ffi.base.TVMError: [15:44:03] src/codegen/codegen.cc:27: Check failed: bf != nullptr Target llvm is not enabled

Stack trace returned 10 entries:
[bt] (0) /home/yuens/Software/tvm/lib/libtvm.so(_ZN3tvm7codegen5BuildERKNS_5ArrayINS_11LoweredFuncEvEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x10b1) [0x7feac33eea41]
[bt] (1) /home/yuens/Software/tvm/lib/libtvm.so(+0x302eb9) [0x7feac339aeb9]
[bt] (2) /home/yuens/Software/tvm/lib/libtvm.so(TVMFuncCall+0x5e) [0x7feac35977ce]
[bt] (3) /usr/local/lib/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(ffi_call_unix64+0x4c) [0x7feacbef357c]
[bt] (4) /usr/local/lib/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(ffi_call+0x1f5) [0x7feacbef2cd5]
[bt] (5) /usr/local/lib/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(_ctypes_callproc+0x3e6) [0x7feacbeea376]
[bt] (6) /usr/local/lib/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(+0x9db3) [0x7feacbee1db3]
[bt] (7) /usr/local/lib/anaconda2/bin/../lib/libpython2.7.so.1.0(PyObject_Call+0x53) [0x7feacd4cde93]
[bt] (8) /usr/local/lib/anaconda2/bin/../lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x715d) [0x7feacd58080d]
[bt] (9) /usr/local/lib/anaconda2/bin/../lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x89e) [0x7feacd582c3e]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yzhliucommented, Aug 18, 2017

run llvm-config in shell to make sure llvm is installed correctly. if you are generating llvm target, then llvm is necessary.

1reaction
ysh329commented, Aug 18, 2017

@Huyuwei

I rebuild with LLVM_CONFIG. However, build failed as below:

src/codegen/llvm/././llvm_common.h:10:40: fatal error: llvm/ExecutionEngine/MCJIT.h: No such file or directory
compilation terminated.
Makefile:160: recipe for target 'build/codegen/llvm/codegen_arm.o' failed
make: *** [build/codegen/llvm/codegen_arm.o] Error 1
make: *** Waiting for unfinished jobs....
Read more comments on GitHub >

github_iconTop Results From Across the Web

Check failed: bf != nullptr Target llvm is not enabled · Issue ...
After successful build, I set the environment variable and executed cd python; python setup.py install --user according to tvm/install.md .
Read more >
TVMError: Check failed: bf != nullptr: Target llvm is not enabled
TVMError: Check failed: bf != nullptr: Target llvm is not enabled. I'm on windows 10. and have built TVM with “Visual Studio 16...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found