mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
[XPU] Fix patch for old llvm package error for triton xpu (#134204)
Fixes #134199
The PR #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](06e6799f4e
), 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: https://github.com/pytorch/pytorch/pull/134204
Approved by: https://github.com/chuanqi129, https://github.com/EikanWang, https://github.com/atalman
This commit is contained in:
committed by
PyTorch MergeBot
parent
629bd6f718
commit
30d7e7a1cd
20
.github/scripts/build_triton_wheel.py
vendored
20
.github/scripts/build_triton_wheel.py
vendored
@ -54,13 +54,19 @@ def patch_init_py(
|
|||||||
def patch_setup_py(path: Path) -> None:
|
def patch_setup_py(path: Path) -> None:
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
orig = f.read()
|
orig = f.read()
|
||||||
orig = check_and_replace(
|
try:
|
||||||
orig,
|
orig = check_and_replace(
|
||||||
"https://tritonlang.blob.core.windows.net/llvm-builds/",
|
orig,
|
||||||
"https://oaitriton.blob.core.windows.net/public/llvm-builds/",
|
"https://tritonlang.blob.core.windows.net/llvm-builds/",
|
||||||
)
|
"https://oaitriton.blob.core.windows.net/public/llvm-builds/",
|
||||||
with open(path, "w") as f:
|
)
|
||||||
f.write(orig)
|
with open(path, "w") as f:
|
||||||
|
f.write(orig)
|
||||||
|
except RuntimeError as e:
|
||||||
|
print(
|
||||||
|
f"Applying patch_setup_py() for llvm-build package failed: {e}.",
|
||||||
|
"If you are trying to build a newer version of Triton, you can ignore this.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def build_triton(
|
def build_triton(
|
||||||
|
Reference in New Issue
Block a user