Skip to content
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

[FFI][BUGFIX] Grab GIL when check env signals #17419

Merged
merged 1 commit into from
Sep 26, 2024
Merged

Conversation

tqchen
Copy link
Member

@tqchen tqchen commented Sep 25, 2024

This PR updates the CheckSignals function to grab GIL. This is needed because we now explicitly release gil when calling any C functions. GIL will need to be obtained otherwise we will run into segfault when checking the signal.

The update now enables us to run ctrl + C in long running C functions.

@tqchen
Copy link
Member Author

tqchen commented Sep 25, 2024

run the following code and press control + C to check if signal is intercepted in python

import numpy as np
import tvm


def main():
    print("start")
    tvm.get_global_func("testing.check_signals")(0.01)
    print("good")

main()

This PR updates the CheckSignals function to grab GIL.
This is needed because we now explicitly release gil when calling
any C functions. GIL will need to be obtained otherwise we will
run into segfault when checking the signal.

The update now enables us to run ctrl + C in long running C functions.
@MasterJH5574
Copy link
Contributor

@tvm-bot rerun

@tqchen tqchen merged commit 5e85443 into apache:main Sep 26, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants