Revert "[dynamo][guards] De-dupe DUPLICATE_INPUT guard (#134354)"

This reverts commit cdb9df5efe78142b7a612ae9c938ddf8a8850d10.

Reverted https://github.com/pytorch/pytorch/pull/134354 on behalf of https://github.com/ZainRizvi due to Fails internal tests ([comment](https://github.com/pytorch/pytorch/pull/134272#issuecomment-2310649115))
This commit is contained in:
PyTorch MergeBot
2024-08-26 16:57:53 +00:00
parent a6fac0e969
commit e94bdc7876

View File

@ -575,8 +575,6 @@ class GuardBuilder(GuardBuilderBase):
str, torch._C._dynamo.guards.GuardManager
] = {}
self._cached_duplicate_input_guards: Set[Tuple[str, str]] = set()
def guard_on_dict_keys_and_ignore_order(self, example_value, guard):
dict_mgr = self.get_guard_manager(guard)
if isinstance(dict_mgr, DictGuardManager):
@ -1665,13 +1663,6 @@ class GuardBuilder(GuardBuilderBase):
self._set_guard_export_info(guard, code)
if config.enable_cpp_guard_manager:
# Check that the guard has not been inserted already
key = (ref_a, ref_b)
if key in self._cached_duplicate_input_guards:
return
self._cached_duplicate_input_guards.add((ref_a, ref_b))
self._cached_duplicate_input_guards.add((ref_b, ref_a))
install_object_aliasing_guard(
self.get_guard_manager(guard),
self.get_guard_manager_from_source(source_b),