We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce41ec8 commit fbbc6c6Copy full SHA for fbbc6c6
torch_xla/csrc/xla_graph_executor.cpp
@@ -641,6 +641,10 @@ std::vector<at::Tensor> XLAGraphExecutor::GetTensorsFused(
641
// Execution is async in PJRT, so TransferFromServer may block until execution
642
// completes. Release the GIL so other threads can proceed and unblock any
643
// collective computations.
644
+ // HACK: This method may be called outside of python (mainly in C++ tests) or
645
+ // when the GIL is already released, so we must check both cases here. If
646
+ // possible, prefer to release the GIL in the python bindings before copying
647
+ // this pattern.
648
PyThreadState* save = nullptr;
649
if (Py_IsInitialized() && PyGILState_Check()) {
650
save = PyEval_SaveThread();
0 commit comments