# Slides from Structured Kernel presentation

**URL:** <https://dev-discuss.pytorch.org/t/slides-from-structured-kernel-presentation/179>\
**Category:** hardware-backends\
**Created:** [March 16, 2021, 10:12pm UTC](https://dev-discuss.pytorch.org/t/slides-from-structured-kernel-presentation/179 "2021-03-16T22:12:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdhirsh](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/bdhirsh/32/575_2.png) [@bdhirsh](https://dev-discuss.pytorch.org/u/bdhirsh)\
**Post date:** [March 16, 2021, 10:12pm UTC](https://dev-discuss.pytorch.org/t/slides-from-structured-kernel-presentation/179/1 "2021-03-16T22:12:08Z")

</div>

I gave an internal talk on Structured Kernels, a new way of writing kernels in PyTorch. Posting the slides here: [Structured Kernels - Google Slides](https://docs.google.com/presentation/d/1_PBXPBD5ArFAD8fPh7yJ1L1QHOow2akKCc7C86OwaEQ/edit?usp=sharing).

Also, check out the actual RFC, which contains a more detailed version of everything in the slides! [rfcs/RFC-0005-structured-kernel-definitions.md at rfc-0005 · pytorch/rfcs · GitHub](https://github.com/pytorch/rfcs/blob/rfc-0005/RFC-0005-structured-kernel-definitions.md)

---

<div class="post-metadata">

**Author:** ![tom](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/tom/32/26_2.png) [@tom](https://dev-discuss.pytorch.org/u/tom)\
**Post date:** [March 29, 2021, 9:28am UTC](https://dev-discuss.pytorch.org/t/slides-from-structured-kernel-presentation/179/2 "2021-03-29T09:28:50Z")

</div>

I love the structured kernel approach and the separation (and larger availability) of the meta information!

One question that is half-related here is the vision for backwards.

- Would we also use structured kernels for backwards? It’s in the future because I imagine a world where autodiff + JIT would be able to lower a generated backward to use inplace where it doesn’t need the intermediates.

- One step further might be to also have meta-information relating to the backward (will it be native or from derivatives, which outputs will have gradients etc.), but this is likely out of scope here.

Both of these may be far in the future but as an implementor, “yes” or “no” for using structured kernels for backward ops is a question that I have.

Best regards

Thomas

---

<div class="post-metadata">

**Author:** ![ezyang](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/ezyang/32/12_2.png) [@ezyang](https://dev-discuss.pytorch.org/u/ezyang)\
**Post date:** [March 31, 2021, 4:41pm UTC](https://dev-discuss.pytorch.org/t/slides-from-structured-kernel-presentation/179/3 "2021-03-31T16:41:17Z")

</div>

I think having backwards information available in some reusable form makes sense; for example, FX has a problem where they can’t actually differentiate graphs because the information is not available. However, derivatives sort of are in “better” shape, because they are already specified separately (derivatives.yaml), compared to shape checking which historically was interleaved with all kernels. It’s definitely worth pursuing though.

---

<div class="post-metadata">

**Author:** ![Stonepia](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/stonepia/32/70_2.png) [@Stonepia](https://dev-discuss.pytorch.org/u/Stonepia)\
**Post date:** [April 8, 2021, 3:02am UTC](https://dev-discuss.pytorch.org/t/slides-from-structured-kernel-presentation/179/4 "2021-04-08T03:02:33Z")

</div>

Is there an issue listing about current implementing status?  
I notice that it is under active development, but an issue listing TODO-ops would helpful.

---

<div class="post-metadata">

**Author:** ![ezyang](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/ezyang/32/12_2.png) [@ezyang](https://dev-discuss.pytorch.org/u/ezyang)\
**Post date:** [April 8, 2021, 3:38am UTC](https://dev-discuss.pytorch.org/t/slides-from-structured-kernel-presentation/179/5 "2021-04-08T03:38:44Z")

</div>

Lucky you, I made one recently: [Port kernels to be structured [tracker] · Issue #55070 · pytorch/pytorch · GitHub](https://github.com/pytorch/pytorch/issues/55070)
