Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kernel_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@
| 12 | Batched Patchng | Rearranging | [link](kernels/0012_Patching.md) |
| 13 | Block-Sparse Matrix Multiplication | Sparsity, Matmul | [link](kernels/0013_Sparse_Matmul.md) |
| 14 | Fused Linear Cross Entropy | Linear Cross Entropy | [link](kernels/0014_Fused_Linear_Cross_Entropy.md) |
| 15 | GPTQ Inference | GPTQ | [link](kernels/0015_GPTQ_Triton.md) |
| 16 | Pairwise Lp Distance | Distance | [link](kernels/0016_Pairwise_Lp_Distance.md) |
| n+1 | your contribution | its tags | |
25 changes: 25 additions & 0 deletions kernels/0016_Pairwise_Lp_Distance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Pairwise Lp Distance

**Link:** https://github.com/jinensetpal/triton_cdist/blob/3305c5592c51b51f1080933e58ab66c1fbaa620d/triton_cdist/lp_reduce.py

**Author:** Jinen Setpal

**Tags:** Distance

**Description:** A direct replacement of torch's [cdist](https://docs.pytorch.org/docs/stable/generated/torch.cdist.html#torch-cdist), including support for backprop. Doesn't take torch's `compute_mode` argument.

**Minimal Usage:**
```py
import triton_cdist # registers operator

# from here you can use it as a stand-in replacement of `torch.cdist`.

x1 = ...
x2 = ...
p = ...
torch.ops.triton_cdist.opt_cdist(x1, x2, p=p) # previously, `torch.cdist(x1, x1, p=p)`
```

**Triton Version:** v3.3.1+

**Id in triton index:** 0016