Debugging - 57300

ZenDNN User Guide (57300)

Document ID
57300
Release Date
2025-08-18
Revision
5.1 English

PyTorch offers a debugging toolbox that comprises a built-in stats and trace function. This functionality facilitates the display of the time spent by each compilation phase, output code, output graph visualization, and IR dump. TORCH_COMPILE_DEBUG invokes this debugging tool that allows for better problem-solving while troubleshooting the internal issues of TorchDynamo and TorchInductor. This functionality works for the models optimized using zentorch, and hence it can be leveraged to debug these models too. To enable this functionality, either set the environment variable TORCH_COMPILE_DEBUG=1 or specify the environment variable with the runnable file (for example, test.py) as input.

For example, if the file test.py contains a model optimized by torch.compile with zentorch as backend, use:
TORCH_COMPILE_DEBUG=1 python test.py