diff --git a/install_utils.py b/install_utils.py index 648f8f61c37..c109b18d356 100644 --- a/install_utils.py +++ b/install_utils.py @@ -108,10 +108,18 @@ def determine_torch_url(torch_nightly_url_base, supported_cuda_versions): URL string for PyTorch packages """ if platform.system().lower() == "windows": - print( - "Windows detected, using CPU-only PyTorch until CUDA support is available" - ) - return f"{torch_nightly_url_base}/cpu" + # Try CUDA detection on Windows as well + print("Windows detected, attempting CUDA detection...") + try: + cuda_version = _get_cuda_version(supported_cuda_versions) + major, minor = cuda_version + print(f"Detected CUDA version: {major}.{minor}") + torch_url = _get_pytorch_cuda_url(cuda_version, torch_nightly_url_base) + print(f"Using PyTorch URL: {torch_url}") + return torch_url + except Exception as err: + print(f"CUDA detection failed ({err}), using CPU-only PyTorch") + return f"{torch_nightly_url_base}/cpu" print("Attempting to detect CUDA via nvcc...") diff --git a/setup.py b/setup.py index f60e6202c30..e2568139b39 100644 --- a/setup.py +++ b/setup.py @@ -677,9 +677,14 @@ def run(self): # noqa C901 f"-DCMAKE_BUILD_TYPE={cmake_build_type}", ] - # Use ClangCL on Windows. + # Use ClangCL on Windows, but not when building with CUDA + # (CUDA 12.x MSBuild targets have compatibility issues with ClangCL) if _is_windows(): - cmake_configuration_args += ["-T ClangCL"] + # Check if CUDA build is enabled via CMAKE_ARGS environment variable + cmake_args_env = os.environ.get("CMAKE_ARGS", "") + cuda_enabled = "EXECUTORCH_BUILD_CUDA=ON" in cmake_args_env + if not cuda_enabled: + cmake_configuration_args += ["-T ClangCL"] # Allow adding extra cmake args through the environment. Used by some # tests and demos to expand the set of targets included in the pip diff --git a/torch_pin.py b/torch_pin.py index e934463cb70..537ed89b15d 100644 --- a/torch_pin.py +++ b/torch_pin.py @@ -1,2 +1,2 @@ TORCH_VERSION = "2.10.0" -NIGHTLY_VERSION = "dev20251120" +NIGHTLY_VERSION = "dev20251016"