tlc-pack / tlcpack

https://tlcpack.ai/
Apache License 2.0
23 stars 30 forks source link

apache-tvm pip package doesn't support Hexagon Launcher #134

Open mehrdadh opened 2 years ago

mehrdadh commented 2 years ago

I was trying to use hexagon launcher from the apache-tvm pip package and I got this error:

  File "/home/mhessar/.cache/pypoetry/virtualenvs/hexagon-ci-3FznOw5Q-py3.8/lib/python3.8/site-packages/tvm/contrib/hexagon/build.py", line 491, in start_server
    self._copy_binaries()
  File "/home/mhessar/.cache/pypoetry/virtualenvs/hexagon-ci-3FznOw5Q-py3.8/lib/python3.8/site-packages/tvm/contrib/hexagon/build.py", line 372, in _copy_binaries
    with open(_get_hexagon_rpc_lib_dir() / f"{ANDROID_BASH_FILE_NAME}.template", "r") as src_f:
  File "/home/mhessar/.cache/pypoetry/virtualenvs/hexagon-ci-3FznOw5Q-py3.8/lib/python3.8/site-packages/tvm/contrib/hexagon/build.py", line 59, in _get_hexagon_rpc_lib_dir
    raise RuntimeError("hexagon_api binaries not found, please define HEXAGON_RPC_LIB_DIR")
RuntimeError: hexagon_api binaries not found, please define HEXAGON_RPC_LIB_DIR

I think the reason is that for hexagon we are building hexaong_api which generates some files in HEXAGON_RPC_LIB_DIR direcotory, but they are not included in this build.

cc @areusch

leandron commented 2 years ago

I guess the fix for this is in TVM, similar to what we do with other support files directories?

https://github.com/apache/tvm/blob/a1c371f46cf77dcdffa6f0ab55f5036bff1c5624/python/setup.py#L73-L78

mehrdadh commented 2 years ago

@leandron that's one aspect of the problem, the other thing is that Hexagon is not enabled by default. I don't know how we are going to release package with support for other hardware. The same question exists for microTVM but I think enabling microTVM by default is not that hard

leandron commented 2 years ago

@leandron that's one aspect of the problem, the other thing is that Hexagon is not enabled by default. I don't know how we are going to release package with support for other hardware. The same question exists for microTVM but I think enabling microTVM by default is not that hard

I see. Just to clarify, this is what is currently enabled in the apache-tvm packaging.

https://github.com/tlc-pack/tlcpack/blob/682497b21038f1e5c0b642e28bd25e6c1de0b214/wheel/build_wheel_manylinux.sh#L92-L109

mehrdadh commented 2 years ago

@leandron that's good to know! So I tried to make microtvm to be ON by default and that turns out to be an issue with building the hexagon_api: https://github.com/apache/tvm/pull/12227 You don't see the error on the CI because I disabled MICROTVM in this file: https://github.com/apache/tvm/pull/12227/files#diff-725711af3d7d48c0b3b970e966fc424796739f3714e1a63f8f40968de5cddd6aR91

If we can fix this issue then we can enable hexagon in the pip package.