Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit 61f4a93

Browse files
authored
[TPU][Bugfix] Use XLA rank for persistent cache path (vllm-project#8137)
1 parent d4db9f5 commit 61f4a93

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/source/getting_started/tpu-installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ First, install the dependencies:
5959
$ export DATE="20240828"
6060
$ export TORCH_VERSION="2.5.0"
6161
$ pip install https://storage.googleapis.com/pytorch-xla-releases/wheels/tpuvm/torch-${TORCH_VERSION}.dev${DATE}-cp310-cp310-linux_x86_64.whl
62-
$ pip3 install https://storage.googleapis.com/pytorch-xla-releases/wheels/tpuvm/torch_xla-${TORCH_VERSION}.dev${DATE}-cp310-cp310-linux_x86_64.whl
62+
$ pip install https://storage.googleapis.com/pytorch-xla-releases/wheels/tpuvm/torch_xla-${TORCH_VERSION}.dev${DATE}-cp310-cp310-linux_x86_64.whl
6363
6464
$ # Install JAX and Pallas.
6565
$ pip install torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/index.html

vllm/worker/tpu_worker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ def init_device(self) -> None:
102102
# NOTE(woosuk): Set per-rank cache path since different ranks
103103
# can have slightly different XLA graphs.
104104
world_size = self.parallel_config.world_size
105+
rank = xr.global_ordinal()
105106
per_rank_path = os.path.join(envs.VLLM_XLA_CACHE_PATH,
106-
f"tp{world_size}_rank{self.rank}")
107+
f"tp{world_size}_rank{rank}")
107108
xr.initialize_cache(per_rank_path, readonly=False)
108109

109110
def load_model(self):

0 commit comments

Comments
 (0)