# How to Access Triton Kernels from TorchInductor when running on CPU?

**URL:** <https://dev-discuss.pytorch.org/t/how-to-access-triton-kernels-from-torchinductor-when-running-on-cpu/2370>\
**Category:** compiler\
**Created:** [August 8, 2024, 10:50pm UTC](https://dev-discuss.pytorch.org/t/how-to-access-triton-kernels-from-torchinductor-when-running-on-cpu/2370 "2024-08-08T22:50:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeLi12345](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/joeli12345/32/2220_2.png) [@JoeLi12345](https://dev-discuss.pytorch.org/u/JoeLi12345)\
**Post date:** [August 8, 2024, 10:50pm UTC](https://dev-discuss.pytorch.org/t/how-to-access-triton-kernels-from-torchinductor-when-running-on-cpu/2370/1 "2024-08-08T22:50:30Z")

</div>

When running torch.compile for a PyTorch model and accessing the generated TorchInductor python code for graph with C++/Triton kernels as indicated [here](https://pytorch.org/tutorials/intermediate/inductor_debug_cpu.html), there appears to be no way to access the generated Triton code when using a CPU-device.

It appears as though all of the kernels are written in C++ when running on CPU; however, when running on CUDA, the kernels are written in Triton instead. Does PyTorch / TorchInductor offer a way to access the generated Triton kernels when running on a CPU device?

I can take care of running Triton on a CPU backend, but I need to be able to access the Triton kernels that are generated from PyTorch first.

---

<div class="post-metadata">

**Author:** ![jgong5](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/jgong5/32/675_2.png) [@jgong5](https://dev-discuss.pytorch.org/u/jgong5)\
**Post date:** [August 12, 2024, 1:39am UTC](https://dev-discuss.pytorch.org/t/how-to-access-triton-kernels-from-torchinductor-when-running-on-cpu/2370/2 "2024-08-12T01:39:33Z")

</div>

Hi @JoeLi12345 Thanks for the question. Triton codegen backend for CPU has not been enabled for Inductor yet. Only C++ codegen is available for now.
