tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Better specify `torch.compile behaviour` on nested function/module

Open bhack opened this issue 1 year ago • 10 comments

📚 The doc issue

Can we better specify the behavior and eventually the best practices when decorating a function or compiling a module and the effect on the nested modules and nested function call?

https://pytorch.org/tutorials/intermediate/torch_compile_tutorial.html

Suggest a potential alternative/fix

No response

cc @sekyondaMeta @svekars @kit1980 @williamwen42 @msaroufim @ezyang @bdhirsh @anijain2305 @zou3519 @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov @kadeng

bhack avatar Feb 02 '24 12:02 bhack

/assigntome

awayzjj avatar Jun 05 '24 09:06 awayzjj

@awayzjj Are you still working on this issue? If not I would like to help. Thanks!

cc @sekyondaMeta

ignaciobartol avatar Jun 09 '24 15:06 ignaciobartol

I removed the assighment! You can take it! @ignaciobartol

awayzjj avatar Jun 11 '24 02:06 awayzjj

I assigned myself to another issue yesterday and still I'm working on it, I apologize for the confusion if you still wanted to work on it. I will check back later today after submitting a PR to see if this one is still available. But thanks!! @awayzjj

ignaciobartol avatar Jun 11 '24 12:06 ignaciobartol

/cc @ezyang Just in the case we could use this to improve the documentation about the best practices on reporting torch.compiler failures on nested function/modules.

bhack avatar Jun 11 '24 12:06 bhack

/assigntome

ignaciobartol avatar Jun 11 '24 20:06 ignaciobartol

Not sure what you're looking for here. If you torch.compile a function, we will try to recursively inline/compile every function call inside it. If there's a graph break, we will try again for inner frames. There are some other functions to disable this process if needed.

ezyang avatar Jun 12 '24 01:06 ezyang

Yes I think currently this is not explicitly specified in the doc right? Other then this if there is some general hint to help to reporting bugs.. e.g. try to compile leaf defin the graph before reporting a ticket in the recursive case or something similar it could help in that documentation section (then we could link to a section of your WIP doc when ready).

bhack avatar Jun 12 '24 01:06 bhack

OK, send a doc patch for this @ignaciobartol, thanks

ezyang avatar Jun 12 '24 20:06 ezyang

@ezyang Yes, sorry I got caught up with other work yesterday. I will work on it later today and submit a PR

ignaciobartol avatar Jun 13 '24 19:06 ignaciobartol