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

torch.compile fullgraph=True #97

Open
bhack opened this issue Jun 17, 2023 · 6 comments
Open

torch.compile fullgraph=True #97

bhack opened this issue Jun 17, 2023 · 6 comments

Comments

@bhack
Copy link
Contributor

bhack commented Jun 17, 2023

It seems that this section it is not compilable fullgraph:

torch._dynamo.exc.Unsupported: call_method UserDefinedObjectVariable(forward) __call__ [TensorVariable(), TensorVariable(), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int), ConstantVariable(int)] {}

from user code:
   File "/opt/conda/lib/python3.10/site-packages/spatial_correlation_sampler/spatial_correlation_sampler.py", line 105, in forward
    return SpatialCorrelationSamplerFunction.apply(input1, input2, self.kernel_size,
  File "/opt/conda/lib/python3.10/site-packages/spatial_correlation_sampler/spatial_correlation_sampler.py", line 66, in forward
    output = correlation.forward(input1, input2,

@bhack
Copy link
Contributor Author

bhack commented Jun 4, 2024

This is required https://pytorch.org/docs/main/notes/custom_operators.html
@ClementPinard After pytorch/pytorch#127301 (comment) we are constantly notified to wrap it as custom operators.

@ClementPinard
Copy link
Owner

Hi, there has been lots of development in the cpp-extension repo lately.
https://github.com/pytorch/extension-cpp

I do believe that a related update to the tutorial is coming.

Once it's available, I'll try to update this code to be tracable and compilable. In the mean time, I prefer to wait because I don't have much time right now for experimentations.

I hope all this will be sorted out in the next month or so, stay tuned !

@bhack
Copy link
Contributor Author

bhack commented Jun 4, 2024

@ClementPinard
Copy link
Owner

Thanks for the link, did not know it was already in the works !

How did you find it, is it an official draft ?

I'll try to find some time to read it and apply it on this repo as soon as possible.

@bhack
Copy link
Contributor Author

bhack commented Jun 4, 2024

Yes it is official, you missed my previous comment link 😉
https://pytorch.org/docs/main/notes/custom_operators.html

@bhack
Copy link
Contributor Author

bhack commented Jun 4, 2024

Just a side note.. do you think that there is a second chance to test https://github.com/limacv/CorrelationLayer with torch.compile?
It seems that in the meantime it is not aligned anymore to your API but if it could be aligned without to much effort it could be interesting to test/benchmark it with modern torch.compile on pure python code.

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

No branches or pull requests

2 participants