-
Notifications
You must be signed in to change notification settings - Fork 5.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
feat: throwing a warning when a sub-backend implementation is available but is not being used. #23489
feat: throwing a warning when a sub-backend implementation is available but is not being used. #23489
Conversation
…b_backend_handler.py.
…_implementation_available_but_not_used task.
…arn_efficient_implementation_available if necessary
…e a real warning instead of logging it.
…ion_available_but_not_used is now passing.
Thanks for contributing to Ivy! 😊👏 |
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.
Hey @Madjid-CH, just requested a few changes, thanks 😄
…for non-compositional functions
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.
PR Compliance Checks
Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.
Issue Reference
In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.
…backend_handler.py to avoid failing tests
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.
Just requested a few more changes, thanks @Madjid-CH 😄
…ssing fn_name directly
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.
Almost there, just a minor change, thanks @Madjid-CH 😄
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.
Hey @Madjid-CH, just a couple more comments, thanks 😄
…ntation # Conflicts: # ivy/utils/backend/sub_backend_handler.py
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.
Just a minor change, thanks @Madjid-CH 😄
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! Feel free to merge, thanks @Madjid-CH 😄
…tation is available but is not being used. (ivy-llc#23489)
…tation is available but is not being used. (ivy-llc#23489)
PR Description
This PR is for this task
my solution is to:
ivy.set_backend
I check available sub-backend implementations by analyzing the sub backend module and put the result in a dictionary._set_backend_as_ivy
I check if a given symbols has a sub backend implementation from the already populated dictionary in step 1 and if this the case we wrap the function with a wrapper that throws a warning when ever the function is used.there's an issue which is I need to import the ivy sub backend (for example this) dynamically and analyze it symbols to do step 1 this may lead to some errors if the real sub backend(for example this) is not installed properly (missing some cuda toolkits or something like that) so either we catch the error and abort the search or we search the sub backend module without importing it (some sort of static analysis) but I didn't find a way to do the later.