microsoft / hummingbird

Hummingbird compiles trained ML models into tensor computation for faster inference.
MIT License
3.34k stars 278 forks source link

TVM + Mac #727

Closed ksaur closed 1 year ago

ksaur commented 1 year ago

Another issue in the pipeline:

Compiling tvm/_ffi/_cython/core.pyx because it changed.
Error compiling Cython file:
------------------------------------------------------------
...
        if self.c_is_view != 0:
            raise ValueError("to_dlpack do not work with memory views")
        with nogil:
            c_api_ret_code = TVMArrayToDLPack(self.chandle, &dltensor)
        CHECK_CALL(c_api_ret_code)
        return pycapsule.PyCapsule_New(dltensor, _c_str_dltensor, _c_dlpack_deleter)
                                                                  ^
------------------------------------------------------------

tvm/_ffi/_cython/./ndarray.pxi:116:66: Cannot assign type 'void (object) except *' to 'PyCapsule_Destructor'
[1/1] Cythonizing tvm/_ffi/_cython/core.pyx
Traceback (most recent call last):
  File "setup.py", line 238, in <module>
    ext_modules=config_cython(),
  File "setup.py", line 154, in config_cython
    return cythonize(ret, compiler_directives={"language_level": 3})
  File "/Users/runner/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1[13](https://github.com/microsoft/hummingbird/actions/runs/5592796893/jobs/10226035572#step:20:14)4, in cythonize
    cythonize_one(*args)
  File "/Users/runner/hostedtoolcache/Python/3.8.[17](https://github.com/microsoft/hummingbird/actions/runs/5592796893/jobs/10226035572#step:20:18)/x64/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1[30](https://github.com/microsoft/hummingbird/actions/runs/5592796893/jobs/10226035572#step:20:31)1, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: tvm/_ffi/_cython/core.pyx
Error: Process completed with exit code 1.

I don't want to block all of Hummingbird if TVM install fails on MacOS. Going forward, I think we need to remove MacOS+TVM compile from failout out the entire pipeline, else too many potential users will be blocked on contributing.

ksaur commented 1 year ago

@mshr-h do you have any ideas on how to best resolve this? (clearing cache didn't work.) My plan is to make the TVM-Mac install stuff as "ok to fail" in the pipeline, but maybe you have a better idea? :)

mshr-h commented 1 year ago

Seems like Cython 3.0.0 broke pyx compatibility. We can avoid the issue by pinning cython version. https://github.com/apache/tvm/pull/15353

ksaur commented 1 year ago

Thanks so much! I wasn't finding anything related to those error messages anywhere online, so hopefully this issue can help others too. (I thought I checked Cython version changes but obviously I missed it ;) )