remove make_fast_binary_impl from make_fast_binary_impl (#156528)

This was added in https://github.com/pytorch/pytorch/pull/133584.
Take slow path when we cant determine fast path is valid.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/156528
Approved by: https://github.com/bobrenjc93
This commit is contained in:
Laith Sakka
2025-06-20 17:35:58 -07:00
committed by PyTorch MergeBot
parent eab45643f2
commit 35321b2ad6

View File

@ -962,7 +962,7 @@ def make_fast_binary_impl(
final_shape = infer_size(final_shape, shape)
assert final_shape is not None
from torch.fx.experimental.symbolic_shapes import guard_size_oblivious, sym_eq
from torch.fx.experimental.symbolic_shapes import guard_or_false, sym_eq
# Do some extra safety checks to see if the output
# stride is obvious
@ -970,10 +970,12 @@ def make_fast_binary_impl(
if (
isinstance(op, torch.Tensor)
and len(op.shape) == len(final_shape)
and guard_size_oblivious(sym_eq(op.shape, final_shape))
# take the slow path if result is not determined.
and guard_or_false(sym_eq(op.shape, final_shape))
):
break
else:
# if we never break in the for loop above we take the slow path.
return slow("both tensors nontrivially broadcast")
# compute_types