From b849983f140e9ab21c77d2d71468e752e00d4d97 Mon Sep 17 00:00:00 2001 From: Jinen Setpal Date: Tue, 17 Jun 2025 15:00:22 -0400 Subject: [PATCH] added triton cdist kernel entry also indexed entry 0015 --- kernel_overview.md | 2 ++ kernels/0016_Pairwise_Lp_Distance.md | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 kernels/0016_Pairwise_Lp_Distance.md diff --git a/kernel_overview.md b/kernel_overview.md index 037bef2..7b79f0c 100644 --- a/kernel_overview.md +++ b/kernel_overview.md @@ -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 | | diff --git a/kernels/0016_Pairwise_Lp_Distance.md b/kernels/0016_Pairwise_Lp_Distance.md new file mode 100644 index 0000000..c5add1b --- /dev/null +++ b/kernels/0016_Pairwise_Lp_Distance.md @@ -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