Debugging

We provide functions to enable the output of debugging information, including the kernels that TC generates. If you are curious about what happens when a TC is compiled and run, you can use these functions to enable logging:

  • dump_cuda: print the generated cuda code
  • debug_lang: print the frontend IR and other information
  • debug_halide: print the Halide IR and other information.
  • debug_tc_mapper: print polyhedral IR and other information.
  • debug_tuner: print information logged by the autotuner.

The logging functionality is backed by Google’s glog library. To activate logging to screen, call tc.logtostderr(True). Otherwise, the logs are printed into uniquely-named files in the default temporary directory.

Example usage

import tensor_comprehensions as tc

tc.logtostderr(True)
tc.debug_tc_mapper(True)

# polyhedral IR will now be printed to stderr

Printing TC generated CUDA code

Using the functions above, you can also see the CUDA code that the TC polyhedral mapper generates for a kernel.

import tensor_comprehensions as tc

tc.logtostderr(True)
tc.dump_cuda(True)

# The generated CUDA code will now be printed to stderr