Info on how to make custom backend with primtorch

If we would like to work on a custom backend using the canonicalized operators in PT2.0’s PrimTorch, are there any examples or tutorials on how to go about doing this?

Hi, there!
To use the primTorch backend, you can do the following, and the rest of the story remains the same.

In [1]: import torch

In [2]: import torch._prims as prims

In [3]: prims.add(torch.tensor([1, 2, 3]), torch.tensor([6, 5, 4]))
Out[3]: tensor([7, 7, 7])

PS: If you are looking at the working of primTorch, there’s a great post by @mruberry on Tracing with primitives. Although, it’s more of a developer discussion rather than a tutorial or example.

Out of curiosity, why do you want to use primTorch operators?
Thanks!

Thanks for the reply!

I was more so asking about the process for plugging in a custom backend at the ATen IR level. According to a previous PT2.0 announcement, it seems like if I were to write a backend that minimally implements the ~200 PrimTorch operators, that would be sufficient. However I cannot seem to find any additional directions on how to go about doing this.

Hi, just wanted to bump this post again and see if there is any info available on custom backend integration through primtorch.