-
Notifications
You must be signed in to change notification settings - Fork 486
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
Add function for retrieving fallback operations. #7116
Conversation
@@ -79,3 +79,8 @@ def short_metrics_report(counter_names: list = None, metric_names: list = None): | |||
'TransferToDeviceTime', 'TransferFromDeviceTime' | |||
] | |||
return torch_xla._XLAC._short_xla_metrics_report(counter_names, metric_names) | |||
|
|||
|
|||
def executed_fallback_ops(): |
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.
cc @alanwaketan we can start using this new api which is better than do a string assertIn from the metrics_report,
test/test_metrics.py
Outdated
# 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. |
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.
maybe do an assert that dynamic shape is not enabled?
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.
Cool. LGTM.
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.
Cool. LGTM.
a70a8f2
to
5f985b3
Compare
This PR introduces
GetFallbackOperations
function, which sweeps through the fallback counter map_cpu_fallback_counters
and 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
aten
namespace. 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