Skip to content

Commit 3ada87f

Browse files
mcr229kirklandsign
authored andcommitted
Reset Dynamo Before Export for all XNNPACK Tests (#9561)
https://github.com/pytorch/executorch/actions/runs/14047575373/job/39331644423 There seems to be some CI issues with: ``` torch._dynamo.exc.FailOnRecompileLimitHit: recompile_limit reached with one_graph=True. Excessive recompilations can degrade performance due to the compilation overhead of each recompilation. To monitor recompilations, enable TORCH_LOGS=recompiles. If recompilations are expected, consider increasing ``` To help resolve this we reset dynamo at setup for all unittests. Let's see if this helps
1 parent 556f6dc commit 3ada87f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+182
-0
lines changed

backends/xnnpack/test/models/deeplab_v3.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def forward(self, *args):
2323

2424

2525
class TestDeepLabV3(unittest.TestCase):
26+
def setUp(self):
27+
torch._dynamo.reset()
28+
2629
dl3 = DL3Wrapper()
2730
dl3 = dl3.eval()
2831
model_inputs = (torch.randn(1, 3, 224, 224),)

backends/xnnpack/test/models/edsr.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515

1616
class TestEDSR(unittest.TestCase):
17+
def setUp(self):
18+
torch._dynamo.reset()
19+
1720
edsr = edsr_r16f64(2, False).eval() # noqa
1821
model_inputs = (torch.randn(1, 3, 224, 224),)
1922

backends/xnnpack/test/models/emformer_rnnt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414

1515
class TestEmformerModel(unittest.TestCase):
16+
def setUp(self):
17+
torch._dynamo.reset()
18+
1619
class EmformerRnnt(torch.nn.Module):
1720
def __init__(self):
1821
super().__init__()

backends/xnnpack/test/models/inception_v3.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414

1515
class TestInceptionV3(unittest.TestCase):
16+
def setUp(self):
17+
torch._dynamo.reset()
18+
1619
ic3 = models.inception_v3(weights="IMAGENET1K_V1").eval() # noqa
1720
model_inputs = (torch.randn(1, 3, 224, 224),)
1821

backends/xnnpack/test/models/inception_v4.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313

1414
class TestInceptionV4(unittest.TestCase):
15+
def setUp(self):
16+
torch._dynamo.reset()
17+
1518
ic4 = inception_v4(pretrained=False).eval()
1619
model_inputs = (torch.randn(3, 299, 299).unsqueeze(0),)
1720

backends/xnnpack/test/models/llama2_et_example.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414

1515
class TestLlama2ETExample(unittest.TestCase):
16+
def setUp(self):
17+
torch._dynamo.reset()
18+
1619
def test_f32(self):
1720
self._test()
1821

backends/xnnpack/test/models/mobilebert.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313

1414
class TestMobilebert(unittest.TestCase):
15+
def setUp(self):
16+
torch._dynamo.reset()
17+
1518
# pyre-ignore
1619
mobilebert = MobileBertModel(MobileBertConfig()).eval()
1720
example_inputs = (torch.tensor([[101, 7592, 1010, 2026, 3899, 2003, 10140, 102]]),)

backends/xnnpack/test/models/mobilenet_v2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515

1616
class TestMobileNetV2(unittest.TestCase):
17+
def setUp(self):
18+
torch._dynamo.reset()
19+
1720
mv2 = models.mobilenetv2.mobilenet_v2(weights=MobileNet_V2_Weights)
1821
mv2 = mv2.eval()
1922
model_inputs = (torch.randn(1, 3, 224, 224),)

backends/xnnpack/test/models/mobilenet_v3.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414

1515
class TestMobileNetV3(unittest.TestCase):
16+
def setUp(self):
17+
torch._dynamo.reset()
18+
1619
mv3 = models.mobilenetv3.mobilenet_v3_small(pretrained=True)
1720
mv3 = mv3.eval()
1821
model_inputs = (torch.randn(1, 3, 224, 224),)

backends/xnnpack/test/models/resnet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414

1515
class TestResNet18(unittest.TestCase):
16+
def setUp(self):
17+
torch._dynamo.reset()
18+
1619
inputs = (torch.randn(1, 3, 224, 224),)
1720
dynamic_shapes = (
1821
{

0 commit comments

Comments
 (0)