Skip to content

Commit 319b9e6

Browse files
committed
ci: fix macOS PyTorch wheel cache key for branch-ref pins
`install_pytorch_and_domains` constructs the cached-wheel URL using `${TORCH_VERSION:0:7}`, which gives "release" when the pin is a branch ref like `release/2.11`. The upload code uses the basename of `dist/*.whl`, which is whatever PyTorch's setup.py wrote — always the resolved commit hash (e.g. `+git70d99e9`). The two never match, so every macOS run misses the cache and does a ~30-minute source build even though the wheel for the current pin's HEAD is already in S3. Resolve the hash via `git rev-parse --short=7 HEAD` after `git checkout`, so download and upload agree. Commit-hash pins are unchanged (the first 7 chars already equaled the resolved hash). Authored with Claude Code.
1 parent 851cffb commit 319b9e6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.ci/scripts/utils.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ install_pytorch_and_domains() {
105105
fi
106106
local python_version=$(python -c 'import platform; v=platform.python_version_tuple(); print(f"{v[0]}{v[1]}")')
107107
local torch_release=$(cat version.txt)
108-
local torch_short_hash=${TORCH_VERSION:0:7}
108+
# Download key must match the upload key below (basename of dist/*.whl,
109+
# which always carries setup.py's resolved +gitHASH). Branch-ref pins
110+
# like `release/2.11` would otherwise produce `+gitrelease` here and
111+
# never hit the cache.
112+
local torch_short_hash=$(git rev-parse --short=7 HEAD)
109113
local torch_wheel_path="cached_artifacts/pytorch/executorch/pytorch_wheels/${system_name}/${python_version}"
110114
local torch_wheel_name="torch-${torch_release}%2Bgit${torch_short_hash}-cp${python_version}-cp${python_version}-${platform:-}.whl"
111115

0 commit comments

Comments
 (0)