You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tvm.apache.org by Tianqi Chen <no...@github.com.INVALID> on 2022/05/25 20:16:30 UTC

[apache/tvm] [FFI][CYTHON] Release GIL when calling into long running functions (PR #11461)

Unlike ctypes, Cython by default do not release GIL when
calling into C API functions. This causes problems when the
function is long running. As the particular calling thread will
block other python threads by holding the GIL.

This PR explicitly releases GIL when calling into possible
long running functions. It fixes the timeout issue in
PopenPool which previously relied on another python thread
for timeout.

This PR is covered by a regression test-case by changing time.sleep to sleep
in FFI, which previously will indefinitely block the popen tests.

You can view, comment on, or merge this pull request online at:

  https://github.com/apache/tvm/pull/11461

-- Commit Summary --

  * [FFI][CYTHON] Release GIL when calling into long running functions

-- File Changes --

    M python/tvm/_ffi/_cython/base.pxi (36)
    M python/tvm/_ffi/_cython/ndarray.pxi (20)
    M python/tvm/_ffi/_cython/object.pxi (4)
    M python/tvm/_ffi/_cython/packed_func.pxi (32)
    M python/tvm/testing/popen_pool.py (3)
    M python/tvm/testing/utils.py (6)
    M src/support/ffi_testing.cc (6)

-- Patch Links --

https://github.com/apache/tvm/pull/11461.patch
https://github.com/apache/tvm/pull/11461.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/pull/11461
You are receiving this because you are subscribed to this thread.

Message ID: &lt;apache/tvm/pull/11461@github.com&gt;

Re: [apache/tvm] [FFI][CYTHON] Release GIL when calling into long running functions (PR #11461)

Posted by Tianqi Chen <no...@github.com.INVALID>.
Fixes https://github.com/apache/tvm/pull/11434

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/pull/11461#issuecomment-1137807966
You are receiving this because you are subscribed to this thread.

Message ID: <ap...@github.com>

Re: [apache/tvm] [FFI][CYTHON] Release GIL when calling into long running functions (PR #11461)

Posted by Junru Shao <no...@github.com.INVALID>.
Merged #11461 into main.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/pull/11461#event-6694590679
You are receiving this because you are subscribed to this thread.

Message ID: <ap...@github.com>