@@ -39,14 +39,18 @@ if [ -z "${TORCHSTORE_BRANCH:-}" ]; then
3939 log_error " TORCHSTORE_BRANCH not set in $VERSIONS_FILE "
4040 exit 1
4141fi
42- if [ -z " ${TORCHTITAN_XPU_COMMIT :- } " ]; then
43- log_error " TORCHTITAN_XPU_COMMIT not set in $VERSIONS_FILE "
42+ if [ -z " ${TORCHTITAN_VERSION :- } " ]; then
43+ log_error " TORCHTITAN_VERSION not set in $VERSIONS_FILE "
4444 exit 1
4545fi
4646if [ -z " ${MONARCH_VERSION:- } " ]; then
4747 log_error " MONARCH_VERSION not set in $VERSIONS_FILE "
4848 exit 1
4949fi
50+ if [ -z " ${PYTORCH_XPU_VERSION:- } " ]; then
51+ log_error " PYTORCH_XPU_VERSION not set in $VERSIONS_FILE "
52+ exit 1
53+ fi
5054
5155# Defaults (override via environment variables)
5256FORGE_DEPS_DIR=" ${FORGE_DEPS_DIR:- $HOME / .cache/ torchforge} "
@@ -64,17 +68,17 @@ check_conda_env() {
6468}
6569
6670check_python_version () {
67- local required=" $IPEX_PYTHON_VERSION "
71+ local required=" $XPU_PYTHON_VERSION "
6872 local actual
6973 actual=$( python -c " import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" )
7074
7175 if [ " $actual " != " $required " ]; then
72- log_error " Python ${actual} detected, but vLLM for XPU requires Python ${required} "
76+ log_error " Python ${actual} detected, but vllm-xpu-kernels requires Python ${required} "
7377 log_info " Recreate your conda env with the correct version:"
7478 log_info " conda create -n forge python=${required} -y"
7579 exit 1
7680 fi
77- log_info " Python version ${actual} matches IPEX requirement"
81+ log_info " Python version ${actual} matches XPU requirement"
7882}
7983
8084# Check required command
@@ -260,16 +264,13 @@ ensure_rust() {
260264create_constraints_file () {
261265 local torch_version
262266 torch_version=$( python -c " import torch; print(torch.__version__)" )
263- local ipex_version
264- ipex_version=$( python -c " import intel_extension_for_pytorch; print(intel_extension_for_pytorch.__version__)" )
265267
266268 local constraints_file=" ${FORGE_DEPS_DIR} /constraints.txt"
267269 cat > " $constraints_file " << EOF
268270torch==${torch_version}
269- intel-extension-for-pytorch==${ipex_version}
270271EOF
271272 export PIP_CONSTRAINT=" $constraints_file "
272- log_info " Pip constraints locked: torch==${torch_version} , IPEX== ${ipex_version} "
273+ log_info " Pip constraints locked: torch==${torch_version} "
273274}
274275
275276install_vllm_xpu () {
@@ -278,24 +279,52 @@ install_vllm_xpu() {
278279 log_info " Installing vLLM ${VLLM_XPU_VERSION} from source (XPU)"
279280 ensure_repo " https://github.com/vllm-project/vllm.git" " $vllm_dir " " $VLLM_XPU_VERSION "
280281
281- # Installs PyTorch + IPEX + all XPU deps
282+ # Let vLLM's xpu requirements drive the PyTorch + triton-xpu install.
282283 python -m pip install -r " ${vllm_dir} /requirements/xpu.txt"
283284
284- # Lock torch + IPEX so later installs can't clobber them
285+ # triton-xpu (required by torch 2.10+xpu) and vanilla triton (required by
286+ # xgrammar) both install into the same `triton/` namespace directory.
287+ # In PyTorch <=2.9 the XPU package was called pytorch-triton-xpu and used a
288+ # separate namespace, so the two coexisted. After the rename to triton-xpu
289+ # pip installs both, and vanilla triton's libtriton.so overwrites the XPU
290+ # one — stripping the 'intel' backend symbol.
291+ #
292+ # Fix: force-reinstall triton-xpu so its libtriton.so (with 'intel') wins.
293+ # We keep vanilla triton installed so xgrammar's pip dependency stays
294+ # satisfied (triton-xpu does not declare Provides: triton).
295+ local triton_xpu_version
296+ triton_xpu_version=$( python -c " import importlib.metadata; print(importlib.metadata.version('triton-xpu'))" )
297+ log_info " Fixing triton namespace conflict: reinstalling triton-xpu ${triton_xpu_version} "
298+ python -m pip install " triton-xpu==${triton_xpu_version} " --force-reinstall --no-deps \
299+ --extra-index-url https://download.pytorch.org/whl/xpu
300+
301+ # Lock torch so later installs can't clobber it
285302 create_constraints_file
286303
287304 VLLM_TARGET_DEVICE=xpu \
288305 python -m pip install -e " $vllm_dir " --no-build-isolation
289306}
290307
308+ verify_pytorch_xpu () {
309+ local actual_version
310+ actual_version=$( python -c " import torch; print(torch.__version__.split('+')[0])" )
311+
312+ if [ " $actual_version " != " ${PYTORCH_XPU_VERSION} " ]; then
313+ log_error " Expected PyTorch ${PYTORCH_XPU_VERSION} but got ${actual_version} "
314+ log_info " vLLM's requirements may have installed an incompatible version"
315+ exit 1
316+ fi
317+ log_info " PyTorch ${actual_version} +xpu verified"
318+ }
319+
291320install_torchstore () {
292321 log_info " Installing torchstore from branch ${TORCHSTORE_BRANCH} "
293322 python -m pip install " git+https://github.com/meta-pytorch/torchstore.git@${TORCHSTORE_BRANCH} "
294323}
295324
296325install_torchtitan () {
297- log_info " Installing torchtitan from tag ${TORCHTITAN_XPU_COMMIT } "
298- python -m pip install " git+https://github.com/pytorch/torchtitan.git@${TORCHTITAN_XPU_COMMIT } "
326+ log_info " Installing torchtitan from tag ${TORCHTITAN_VERSION } "
327+ python -m pip install " git+https://github.com/pytorch/torchtitan.git@${TORCHTITAN_VERSION } "
299328}
300329
301330install_monarch () {
@@ -471,8 +500,9 @@ main() {
471500 install_system_packages " $USE_SUDO "
472501 setup_xpu_env
473502
474- # vLLM install PyTorch + IPEX + creates constraints
503+ # vLLM installs PyTorch + triton-xpu, fixes triton conflict, creates constraints
475504 install_vllm_xpu
505+ verify_pytorch_xpu
476506
477507 # Everything below is protected by PIP_CONSTRAINT
478508 install_torchstore
@@ -504,4 +534,4 @@ main() {
504534 log_info " conda deactivate && conda activate $CONDA_DEFAULT_ENV "
505535}
506536
507- main " $@ "
537+ main " $@ "
0 commit comments