[Inductor][Windows] add env_var switch to turn all Windows inductor UTs. (#148733)

For timeout reason, we can't turn on all Windows Inductor UTs in CI: https://github.com/pytorch/pytorch/issues/135927
And without the UTs, we can't ensure Windows inductor quality.

Intel team will do some local test for Windows inductor, but we still need to add a switch to turn on the full Windows inductor UTs.

The switch is an environment variable:
```cmd
set TORCHINDUCTOR_WINDOWS_TESTS=1
```
After setup this environment variable, we can turn on all Windows inductor UTs, It will not affect to PyTorch CI.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/148733
Approved by: https://github.com/jansel

Co-authored-by: Jason Ansel <jansel@jansel.net>
This commit is contained in:
Han, Xu 2025-03-10 18:25:29 +00:00 committed by PyTorch MergeBot
parent 4c13a859e5
commit 00cabd4235

View File

@ -11,6 +11,7 @@ It includes:
import contextlib
import importlib
import logging
import os
from typing import Union
import torch
@ -35,7 +36,11 @@ def run_tests(needs: Union[str, tuple[str, ...]] = ()) -> None:
if TEST_WITH_TORCHDYNAMO or TEST_WITH_CROSSREF:
return # skip testing
if not torch.xpu.is_available() and IS_WINDOWS:
if (
not torch.xpu.is_available()
and IS_WINDOWS
and os.environ.get("TORCHINDUCTOR_WINDOWS_TESTS", "0") == "0"
):
return
if isinstance(needs, str):