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

Resolve race-condition in disable_module_accelerator #17811

Merged
merged 4 commits into from
Jan 25, 2025

Conversation

galipremsagar
Copy link
Contributor

Description

Fixes: #17775

This PR fixes a race condition that arises when disable_module_accelerator is used in a multi-threaded setting.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@galipremsagar galipremsagar added bug Something isn't working 3 - Ready for Review Ready for review by team non-breaking Non-breaking change labels Jan 24, 2025
@galipremsagar galipremsagar self-assigned this Jan 24, 2025
@galipremsagar galipremsagar requested a review from a team as a code owner January 24, 2025 16:55
@github-actions github-actions bot added Python Affects Python cuDF API. cudf.pandas Issues specific to cudf.pandas labels Jan 24, 2025
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me.

saved = self._use_fast_lib
self._use_fast_lib = False
try:
yield
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a dumb question Is it possible for self._use_fast_lib to be modified during this yield statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this move seems to be also bringing back the race-condition.

@@ -613,7 +616,7 @@ def disable_module_accelerator() -> contextlib.ExitStack:
"""
Temporarily disable any module acceleration.
"""
with contextlib.ExitStack() as stack:
with ImportLock(), contextlib.ExitStack() as stack:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Is it ok if we call stack.enter_context(ImportLock()) after this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this change too and the race-condition seems to be coming back.

Note: I tried both suggestions separately and together, all three combinations result in branch-25.02 behavior i.e., a race condition.

@galipremsagar
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 133e0c8 into rapidsai:branch-25.02 Jan 25, 2025
105 of 107 checks passed
@galipremsagar galipremsagar added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team labels Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge bug Something isn't working cudf.pandas Issues specific to cudf.pandas non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BUG] load_ext cudf.pandas slows down snowpark to_pandas
4 participants