-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
relock gil #3196
relock gil #3196
Conversation
python/src/llvm.cc
Outdated
@@ -239,6 +239,7 @@ void init_triton_llvm(py::module &&m) { | |||
} | |||
std::string obj = translateLLVMIRToASM( | |||
*module, triple, proc, features, flags, enable_fp_fusion, isObject); | |||
py::gil_scoped_acquire no_threads; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but can you fix the formatting? :)
python/src/llvm.cc
Outdated
@@ -239,6 +239,7 @@ void init_triton_llvm(py::module &&m) { | |||
} | |||
std::string obj = translateLLVMIRToASM( | |||
*module, triple, proc, features, flags, enable_fp_fusion, isObject); | |||
py::gil_scoped_acquire no_threads; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor issue: this results in an unnecessary sequence of unlock -> lock -> unlock -> lock
because gil_scoped_acquire
releases the GIL in its destructor. It would be better to move the gil_scoped_release
into a more narrow scope, e.g.
{
py::gil_scoped_release allow_threads;
...
}
return isObject ? py::bytes(obj) : py::str(obj);
Releasing causes a fault in the 'if (isObject) ' path because a malloc happens and the gil is assumed to be held. Signed-off-by: Tom Rix <trix@redhat.com>
6f99015
to
c34cf2e
Compare
Changes requested have been made. |
Releasing causes a fault in the 'if (isObject) ' path because a malloc happens and the gil is assumed to be held. Signed-off-by: Tom Rix <trix@redhat.com> Co-authored-by: Philippe Tillet <phil@openai.com>
Releasing causes a fault in the 'if (isObject) ' path because a malloc happens and the gil is assumed to be held. Signed-off-by: Tom Rix <trix@redhat.com> Co-authored-by: Philippe Tillet <phil@openai.com>
Releasing causes a fault in the 'if (isObject) ' path because a malloc happens and the gil is assumed to be held.