From 795479a88d8b5d5e244f59f94b4585b08c677dc0 Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Fri, 15 Jul 2022 22:40:22 +0000 Subject: [PATCH] Remove HasValueSemantics from `is` ops. --- include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td | 2 -- .../dialects/torch/importer/jit_ir/build_tools/registry.py | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td b/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td index 0f56c1bc1..4a1f98768 100644 --- a/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td +++ b/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td @@ -7596,7 +7596,6 @@ def Torch_AtenNeBoolOp : Torch_Op<"aten.ne.bool", [ def Torch_Aten__Is__Op : Torch_Op<"aten.__is__", [ AllowsTypeRefinement, - HasValueSemantics, ReadOnly ]> { let summary = "Generated op for `aten::__is__ : (t1, t2) -> (bool)`"; @@ -7621,7 +7620,6 @@ def Torch_Aten__Is__Op : Torch_Op<"aten.__is__", [ def Torch_Aten__Isnot__Op : Torch_Op<"aten.__isnot__", [ AllowsTypeRefinement, - HasValueSemantics, ReadOnly ]> { let summary = "Generated op for `aten::__isnot__ : (t1, t2) -> (bool)`"; diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py b/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py index 7d2568e58..00799de1e 100644 --- a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py +++ b/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py @@ -251,6 +251,11 @@ class JitOperator: # but the alias annotation is empty. if self.unique_key == "prim::unchecked_cast : (t) -> (t)": return False + # The `is` operator compares object identity, so it does not have + # value semantics. + if self.unique_key in ("aten::__is__ : (t1, t2) -> (bool)", + "aten::__isnot__ : (t1, t2) -> (bool)"): + return False return True def is_readonly(self):