yzh119 opened a new issue, #190:
URL: https://github.com/apache/tvm-ffi/issues/190

   currently tvm-ffi relies on `torch.utils.cpp_extension`'s `load_inline` 
function to build platform specific dlpack extensions for torch:
   
   
https://github.com/yzh119/tvm-ffi/blob/df40d879dbf36e3ed3c19b035cad6dab2245eafd/python/tvm_ffi/_optional_torch_c_dlpack.py#L620-L628
   
   `load_inline` has a known deadlock issue and user may run into it when first 
import `tvm_ffi`:
   ```bash
   File "/***/miniforge3/lib/python3.12/site-packages/tvm_ffi/__init__.py", 
line 51, in <module>
     from . import _optional_torch_c_dlpack
   File 
"/***/miniforge3/lib/python3.12/site-packages/tvm_ffi/_optional_torch_c_dlpack.py",
 line 566, in <module>
     _mod = load_torch_c_dlpack_extension()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File 
"/***/miniforge3/lib/python3.12/site-packages/tvm_ffi/_optional_torch_c_dlpack.py",
 line 540, in load_torch_c_dlpack_extension
     mod = cpp_extension.load_inline(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
   File 
"/***/miniforge3/lib/python3.12/site-packages/torch/utils/cpp_extension.py", 
line 2065, in load_inline
     return _jit_compile(
            ^^^^^^^^^^^^^
   File 
"/***/miniforge3/lib/python3.12/site-packages/torch/utils/cpp_extension.py", 
line 2166, in _jit_compile
     baton.wait()
   File 
"/***/miniforge3/lib/python3.12/site-packages/torch/utils/file_baton.py", line 
50, in wait
     time.sleep(self.wait_seconds)
   ```
   
   We should get rid of torch's `load_inline` function (use our own 
implementation to get around the deadlock) or pre-compile the extensions in the 
wheels: https://github.com/apache/tvm-ffi/pull/189.
   
   Before that, we should let user know this potential issue and encourage user 
to clean up `torch._appdirs.user_cache_dir() + "torch_extensions"` in FAQ.
   
   This is a critical issue that severely harms user experience that we should 
prioritize a fix before v0.1.1


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to