Add function for retrieving fallback operations.#7116
Merged
Conversation
JackCaoG
reviewed
May 28, 2024
| return torch_xla._XLAC._short_xla_metrics_report(counter_names, metric_names) | ||
|
|
||
|
|
||
| def executed_fallback_ops(): |
Collaborator
There was a problem hiding this comment.
cc @alanwaketan we can start using this new api which is better than do a string assertIn from the metrics_report,
JackCaoG
reviewed
May 28, 2024
| # Run torchvision operations as fallback. | ||
| import torchvision | ||
| scores = torch.rand(N).to(xm.xla_device()) | ||
| # NMS doesn't have a PyTorch/XLA implementation without dynamic shapes. |
Collaborator
There was a problem hiding this comment.
maybe do an assert that dynamic shape is not enabled?
JackCaoG
approved these changes
May 28, 2024
a70a8f2 to
5f985b3
Compare
yitongh
pushed a commit
to AlibabaPAI/xla
that referenced
this pull request
Oct 11, 2024
yitongh
pushed a commit
to AlibabaPAI/xla
that referenced
this pull request
Dec 11, 2024
yitongh
pushed a commit
to AlibabaPAI/xla
that referenced
this pull request
Dec 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces
GetFallbackOperationsfunction, which sweeps through the fallback counter map_cpu_fallback_countersand returns the name of the functions whose counter is not zero, i.e. name of the fallbacks that were run.There was a bug within the dynamo bridge that only classified as fallback operation those that came from the
atennamespace. Other fallback operations, such as those that came fromtorchvision::were being passed on to the next steps, even though they were fallback operations.This bug is one of the reasons of the issue #5967.
cc @miladm @JackCaoG