CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Add README for torch._inductor.runtime #141492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
đź”— Helpful Linksđź§Ş See artifacts and rendered test results at hud.pytorch.org/pr/141492
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit 35e86f1 with merge base 4c1f50a ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torch/_inductor/runtime/README.md
Outdated
There's not really a coherent concept for this folder; in general it contains | ||
code for: | ||
|
||
1. Out-of-process Triton compilation (e.g., when doing multiprocess parallel | ||
Triton compile) | ||
|
||
2. Code that is accessed by the code we generated in Inductor codegen (the | ||
"runtime", although not really a true runtime because we don't actually run | ||
this code when running, it's what the Triton compilation uses). | ||
|
||
It isn't really a true runtime (aka, code that needs to be invoked when | ||
actually running Inductor compiled kernels). | ||
|
||
One of the original motivations for this directory split was so that the | ||
subprocesses could access Triton and our compiler support code without having | ||
to import torch. However, we never actually go this to work, so there are | ||
still plenty of torch imports in this folder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's not really a coherent concept for this folder; in general it contains | |
code for: | |
1. Out-of-process Triton compilation (e.g., when doing multiprocess parallel | |
Triton compile) | |
2. Code that is accessed by the code we generated in Inductor codegen (the | |
"runtime", although not really a true runtime because we don't actually run | |
this code when running, it's what the Triton compilation uses). | |
It isn't really a true runtime (aka, code that needs to be invoked when | |
actually running Inductor compiled kernels). | |
One of the original motivations for this directory split was so that the | |
subprocesses could access Triton and our compiler support code without having | |
to import torch. However, we never actually go this to work, so there are | |
still plenty of torch imports in this folder. | |
This folder contains code needed at runtime by the output code of TorchInductor. The output code of TorchInductor will import `torch` and `torch._inductor.runtime`, but should not import from other files in `torch._inductor.*`. | |
Runtime includes Triton/C++ compiles, which are compiled (sometimes in parallel) when the output code of TorchInductor 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). |
-
This directory does contain the code needed to run Inductor compiled kernels/code. In that sense I think it is a true runtime and I think this directory structure makes sense even without the MockTorch stuff landing.
-
Not importing
torch
is not a requirement of the prototype in [inductor] Add thread+subproc-based worker_start_method #124682 --triton
imports torch, so that requirement is clearly not attainable. Instead, the prototype mocks out torch by doing:
sys.modules["torch"] = MockTorch()
with some trickery to allow only files inside torch
to be imported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took this suggestion and reworded a little bit of it
@pytorchbot merge -f "unrelated failures" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Do code review with whitespace changes off. Check comments for what I changed. Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: #141574 Approved by: https://github.com/bobrenjc93, https://github.com/jansel ghstack dependencies: #141491, #141492
Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: #141654 Approved by: https://github.com/aorenste, https://github.com/jansel ghstack dependencies: #141491, #141492, #141574
Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: pytorch#141492 Approved by: https://github.com/jansel ghstack dependencies: pytorch#141491
Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: pytorch#141492 Approved by: https://github.com/jansel ghstack dependencies: pytorch#141491
Do code review with whitespace changes off. Check comments for what I changed. Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: pytorch#141574 Approved by: https://github.com/bobrenjc93, https://github.com/jansel ghstack dependencies: pytorch#141491, pytorch#141492
Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: pytorch#141654 Approved by: https://github.com/aorenste, https://github.com/jansel ghstack dependencies: pytorch#141491, pytorch#141492, pytorch#141574
Stack from ghstack (oldest at bottom):
Signed-off-by: Edward Z. Yang ezyang@meta.com
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang @aakhundov