[MPSInductor][EZ] Fix logical_[or|end] ops (#144122)

For boolean operands it does not really matter whether `&` or `&&` is
used, but if one ever to rely on operator precedence, then bitwise ops
should have higher precendence than logical ones

Pull Request resolved: https://github.com/pytorch/pytorch/pull/144122
Approved by: https://github.com/huydhn
ghstack dependencies: #144055, #144051
This commit is contained in:
Nikita Shulga
2025-01-03 07:24:34 -08:00
committed by PyTorch MergeBot
parent b336d72dae
commit f7644efa79

View File

@ -75,11 +75,11 @@ class MetalOverrides(OpOverrides):
@staticmethod
def logical_or(a: CSEVariable, b: CSEVariable) -> str:
return f"{a} | {b}"
return f"{a} || {b}"
@staticmethod
def logical_and(a: CSEVariable, b: CSEVariable) -> str:
return f"{a} & {b}"
return f"{a} && {b}"
@staticmethod
def abs(x: CSEVariable) -> str: