8000 Windows Dynamo Error Removal CI Check by gs-olive · Pull Request #115969 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Windows Dynamo Error Removal CI Check #115969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/export/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
parametrize,
run_tests,
TestCase,
IS_WINDOWS
)


@unittest.skipIf(IS_WINDOWS, "Windows not supported for this test")
@unittest.skipIf(not torchdynamo.is_dynamo_supported(), "dynamo doesn't support")
class ExampleTests(TestCase):
# TODO Maybe we should make this tests actually show up in a file?
Expand Down
2 changes: 1 addition & 1 deletion test/export/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def branch_on_shape(x: torch.Tensor):
# Being able to export means shape is preserved as static
export(WrapperModule(branch_on_shape), inp)


@unittest.skipIf(IS_WINDOWS, "Windows isn't supported for this case")
@unittest.skipIf(not torchdynamo.is_dynamo_supported(), "dynamo isn't support")
class TestExport(TestCase):
def _test_export_same_as_eager(self, f, args, kwargs=None):
Expand Down
3 changes: 2 additions & 1 deletion test/export/test_pass_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from torch._export.pass_base import _ExportPassBaseDeprecatedDoNotUse
from torch.export import export
from torch.fx.passes.infra.pass_base import PassResult
from torch.testing._internal.common_utils import run_tests, TestCase
from torch.testing._internal.common_utils import run_tests, TestCase, IS_WINDOWS


@unittest.skipIf(not is_dynamo_supported(), "Dynamo not supported")
Expand Down Expand Up @@ -41,6 +41,7 @@ class NullPass(_ExportPassBaseDeprecatedDoNotUse):
self.assertEqual(new_node.op, old_node.op)
self.assertEqual(new_node.target, old_node.target)

@unittest.skipIf(IS_WINDOWS, "Windows not supported")
def test_cond(self) -> None:
class M(torch.nn.Module):
def __init__(self):
Expand Down
3 changes: 2 additions & 1 deletion test/export/test_passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from torch.fx.passes.infra.partitioner import Partition
from torch.fx.passes.operator_support import OperatorSupport
from torch.testing import FileCheck
from torch.testing._internal.common_utils import run_tests, TestCase, skipIfTorchDynamo
from torch.testing._internal.common_utils import run_tests, TestCase, skipIfTorchDynamo, IS_WINDOWS
from torch.utils import _pytree as pytree


Expand Down Expand Up @@ -276,6 +276,7 @@ def forward(self, x):
new_inp = torch.tensor([1, 1, 1, 1])
self.assertEqual(mod(new_inp), ep.module()(new_inp))

@unittest.skipIf(IS_WINDOWS, "Windows not supported")
def test_runtime_assert_inline_constraints_for_cond(self) -> None:
class M(torch.nn.Module):
def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion test/export/test_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def forward(self, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
g.nodes[1].inputs[0].arg.as_tensor.name
)


@unittest.skipIf(IS_WINDOWS, "Windows not supported for this test")
@unittest.skipIf(not torchdynamo.is_dynamo_supported(), "dynamo doesn't support")
class TestDeserialize(TestCase):
def check_graph(self, fn, inputs, dynamic_shapes=None, _check_meta=True) -> None:
Expand Down
1 change: 1 addition & 0 deletions test/export/test_unflatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def forward(self, x):
id(getattr(unflattened_module.sub_net, "2")),
)

@unittest.skipIf(IS_WINDOWS, "Windows not supported for this test")
@skipIfTorchDynamo("Non strict mode is not meant to run with dynamo")
def test_unflatten_preserve_signature(self):
class NestedChild(torch.nn.Module):
Expand Down
2 changes: 2 additions & 0 deletions test/export/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from torch.testing._internal.common_utils import (
run_tests,
TestCase,
IS_WINDOWS,
)

TEST_UPGRADERS = {
Expand Down Expand Up @@ -115,6 +116,7 @@ def forward(self, a: torch.Tensor, b):
custom_op_count = count_op(upgraded.graph, "aten::div__Scalar_mode_0_3")
self.assertEqual(custom_op_count, 1)

@unittest.skipIf(IS_WINDOWS, "Test case not supported on Windows")
def test_div_upgrader_pass_return_new_op_after_retrace(self):
class Foo(torch.nn.Module):
def forward(self, a: torch.Tensor, b):
Expand Down
4 changes: 3 additions & 1 deletion test/export/test_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from torch._export.verifier import SpecViolationError, Verifier
from torch.export.exported_program import InputKind, InputSpec, TensorArgument
from torch.testing._internal.common_utils import run_tests, TestCase
from torch.testing._internal.common_utils import run_tests, TestCase, IS_WINDOWS

@unittest.skipIf(not is_dynamo_supported(), "dynamo isn't supported")
class TestVerifier(TestCase):
Expand Down Expand Up @@ -56,6 +56,7 @@ def forward(self, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
with self.assertRaises(SpecViolationError):
verifier.check(ep)

@unittest.skipIf(IS_WINDOWS, "Windows not supported for this test")
def test_verifier_higher_order(self) -> None:
class Foo(torch.nn.Module):
def forward(self, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
Expand All @@ -76,6 +77,7 @@ def false_fn(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
verifier = Verifier()
verifier.check(ep)

@unittest.skipIf(IS_WINDOWS, "Windows not supported for this test")
def test_verifier_nested_invalid_module(self) -> None:
class Foo(torch.nn.Module):
def forward(self, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
Expand Down
2 changes: 2 additions & 0 deletions test/functorch/test_aotdispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
run_tests,
IS_ARM64,
IS_MACOS,
IS_WINDOWS,
IS_X86,
compare_equal_outs_and_grads,
outs_and_grads,
Expand Down Expand Up @@ -3261,6 +3262,7 @@ def fn(p, x):
):
aot_export_module(mod, [inp], trace_joint=True, output_loss_index=1)

@unittest.skipIf(IS_WINDOWS, "Windows isn't supported for this case")
@unittest.skipIf(not torch._dynamo.is_dynamo_supported(), "Cond needs dynamo to run")
def test_aot_export_with_torch_cond(self):
class M(torch.nn.Module):
Expand Down
5 changes: 3 additions & 2 deletions test/functorch/test_control_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from functorch.experimental.control_flow import UnsupportedAliasMutationException, cond
from torch._higher_order_ops.while_loop import while_loop
from torch.fx.experimental.proxy_tensor import make_fx
from torch.testing._internal.common_utils import run_tests, TestCase
from torch.testing._internal.common_utils import run_tests, TestCase, IS_WINDOWS
from torch.testing._internal.common_quantization import skipIfNoDynamoSupport
from torch._subclasses.functional_tensor import FunctionalTensor, CppFunctionalizeAPI, PythonFunctionalizeAPI, FunctionalTensorMode

Expand Down Expand Up @@ -130,7 +130,7 @@ def forward(self, *operands):
return self._reduce(*operands)



@unittest.skipIf(IS_WINDOWS, "Windows not supported for this test")
@skipIfNoDynamoSupport
class TestControlFlow(TestCase):
def setUp(self):
Expand Down Expand Up @@ -316,6 +316,7 @@ def fwbw(map_op, f, x, y):
self.assertEqual(true_outs, fake_outs)


@unittest.skipIf(IS_WINDOWS, "Windows not supported for this test")
@skipIfNoDynamoSupport
class TestControlFlowTraced(TestCase):
def setUp(self):
Expand Down
4 changes: 2 additions & 2 deletions test/quantization/pt2e/test_x86inductor_quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
NodeSpec as ns,
QuantizationTestCase,
skipIfNoX86,
skipIfNoDynamoSupport,
skipIfNoInductorSupport,
)
from torch.testing._internal.common_utils import skipIfTorchDynamo
from torch.testing._internal.common_quantized import override_quantized_engine
Expand Down Expand Up @@ -340,7 +340,7 @@ def _test_quantizer(
)
return export_model, prepare_model, convert_model

@skipIfNoDynamoSupport
@skipIfNoInductorSupport
class TestQuantizePT2EX86Inductor(X86InductorQuantTestCase):
@skipIfNoX86
def test_conv2d(self):
Expand Down
9 changes: 8 additions & 1 deletion test/test_content_store.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
# Owner(s): ["oncall: pt2"]

import tempfile
import unittest

import torch
from torch._prims.debug_prims import load_tensor_reader
from torch._subclasses.fake_tensor import FakeTensor, FakeTensorMode
from torch.multiprocessing.reductions import StorageWeakRef
from torch.testing._internal.common_device_type import instantiate_device_type_tests
from torch.testing._internal.common_utils import run_tests, skipIfRocm, TestCase
from torch.testing._internal.common_utils import (
IS_WINDOWS,
run_tests,
skipIfRocm,
TestCase,
)
from torch.utils._content_store import (
ContentStoreReader,
ContentStoreWriter,
hash_storage,
)


@unittest.skipIf(IS_WINDOWS, "Test case not supported on Windows")
class TestContentStore(TestCase):
def test_basic(self, device):
# setup test data
Expand Down
1 change: 1 addition & 0 deletions torch/_dynamo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
explain,
export,
is_dynamo_supported,
is_inductor_supported,
optimize,
optimize_assert,
OptimizedModule,
Expand Down
5 changes: 5 additions & 0 deletions torch/_dynamo/backends/inductor.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# mypy: ignore-errors

import sys

from torch._dynamo import register_backend


@register_backend
def inductor(*args, **kwargs):
if sys.platform == "win32":
raise RuntimeError("Windows not yet supported for inductor")

# do import here to avoid loading inductor into memory when it is not used
from torch._inductor.compile_fx import compile_fx

Expand Down
17 changes: 15 additions & 2 deletions torch/_dynamo/eval_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,6 @@ def __call__(self, fn):


def check_if_dynamo_supported():
if sys.platform == "win32":
raise RuntimeError("Windows not yet supported for torch.compile")
if sys.version_info >= (3, 12):
raise RuntimeError("Python 3.12+ not yet supported for torch.compile")

Expand All @@ -670,6 +668,21 @@ def is_dynamo_supported():
return False


def check_if_inductor_supported():
check_if_dynamo_supported()

if sys.platform == "win32":
raise RuntimeError("Windows not yet supported for inductor")


def is_inductor_supported():
try:
check_if_inductor_supported()
return True
except Exception:
return False


def optimize(
backend="inductor",
*,
Expand Down
16 changes: 16 additions & 0 deletions torch/testing/_internal/common_quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,22 @@ def wrapper(*args, **kwargs):
fn(*args, **kwargs)
return wrapper

def skipIfNoInductorSupport(fn):
reason = "inductor doesn't support."
if isinstance(fn, type):
if not torchdynamo.is_inductor_supported():
fn.__unittest_skip__ = True
fn.__unittest_skip_why__ = reason
return fn

@functools.wraps(fn)
def wrapper(*args, **kwargs):
if not torchdynamo.is_inductor_supported():
raise unittest.SkipTest(reason)
else:
fn(*args, **kwargs)
return wrapper

try:
import torchvision # noqa: F401
HAS_TORCHVISION = True
Expand Down
0