Skip to content

Commit 685711d

Browse files
authored
Acquire GIL lock when releasing DLPack tensors (triton-inference-server#198)
1 parent 7668bda commit 685711d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ FetchContent_MakeAvailable(repo-common repo-core repo-backend)
7474
FetchContent_Declare(
7575
pybind11
7676
GIT_REPOSITORY "https://github.com/pybind/pybind11"
77-
GIT_TAG "v2.6"
77+
GIT_TAG "v2.10"
7878
GIT_SHALLOW ON
7979
)
8080
FetchContent_MakeAvailable(pybind11)
@@ -85,7 +85,7 @@ FetchContent_MakeAvailable(pybind11)
8585
FetchContent_Declare(
8686
dlpack
8787
GIT_REPOSITORY "https://github.com/dmlc/dlpack"
88-
GIT_TAG "v0.5"
88+
GIT_TAG "v0.7"
8989
GIT_SHALLOW ON
9090
)
9191
FetchContent_MakeAvailable(dlpack)

src/pb_tensor.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ PbTensor::ToDLPack()
247247
dlpack_tensor->dl_tensor.strides = nullptr;
248248
dlpack_tensor->manager_ctx = this;
249249
dlpack_tensor->deleter = [](DLManagedTensor* m) {
250+
// We need to acquire GIL since the framework that deleted the dlpack tensor
251+
// may not have acquired GIL when calling this function.
252+
py::gil_scoped_acquire gil;
250253
if (m->manager_ctx == nullptr) {
251254
return;
252255
}

0 commit comments

Comments
 (0)