From 0a6a1e37a918906be1007c0ec1900153935a8b9d Mon Sep 17 00:00:00 2001 From: Umesh Chand Date: Wed, 20 May 2026 15:31:04 -0700 Subject: [PATCH] =?UTF-8?q?[Inductor]=20Fix=20flaky=20epilogue=20fusion=20?= =?UTF-8?q?tests=20by=20adding=20missing=20tearDown=E2=80=A6=20(#3244)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …Class (#180736) TestPrologueFusion and TestEpilogueFusionStaticAnalysis both use ExitStack in setUpClass to apply config.patch(), but neither defined tearDownClass to close the stack. When TestPrologueFusion runs before TestEpilogueFusionStaticAnalysis in the same process, config values like max_autotune_gemm_backends="TRITON" leak through, removing the aten kernel choice from autotuning and causing test failures. Fixes #179693 Pull Request resolved: https://github.com/pytorch/pytorch/pull/180736 Approved by: https://github.com/Skylion007 ## Motivation ## Technical Details ## Test Plan ## Test Result ## Submission Checklist - [ ] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. Co-authored-by: NikhilAPatel --- test/inductor/test_max_autotune.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/inductor/test_max_autotune.py b/test/inductor/test_max_autotune.py index d94dd81b4673a..5d3855aa73e93 100644 --- a/test/inductor/test_max_autotune.py +++ b/test/inductor/test_max_autotune.py @@ -3450,6 +3450,11 @@ def setUpClass(cls): ) ) + @classmethod + def tearDownClass(cls): + cls._stack.close() + super().tearDownClass() + def check_code(self, code_str, num_kernels, num_allocs, num_deallocs): FileCheck().check(get_func_call()).check_count( get_kernel_launch(), @@ -3943,6 +3948,11 @@ def setUpClass(cls): ) ) + @classmethod + def tearDownClass(cls): + cls._stack.close() + super().tearDownClass() + @contextlib.contextmanager def get_common_patches(self, async_compile: bool, persistent_tma: bool): common_patches = (