[dynamo] Add GUARD_VALUE_DISPATCH table for guard evaluation#176033
[dynamo] Add GUARD_VALUE_DISPATCH table for guard evaluation#176033anijain2305 wants to merge 34 commits intogh/anijain2305/1037/basefrom
Conversation
Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/176033
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (5 Unrelated Failures)As of commit fc5aedd with merge base b633f26 ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
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 is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
…luation" Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
…luation" Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
…luation" Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
torch/_dynamo/guards.py
Outdated
| time using a fresh value and the previously saved info. | ||
| """ | ||
|
|
||
| extract: Any |
There was a problem hiding this comment.
replace extract with extract_fn
torch/_dynamo/guards.py
Outdated
| """ | ||
|
|
||
| extract: Any | ||
| check: Any |
There was a problem hiding this comment.
replace check with eval_fn
torch/_dynamo/guards.py
Outdated
There was a problem hiding this comment.
There is code duplication here with extract_opaque_obj.
This pattern is also common with DTensor guards, can you reuse the helper even inside the guard methods.
torch/_dynamo/guards.py
Outdated
| guard.create_fn.keywords["attr"], | ||
| hasattr(value, guard.create_fn.keywords["attr"]), | ||
| ), | ||
| check=lambda value, expected: hasattr(value, expected[0]) == expected[1], |
There was a problem hiding this comment.
maybe expected should be renamed metadata - expected[0], expected[1] sound confusing
torch/_dynamo/guards.py
Outdated
| guard.user_stack, | ||
| ) | ||
|
|
||
| @skip_guard_check_spec |
There was a problem hiding this comment.
Add a comment why its ok to skip here
There was a problem hiding this comment.
I am not convinced with the comment - but the right thing here is to use unsupported_guard_check_spec with the comment that we dont expect DICT_VERSION guard - even if it exists, it will fail for the second source. So, for now, lets use unsupported_guard_check_spec
…luation" Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
…luation" Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
…luation" Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
…luation" Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx kadeng chauhang amjames Lucaskabela jataylo [ghstack-poisoned]
|
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
This PR needs a
|
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. ghstack-source-id: bc16897 Pull Request resolved: pytorch/pytorch#176033
Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. ghstack-source-id: 6c2006a Pull Request resolved: pytorch/pytorch#176033
Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. ghstack-source-id: 44a49cf Pull Request resolved: pytorch/pytorch#176033
Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. ghstack-source-id: 9583a4e Pull Request resolved: pytorch/pytorch#176033
Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. ghstack-source-id: d2bd0d9 Pull Request resolved: pytorch/pytorch#176033
Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. ghstack-source-id: d82dd9c Pull Request resolved: pytorch/pytorch#176033
Add a dispatch table that maps guard type names to extract/check handler pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup time without duplicating per-guard-type logic in parallel if/elif chains. ghstack-source-id: 93fbee0 Pull Request resolved: pytorch/pytorch#176033
Stack from ghstack (oldest at bottom):
Add a dispatch table that maps guard type names to extract/check handler
pairs. This lets invoke_subgraph_cache evaluate guards at cache-lookup
time without duplicating per-guard-type logic in parallel if/elif chains.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @Lucaskabela @jataylo