Skip to content

Commit 30d7e7a

Browse files
Stonepiapytorchmergebot
authored andcommitted
[XPU] Fix patch for old llvm package error for triton xpu (pytorch#134204)
Fixes pytorch#134199 The PR pytorch#133694 does a workaround to replace the str `"https://tritonlang.blob.core.windows.net/llvm-builds/"` with `"https://oaitriton.blob.core.windows.net/public/llvm-builds/"` in `triton/python/setup.py`. However, in [newer version of Triton](triton-lang/triton@06e6799), it has already been changed to `"https://oaitriton.blob.core....` and don't need to be replaced. But formerly, this will throw a runtime error. This PR makes the `check_and_replace` logic won't fail in such a scenario. Both the old link and the newer link could work. Also note that the `.ci/docker/common/install_triton.sh` does not need the fix, because its `sed` command won't be in effect if there is no such pattern. Pull Request resolved: pytorch#134204 Approved by: https://github.com/chuanqi129, https://github.com/EikanWang, https://github.com/atalman
1 parent 629bd6f commit 30d7e7a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

.github/scripts/build_triton_wheel.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,19 @@ def patch_init_py(
5454
def patch_setup_py(path: Path) -> None:
5555
with open(path) as f:
5656
orig = f.read()
57-
orig = check_and_replace(
58-
orig,
59-
"https://tritonlang.blob.core.windows.net/llvm-builds/",
60-
"https://oaitriton.blob.core.windows.net/public/llvm-builds/",
61-
)
62-
with open(path, "w") as f:
63-
f.write(orig)
57+
try:
58+
orig = check_and_replace(
59+
orig,
60+
"https://tritonlang.blob.core.windows.net/llvm-builds/",
61+
"https://oaitriton.blob.core.windows.net/public/llvm-builds/",
62+
)
63+
with open(path, "w") as f:
64+
f.write(orig)
65+
except RuntimeError as e:
66+
print(
67+
f"Applying patch_setup_py() for llvm-build package failed: {e}.",
68+
"If you are trying to build a newer version of Triton, you can ignore this.",
69+
)
6470

6571

6672
def build_triton(

0 commit comments

Comments
 (0)