If you have a library of existing C++ custom ops that work with PyTorch, they may not work with torch.compile. Here’s our guide on how to get them to work: The C++ Custom Operators Manual - Google Docs .
We’re still looking into ways to make the experience better but would appreciate feedback from users.
Hi Richard, many thanks for the guidance! Wondering if there is a easier way to handle a broader case, say that there is some function/module/custom op that could cause issue with torch.compile.
Currently Dynamo offers API torch._dynamo.allow_in_graph in case there is something that user does not want trace through. However with this API Dynamo will still need to run the leaf node with fake tensor, there is an issue for it Torch Dynamo allow_in_graph doesn't capture the custom function in graph · Issue #97295 · pytorch/pytorch · GitHub.
Would it be possible to change the torch._dynamo.allow_in_graph API to record the leaf node output signature as well? Something like