Hi, how do I check my model has been successfully compiled in Pytorch 2, after calling torch.compile(). Basically, is there any properties in the model that I can check that it’s a compiled model?
Thanks
Hi, how do I check my model has been successfully compiled in Pytorch 2, after calling torch.compile(). Basically, is there any properties in the model that I can check that it’s a compiled model?
Thanks
There’s a test utility that’s very helpful for this called CompileCounter
pytorch/test_compile.py at main · pytorch/pytorch · GitHub
But otherwise the compilation happens after the first inference and another easy way to sanity check is to make sure kernels were generated if you add TORCH_COMPILE_DEBUG
to True as an environemnt variable
Thanks for your reply! For the second solution, how can I check the kernels are generated?
The way I usually do it if I set TORCH_COMPILE_DEBUG
then I’ll see the Triton or C++ kernels generated in a tmp
folder that’ll be printed to your console if the debug flag is set
Hi, got it, many thanks!