From 42ab61241edd244051d8e4a1a9f8ccfaa095caca Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 25 Nov 2024 12:15:31 -0800 Subject: [PATCH] Add README for torch._inductor.runtime (#141492) Signed-off-by: Edward Z. Yang Pull Request resolved: https://github.com/pytorch/pytorch/pull/141492 Approved by: https://github.com/jansel ghstack dependencies: #141491 --- torch/_inductor/runtime/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 torch/_inductor/runtime/README.md diff --git a/torch/_inductor/runtime/README.md b/torch/_inductor/runtime/README.md new file mode 100644 index 00000000000000..3a52d7561e0789 --- /dev/null +++ b/torch/_inductor/runtime/README.md @@ -0,0 +1,18 @@ +# `torch._inductor.runtime` + +This folder contains code needed at runtime by the output code of +Inductor. The output code of Inductor will import `torch` and +`torch._inductor.runtime`, but should not import from other files in +`torch._inductor.*`. Note that this code includes code that is +needed to actually perform Triton compilation, but is not needed +in the actual, final runtime execution of kernels. + +Runtime includes Triton/C++ generated code, which are compiled (sometimes in +parallel) when the output code of Inductor is imported. It also includes +the autotuning code and heuristics to decide block sizes of generated code. + +One of the original motivations for this directory split was so that the Triton +compile subprocesses could access Triton and our compiler support code while +mocking out most of `torch`, which can take seconds to import (sometimes more +than a Triton compile itself). An abandoned prototype of this can be found +[here](https://github.com/pytorch/pytorch/pull/124682/files).