# Understanding torch.compile()

**URL:** <https://discuss.pytorch.org/t/understanding-torch-compile/224829>\
**Category:** torch.compile\
**Created:** [April 20, 2026, 1:01am UTC](https://discuss.pytorch.org/t/understanding-torch-compile/224829 "2026-04-20T01:01:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emerth](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/emerth/32/75379_2.png) [@emerth](https://discuss.pytorch.org/u/emerth)\
**Post date:** [April 20, 2026, 1:01am UTC](https://discuss.pytorch.org/t/understanding-torch-compile/224829/1 "2026-04-20T01:01:23Z")

</div>

Hello,

Does Torch.compile() generate kernels at the Python level (quite abstract), at the C++ level (close to the metal), or using “assembly language” the current device uses (really close to the metal)?

Thanks!

---

<div class="post-metadata">

**Author:** ![mjoux](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@mjoux](https://discuss.pytorch.org/u/mjoux)\
**Post date:** [April 20, 2026, 10:07am UTC](https://discuss.pytorch.org/t/understanding-torch-compile/224829/2 "2026-04-20T10:07:13Z")

</div>

torch.compile generally stays at python level, and usually emits OpenAI triton code for kernels, which then ultimately lowers to assembly (e.g. CUDA PTX for cuda kernels).

---

<div class="post-metadata">

**Author:** ![emerth](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/emerth/32/75379_2.png) [@emerth](https://discuss.pytorch.org/u/emerth)\
**Post date:** [April 20, 2026, 5:13pm UTC](https://discuss.pytorch.org/t/understanding-torch-compile/224829/3 "2026-04-20T17:13:36Z")

</div>

Thanks, Matt. That helps!
