Separate provenance tracking to different levels#160383
Separate provenance tracking to different levels#160383yushangdi wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/160383
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit adc0047 with merge base 211c988 ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D80031559 |
21e5e13 to
ea96543
Compare
Summary: as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In thi PR, we turn on part of the provenance tracking that doesn't have too much overhead by default. Test Plan: CI Rollback Plan: Differential Revision: D80031559
|
This pull request was exported from Phabricator. Differential Revision: D80031559 |
ea96543 to
499c47a
Compare
Summary: as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In thi PR, we turn on part of the provenance tracking that doesn't have too much overhead by default. Test Plan: CI Rollback Plan: Differential Revision: D80031559
|
Thanks @yushangdi ! Is there potential latency regression by turning it on by default? can we study them? If so, I can also help study some production models latency implication. |
Summary: as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In thi PR, we turn on part of the provenance tracking that doesn't have too much overhead by default. Test Plan: CI Rollback Plan: Differential Revision: D80031559
499c47a to
7afa5be
Compare
Summary: as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In thi PR, we turn on part of the provenance tracking that doesn't have too much overhead by default. Test Plan: CI Rollback Plan: Differential Revision: D80031559
7afa5be to
55c4a3f
Compare
@kflu I don't expect any big latency regression, but it may increase a little. |
Summary: as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In thi PR, we turn on part of the provenance tracking that doesn't have too much overhead by default. Test Plan: CI Rollback Plan: Differential Revision: D80031559
55c4a3f to
c0d0305
Compare
|
@yushangdi has imported this pull request. If you are a Meta employee, you can view this in D80031559. |
torch/_inductor/config.py
Outdated
| # Save mapping info from inductor generated kernel to post_grad fx nodes to pre_grad fx nodes | ||
| # Will be changed to default to True | ||
| # TODO: remove this flag once it's running stable | ||
| basic_provenance_tracking = os.environ.get("INDUCTOR_PROVENANCE_BASIC", "0") == "1" |
There was a problem hiding this comment.
Instead of having a "basic", would it be more generic to define it as the "level" of provenance tracking? That way, we can re-use config provenance_tracking and the env vars INDUCTOR_PROVENANCE which is already an integer.
0: disabled
1: normal prvenance
2: basic
torch/_inductor/ir.py
Outdated
| if config.trace.provenance_tracking: | ||
|
|
||
| if config.trace.basic_provenance_tracking or config.trace.provenance_tracking: | ||
| for node in origins: |
There was a problem hiding this comment.
This code block also need to be exception handled I think
There was a problem hiding this comment.
I moved this code to be called lazily, so it's not in IR node initialization anymore. Currently it's only called when we want to print an IR node.
| ) | ||
| # Dump provenance artifacts for debugging trace | ||
| if config.trace.basic_provenance_tracking or config.trace.provenance_tracking: | ||
| trace_structured( |
There was a problem hiding this comment.
Is trace_structured exception safe?
There was a problem hiding this comment.
we use trace_structured everywhere for tlparse already, it's safe as long as the payload_fn function passed to it is safe.
| config.trace.basic_provenance_tracking | ||
| or config.trace.provenance_tracking | ||
| ): | ||
| provenance_tracking_json = ( |
There was a problem hiding this comment.
This code block needs to be exception free
There was a problem hiding this comment.
This block should be exception free already. I added exception check in get_graph_provenance_json and create_mapping_pre_post_grad_nodes
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- Change `provenance_tracking` config to `provenance_tracking_level`. This is defaults to 1 (normal) now, but will be defaults to 2 to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add exception swallowing for all functions above
Test Plan:
CI
Rollback Plan: cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Differential Revision: D80031559
Pulled By: yushangdi
c0d0305 to
4d38dd1
Compare
|
This pull request was exported from Phabricator. Differential Revision: D80031559 |
|
@kflu Would it be possible to also verify whether we can turn on "normal" mode by default in the lowering stack? |
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Differential Revision: D80031559
Pulled By: yushangdi
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Differential Revision: D80031559
Pulled By: yushangdi
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Differential Revision: D80031559
Pulled By: yushangdi
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Differential Revision: D80031559
Pulled By: yushangdi
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Differential Revision: D80031559
Pulled By: yushangdi
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Rollback Plan:
Differential Revision: D80139160
Pulled By: yushangdi
sure, once it's landed we can test both modes. |
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Differential Revision: D80031559
Pulled By: yushangdi
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Rollback Plan:
Differential Revision: D80139160
Pulled By: yushangdi
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Differential Revision: D80031559
Pulled By: yushangdi
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- add `basic_provenance_tracking` config. This is defaults to False now, but will be defaults to True to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan:
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Rollback Plan:
Differential Revision: D80139160
Pulled By: yushangdi
| # Backward compatibility: | ||
| # If TORCH_COMPILE_DEBUG=1, level is set to at least 1. | ||
| # If INDUCTOR_PROVENANCE is set, use its integer value. | ||
| provenance_tracking_level: int = int( |
There was a problem hiding this comment.
I think you can use something like, Literal[0, 1, 2] like this
There was a problem hiding this comment.
I'll add this change to my next PR!
Summary:
as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- Change `provenance_tracking` config to `provenance_tracking_level`. This is defaults to 1 (normal) now, but will be defaults to 2 to turn on basic provenance tracking
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add exception swallowing for all functions above
Pull Request resolved: pytorch#160383
Test Plan:
CI
Rollback Plan: cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben Lucaskabela
Reviewed By: angelayi
Differential Revision: D80031559
Pulled By: yushangdi
|
This pull request was exported from Phabricator. Differential Revision: D80031559 |
4d38dd1 to
adc0047
Compare
|
@pytorchbot merge -i (Initiating merge automatically since Phabricator Diff has merged, merging with -i because oss signals were bypassed internally) |
Merge startedYour change will be merged while ignoring the following 1 checks: pull / linux-jammy-py3.9-clang12 / build Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- Change `provenance_tracking` config to `provenance_tracking_level`
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Test Plan:
CI
Rollback Plan:
Differential Revision: D80031559
Pull Request resolved: pytorch#160383
Approved by: https://github.com/angelayi
Summary: as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- Change `provenance_tracking` config to `provenance_tracking_level`
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Test Plan:
CI
Rollback Plan:
Differential Revision: D80031559
Pull Request resolved: pytorch#160383
Approved by: https://github.com/angelayi
Summary: as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
- Change `provenance_tracking` config to `provenance_tracking_level`
- turn on the following provenance tracking by default when `basic_provenance_tracking`=True
- `set_kernel_post_grad_provenance_tracing` for kernels, this add mapping between triton kernels and post_grad nodes
- `dump_inductor_provenance_info` if we're dumping tlparse log
- `get_graph_provenance_json` and dump `reate_mapping_pre_post_grad_nodes`. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.
- add stack trace from post grad nodes to inductor IR nodes
- add exception swallowing for all functions above
Test Plan:
CI
Rollback Plan:
Differential Revision: D80031559
Pull Request resolved: pytorch#160383
Approved by: https://github.com/angelayi
Summary: as title. We've got request from various parties who are interested in turning on the provenance tracking by default. In this PR, we prepare to turn on part of the provenance tracking that doesn't have too much overhead by default.
provenance_trackingconfig toprovenance_tracking_levelbasic_provenance_tracking=Trueset_kernel_post_grad_provenance_tracingfor kernels, this add mapping between triton kernels and post_grad nodesdump_inductor_provenance_infoif we're dumping tlparse logget_graph_provenance_jsonand dumpreate_mapping_pre_post_grad_nodes. This creates mapping between pre_grad and post_grad nodes. Since we're not turning on the provenance tracking in GraphTransformObserver by default, the mapping here maybe incomplete/limited.Test Plan:
CI
Rollback Plan:
Differential Revision: D80031559
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @Lucaskabela