[inductor] Move cpp wrapper dynamic shapes test to test_cpp_wrapper (#102017)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102017
Approved by: https://github.com/ngimel, https://github.com/jansel
diff --git a/test/inductor/test_cpp_wrapper.py b/test/inductor/test_cpp_wrapper.py
index e85e220..7289da9 100644
--- a/test/inductor/test_cpp_wrapper.py
+++ b/test/inductor/test_cpp_wrapper.py
@@ -16,11 +16,17 @@
try:
try:
- from . import test_cpu_repro, test_mkldnn_pattern_matcher, test_torchinductor
+ from . import (
+ test_cpu_repro,
+ test_mkldnn_pattern_matcher,
+ test_torchinductor,
+ test_torchinductor_dynamic_shapes,
+ )
except ImportError:
import test_cpu_repro
import test_mkldnn_pattern_matcher
import test_torchinductor
+ import test_torchinductor_dynamic_shapes
except unittest.SkipTest:
if __name__ == "__main__":
sys.exit(0)
@@ -43,10 +49,18 @@
device = "cpu"
+class DynamicShapesCppWrapperCpuTests(TorchTestCase):
+ device = "cpu"
+
+
class TestCudaWrapper(TorchTestCase):
device = "cuda"
+class DynamicShapesCudaWrapperCudaTests(TorchTestCase):
+ device = "cuda"
+
+
def make_test_case(name, device, tests, condition=True):
test_name = f"{name}_{device}" if device else name
@@ -115,6 +129,16 @@
test_torchinductor.copy_tests(CppWrapperTemplate, TestCppWrapper, "cpp_wrapper")
+ DynamicShapesCppWrapperTemplate = (
+ test_torchinductor_dynamic_shapes.make_dynamic_cls(CppWrapperTemplate)
+ )
+
+ test_torchinductor.copy_tests(
+ DynamicShapesCppWrapperTemplate,
+ DynamicShapesCppWrapperCpuTests,
+ "cpp_wrapper",
+ )
+
if RUN_CUDA:
class BaseTest(NamedTuple):
@@ -151,6 +175,18 @@
test_torchinductor.copy_tests(CudaWrapperTemplate, TestCudaWrapper, "cuda_wrapper")
+ """
+ # To be enabled
+ DynamicShapesCudaWrapperTemplate = (
+ test_torchinductor_dynamic_shapes.make_dynamic_cls(CudaWrapperTemplate)
+ )
+
+ test_torchinductor.copy_tests(
+ DynamicShapesCudaWrapperTemplate,
+ DynamicShapesCudaWrapperCudaTests,
+ "cuda_wrapper",
+ )
+ """
if __name__ == "__main__":
from torch._dynamo.test_case import run_tests
diff --git a/test/inductor/test_torchinductor_dynamic_shapes.py b/test/inductor/test_torchinductor_dynamic_shapes.py
index a0cc5bf..5302ade 100644
--- a/test/inductor/test_torchinductor_dynamic_shapes.py
+++ b/test/inductor/test_torchinductor_dynamic_shapes.py
@@ -33,7 +33,6 @@
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
-from inductor.test_cpp_wrapper import CppWrapperTemplate
from inductor.test_torchinductor import (
check_model,
check_model_cuda,
@@ -76,7 +75,6 @@
DynamicShapesCommonTemplate = make_dynamic_cls(CommonTemplate)
-DynamicShapesCppWrapperTemplate = make_dynamic_cls(CppWrapperTemplate)
if HAS_CPU:
@@ -85,15 +83,7 @@
common = check_model
device = "cpu"
- class DynamicShapesCppWrapperCpuTests(TestCase):
- device = "cpu"
-
copy_tests(DynamicShapesCommonTemplate, DynamicShapesCpuTests, "cpu", test_failures)
- copy_tests(
- DynamicShapesCppWrapperTemplate,
- DynamicShapesCppWrapperCpuTests,
- "cpp_wrapper",
- )
if HAS_CUDA and not TEST_WITH_ASAN: