mirror of https://github.com/llvm/torch-mlir
python: add `CHECK-LABEL` statements to localize checks (#1363)
It seems as though an upstream change in PyTorch has caused the module dump to include not just the module being tested, but also several seemingly unrelated functions in the `torch._decom.decompositions` namespace. The presence of these new functions caused lit to match variables against incorrect statements (i.e. statements in the unrelated functions instead of the module under test). This patch inserts `CHECK-LABEL` statements in the failing tests so that lit ignores these unrelated functions and only checks the statements at or after the test module definition.pull/1359/head
parent
1c8b389ead
commit
a9e1014fc7
|
@ -18,6 +18,7 @@ mb = ModuleBuilder()
|
||||||
# `torch.Tensor` is just a pointer to a TensorImpl under the hood, and so
|
# `torch.Tensor` is just a pointer to a TensorImpl under the hood, and so
|
||||||
# naively duplicating a Tensor retains the identity of the TensorImpl.
|
# naively duplicating a Tensor retains the identity of the TensorImpl.
|
||||||
|
|
||||||
|
# CHECK-LABEL: torch.class_type @__torch__.TestModule {
|
||||||
class TestModule(torch.nn.Module):
|
class TestModule(torch.nn.Module):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
|
@ -12,6 +12,7 @@ from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
||||||
|
|
||||||
mb = ModuleBuilder()
|
mb = ModuleBuilder()
|
||||||
|
|
||||||
|
# CHECK-LABEL: torch.class_type @__torch__.TestModule {
|
||||||
class TestModule(torch.nn.Module):
|
class TestModule(torch.nn.Module):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
|
@ -22,6 +22,7 @@ class TestModule(torch.nn.Module):
|
||||||
self.s0 = Submodule(0)
|
self.s0 = Submodule(0)
|
||||||
self.s1 = Submodule(1)
|
self.s1 = Submodule(1)
|
||||||
|
|
||||||
|
# CHECK-LABEL: torch.class_type @__torch__.TestModule {
|
||||||
# CHECK: %[[T:.*]] = torch.constant.bool true
|
# CHECK: %[[T:.*]] = torch.constant.bool true
|
||||||
|
|
||||||
# CHECK: %[[N0:.*]] = torch.constant.int 0
|
# CHECK: %[[N0:.*]] = torch.constant.int 0
|
||||||
|
|
Loading…
Reference in New Issue