Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS X failure: Check failed: type_code_ == kTVMType (11 vs. 6) expected TVMType but get bytes #280

Closed
ezyang opened this issue Jul 27, 2017 · 2 comments

Comments

@ezyang
Copy link
Contributor

ezyang commented Jul 27, 2017

After compiling and installing TVM on Mac OS X (with CUDA disabled, of course), when I attempt to use the Python API I get the following error:

(tvm) MacBook-Pro-97:python ezyang$ python
Python 3.6.2 | packaged by conda-forge | (default, Jul 23 2017, 23:01:38) 
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tvm
>>> tvm.var('a')
[12:19:27] dmlc-core/include/dmlc/logging.h:304: [12:19:27] include/tvm/./runtime/./packed_func.h:273: Check failed: type_code_ == kTVMType (11 vs. 6)  expected TVMType but get bytes

Stack trace returned 6 entries:
[bt] (0) 0   libtvm.so                           0x00000001103612e8 _ZN4dmlc15LogMessageFatalD2Ev + 40
[bt] (1) 1   libtvm.so                           0x0000000110365fe9 _ZNK3tvm7runtime11TVMArgValuecv10DLDataTypeEv + 393
[bt] (2) 2   libtvm.so                           0x00000001103687fa _ZNSt3__110__function6__funcIN3tvm2ir3$_0ENS_9allocatorIS4_EEFvNS2_7runtime7TVMArgsEPNS7_11TVMRetValueEEEclEOS8_OSA_ + 122
[bt] (3) 3   libtvm.so                           0x000000011060b62b TVMFuncCall + 75
[bt] (4) 4   _ctypes.cpython-36m-darwin.so       0x000000010f47f2b7 ffi_call_unix64 + 79
[bt] (5) 5   ???                                 0x00007fff50f154f0 0x0 + 140734551381232

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ezyang/Dev/tvm/python/tvm/api.py", line 115, in var
    return _api_internal._Var(name, dtype)
  File "/Users/ezyang/Dev/tvm/python/tvm/_ffi/function.py", line 255, in my_api_func
    return flocal(*args)
  File "/Users/ezyang/Dev/tvm/python/tvm/_ffi/_ctypes/function.py", line 183, in __call__
    ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
  File "/Users/ezyang/Dev/tvm/python/tvm/_ffi/base.py", line 62, in check_call
    raise TVMError(py_str(_LIB.TVMGetLastError()))
tvm._ffi.base.TVMError: [12:19:27] include/tvm/./runtime/./packed_func.h:273: Check failed: type_code_ == kTVMType (11 vs. 6)  expected TVMType but get bytes

Stack trace returned 6 entries:
[bt] (0) 0   libtvm.so                           0x00000001103612e8 _ZN4dmlc15LogMessageFatalD2Ev + 40
[bt] (1) 1   libtvm.so                           0x0000000110365fe9 _ZNK3tvm7runtime11TVMArgValuecv10DLDataTypeEv + 393
[bt] (2) 2   libtvm.so                           0x00000001103687fa _ZNSt3__110__function6__funcIN3tvm2ir3$_0ENS_9allocatorIS4_EEFvNS2_7runtime7TVMArgsEPNS7_11TVMRetValueEEEclEOS8_OSA_ + 122
[bt] (3) 3   libtvm.so                           0x000000011060b62b TVMFuncCall + 75
[bt] (4) 4   _ctypes.cpython-36m-darwin.so       0x000000010f47f2b7 ffi_call_unix64 + 79
[bt] (5) 5   ???                                 0x00007fff50f154f0 0x0 + 140734551381232

I'm willing to debug but posting here in case anyone has ideas.

@tqchen
Copy link
Member

tqchen commented Jul 27, 2017

There are two types for std::string in TVM.

  • kStr which is the type we need and can be casted safely to TVMType implicitly
  • kBytes which represent the binary blob(cannot be casted to TVMType)

In python side, string_types will be translated to kStr, while bytearray(for both py2, py3) are translated to kBytes.

This error is caused by passing bytes into type field of var(which I don't know why)

@ezyang
Copy link
Contributor Author

ezyang commented Jul 27, 2017

This turned out to be user error. I'll file a different bug explaining why.

@ezyang ezyang closed this as completed Jul 27, 2017
tqchen pushed a commit to tqchen/tvm that referenced this issue May 26, 2018
* Add creating gradient symbol

* Fix lint

* Address comments

* Fix typo

* Address comment
tqchen pushed a commit that referenced this issue May 29, 2018
* Add creating gradient symbol

* Fix lint

* Address comments

* Fix typo

* Address comment
tqchen pushed a commit to tqchen/tvm that referenced this issue Jul 6, 2018
* Add creating gradient symbol

* Fix lint

* Address comments

* Fix typo

* Address comment
grwlf pushed a commit to grwlf/tvm that referenced this issue Aug 8, 2018
* Add creating gradient symbol

* Fix lint

* Address comments

* Fix typo

* Address comment
gigiblender pushed a commit to gigiblender/tvm that referenced this issue Jan 19, 2023
* [TVMScript] enable the closure tests.
junrushao pushed a commit to junrushao/tvm that referenced this issue Feb 8, 2023
* [TVMScript] enable the closure tests.
yelite pushed a commit to yelite/tvm that referenced this issue Feb 17, 2023
* [TVMScript] enable the closure tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants