-
Notifications
You must be signed in to change notification settings - Fork 110
Only register cudnn executor if it is available #2174
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
Conversation
|
@riccardofelluga do the updates make you happier about the PR? |
t-vi
left a comment
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.
Looks good to me, let's give @riccardofelluga @vedaanta a chance to look at it before merging it Wed or Thu.
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.
Since we are modifying two files at this point wouldn't it be better to follow the same style as the other executors that are dependent on another library? Where we dedicate one file to be the gate for the symbols depending on the availability of the library(as in nvfuserex.py)
So something like cudnnex.py that takes care of the imports and checks and then cudnn_layernorm as is, and maybe creating cudnn_sdpa.py
@KaelanDt What do you think?
yes, i like that |
77b0340 to
67be58f
Compare
|
@riccardofelluga I tried a few things by adding a Since the |
|
the change looks good to me. @KaelanDt @t-vi I think we should not register cudnn layernorm at all. |
|
Thank you @vedaanta ! |
@KaelanDt Let me come in help here, instead of modifying the cudnn executor and doing a conditional registration of the executor, wouldn't it be better to create a conditional import like in nvfuserex.py? Would something like this in __all__ = ["cudnn_ex"]
cudnn_ex = None
if cudnn_available():
import import thunder.executors.cudnn_spda as sdpa_impl
cudnn_ex = sdpa_impl.cudnn_ex
else:
warnings.warn("cudnn not available")We can also make room for more complex import logic if needed (like say checking versions or disabling cudnn_linearnorm), all without modifying the cudnn executor registration. |
e07a942 to
07b2bfe
Compare
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci typo [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci revert function import [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci spda --> sdpa fix layernorm input cudnnex change the way cudnn is checked fix import bind functions add function def as none add accidentally deleted code bind import [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
95cb316 to
380cc84
Compare
riccardofelluga
left a comment
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!! Thanks for taking the time, I've added some suggestions. Please feel free to ping me if you need any help
0b54698 to
d92ddeb
Compare
add import to sdpa [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci import cudnn within sdpa missing import fix imports 2 fix import in layernorm module assign torch_to_cudnn_dtype to none fix test import remove unused import
98c9a1a to
23e76fc
Compare
riccardofelluga
left a comment
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.

Before submitting
What does this PR do?
Fixes #2149. Also removes cudnn from the BaseRecipe, as it is not always there and is not a core component of thunder (less so than nvfuser).
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃