-
Notifications
You must be signed in to change notification settings - Fork 84
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
Automatic registration of torch operators using FakeTensor #554
Conversation
Hey this is pretty cool! I've tried it with this example that we had no op implemented and it worked! import torch
import thunder
@thunder.jit
def func(x, y, z):
t0 = torch.baddbmm(x, y, z)
return t0
t0 = torch.randn(10, 3, 5)
b1 = torch.randn(10, 3, 4)
b2 = torch.randn(10, 4, 5)
out = func(t0, b1, b2)
print(thunder.last_traces(func)[-1])
print(out.size()) looking forward for this feature! |
currently output trace is like:
|
e2ea5c3
to
210ed60
Compare
First off, great job, @kiya00 ! One fundamental question I would have about the design is: given that we are talking about a finite set of operators here, would it be more transparent to autogenerate the code for them and keep them a file? That would have us need to keep up / update for new stuff PyTorch introduces, but in general, it would be less magic. When we implement something in a more detailed way, it would be removed from the autogeneration to manual. I'm imagining that we could/would still use the bulk of your code, just the time of registration would move. WDYT? |
f6126fc
to
88fe4b3
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…ot supported. (eg: unfold)
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Co-authored-by: Masaki Kozuki <mkozuki@nvidia.com>
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.
Awesome work!
There are only a few cosmetic changes to be done and then I think we should merge this.
Co-authored-by: Ivan Yashchuk <IvanYashchuk@users.noreply.github.com>
for more information, see https://pre-commit.ci
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.
what an awesome work
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.
The PR looks really great! Just had a couple of suggestions, thank you @kiya00!
Hi @t-vi , I found the CI failure seems unrelated to this PR, and can only reproduce it locally by running |
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.
What does this PR do?
Design doc: https://docs.google.com/document/d/1BVr_5co6GDj3wC7NrWq0ckfsbgX5l6w1dOSFBi2c-Hc/edit?usp=sharing
This PR did some experiments to use FakeTensor for our meta function to allow automatic fallback to torch operators when the op is not supposed to have a fusion backend.
Currently it can work for the example test cases(the sinc, hsplit, normalize, adaptive_avg_pool3d are ops currently not added in thunder ):
Fixes #811
cc: @IvanYashchuk