[Dynamo] Fix the unimplemented_v2 of EventVariable.call_method in ctx_manager.py (#151208)

Changes:
- Field of `explanations` shoule be `str` instead of `tuple`
- Not only `torch.cuda.Event`, but alse `torch.xpu.Event` can trigger this message.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/151208
Approved by: https://github.com/Skylion007
This commit is contained in:
FFFrog 2025-04-14 19:39:42 +08:00 committed by PyTorch MergeBot
parent 9e20a8411b
commit a2f7764507

View File

@ -1341,13 +1341,14 @@ class EventVariable(VariableTracker):
),
)
else:
method_name = (
f"{type(self.value).__module__}.{type(self.value).__qualname__}.{name}"
)
unimplemented_v2(
gb_type="Unsupported torch.cuda.Event method",
gb_type=f"Unsupported {method_name} method",
context=str(name),
explanation=(
f"Dynamo doesn't support tracing the torch.cuda.Event.{name} method. "
f"We currently support wait, record, synchronize, and query.",
),
explanation=f"Dynamo doesn't support tracing the {method_name} method. "
f"We currently support wait, record, synchronize, and query.",
hints=[
*graph_break_hints.SUPPORTABLE,
],