Skip to content

Commit ccd03b5

Browse files
committed
Fix API paths for Windows
Signed-off-by: Michał Górny <[email protected]>
1 parent fc39c4d commit ccd03b5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
From 67fcb9333c5bccf13cabb3462cd56dd4c7ef7e18 Mon Sep 17 00:00:00 2001
1+
From 89eedf14f72f2baa2fa8b1766a3b3682f454538d Mon Sep 17 00:00:00 2001
22
From: "H. Vetinari" <[email protected]>
33
Date: Thu, 23 Jan 2025 22:58:14 +1100
44
Subject: [PATCH 08/15] point include paths to Conda prefix include dir
55

66
Updated to use `sys.prefix` per
77
https://github.com/conda-forge/pytorch-cpu-feedstock/issues/424.
88
---
9-
torch/utils/cpp_extension.py | 4 ++++
10-
1 file changed, 4 insertions(+)
9+
torch/utils/cpp_extension.py | 5 +++++
10+
1 file changed, 5 insertions(+)
1111

1212
diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py
13-
index 7fa5237994e..7d271c101f8 100644
13+
index 7fa5237994e..99fbd38e81a 100644
1414
--- a/torch/utils/cpp_extension.py
1515
+++ b/torch/utils/cpp_extension.py
16-
@@ -1495,7 +1495,11 @@ def include_paths(device_type: str = "cpu") -> list[str]:
16+
@@ -1495,9 +1495,14 @@ def include_paths(device_type: str = "cpu") -> list[str]:
1717
A list of include path strings.
1818
"""
1919
lib_include = os.path.join(_TORCH_PATH, 'include')
2020
+ # Account for conda prefix.
2121
+ conda_pieces = [sys.prefix] + IS_WINDOWS * ["Library"] + ["include"]
22-
+ conda_include = os.path.join(*conda_pieces)
22+
+ conda_include = os.path.join(*pieces)
2323
paths = [
2424
+ conda_include,
2525
lib_include,
2626
# Remove this once torch/torch.h is officially no longer supported for C++ extensions.
27+
+ os.path.join(conda_include, 'torch', 'csrc', 'api', 'include'),
2728
os.path.join(lib_include, 'torch', 'csrc', 'api', 'include'),
29+
]
30+
if device_type == "cuda" and IS_HIP_EXTENSION:

0 commit comments

Comments
 (0)