# No CPU backend in triton

**URL:** <https://dev-discuss.pytorch.org/t/no-cpu-backend-in-triton/2599>\
**Category:** FX\
**Created:** [November 17, 2024, 5:26am UTC](https://dev-discuss.pytorch.org/t/no-cpu-backend-in-triton/2599 "2024-11-17T05:26:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zero000064](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/zero000064/32/1745_2.png) [@zero000064](https://dev-discuss.pytorch.org/u/zero000064)\
**Post date:** [November 17, 2024, 5:26am UTC](https://dev-discuss.pytorch.org/t/no-cpu-backend-in-triton/2599/1 "2024-11-17T05:26:52Z")

</div>

I’m reproducing a test failure in my pull request, [https://hud.pytorch.org/pr/pytorch/pytorch/139141#33075326227](https://hud.pytorch.org/pr/pytorch/pytorch/139141#33075326227), a triton failure in CPU backend.  
BUt my triton doesn’t have CPU backend, so I couldn’t test it.  
Here’s CPU backends my triton supports:  
‘nvidia’: Backend(compiler=\<class ‘nvi.CUDABackend’\>, driver=\<class ‘nvi.CudaDriver’\>), ‘amd’: Backend(compiler=\<class ‘.HIPBackend’\>, driver=\<class ‘.HIPDriver’\>)}

How to reproduce this issue?

---

<div class="post-metadata">

**Author:** ![zero000064](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/zero000064/32/1745_2.png) [@zero000064](https://dev-discuss.pytorch.org/u/zero000064)\
**Post date:** [November 17, 2024, 10:57pm UTC](https://dev-discuss.pytorch.org/t/no-cpu-backend-in-triton/2599/2 "2024-11-17T22:57:47Z")

</div>

I found an experimental triton version with CPU backend, [GitHub - triton-lang/triton-cpu: An experimental CPU backend for Triton](https://github.com/triton-lang/triton-cpu), guess this is the new version, will try this version first.

---

<div class="post-metadata">

**Author:** ![jansel](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/jansel/32/74_2.png) [@jansel](https://dev-discuss.pytorch.org/u/jansel)\
**Post date:** [November 24, 2024, 12:27am UTC](https://dev-discuss.pytorch.org/t/no-cpu-backend-in-triton/2599/3 "2024-11-24T00:27:15Z")

</div>

The Triton CPU backend is currently out of tree (not included with default Triton) and should be installed from [GitHub - triton-lang/triton-cpu: An experimental CPU backend for Triton](https://github.com/triton-lang/triton-cpu)

---

<div class="post-metadata">

**Author:** ![GodHforever](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/godhforever/32/2516_2.png) [@GodHforever](https://dev-discuss.pytorch.org/u/GodHforever)\
**Post date:** [January 20, 2025, 9:44am UTC](https://dev-discuss.pytorch.org/t/no-cpu-backend-in-triton/2599/4 "2025-01-20T09:44:24Z")

</div>

Is there any introduction for using triton-cpu as the backend of inductor?  
I mean usually there are some docs or other materials for triton-gpu in dynamo, but triton-cpu may be a new feature with only PRs in pytorch repo.  
I’d like to explore how those developers introduce triton-cpu into inductor  
@jansel@zero000064

---

<div class="post-metadata">

**Author:** ![jansel](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/jansel/32/74_2.png) [@jansel](https://dev-discuss.pytorch.org/u/jansel)\
**Post date:** [January 20, 2025, 9:04pm UTC](https://dev-discuss.pytorch.org/t/no-cpu-backend-in-triton/2599/5 "2025-01-20T21:04:54Z")

</div>

cc @int3 who might be able to fill in more details.

Once you have installed the CPU version of triton (linked above), you can get inductor to use it with:

```auto
torch._inductor.config.cpu_backend = "triton"

```

or `torch.compile(options={"cpu_backend": "triton"})` (make sure you are using the latest nightly build)

You can verify it is working with `TORCH_LOGS=output_code`

Note the backend is still experimental and may have some bugs.
