[AMD CI] Local cache fallback. (#13452)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Sai Enduri
2025-11-18 19:23:45 -08:00
committed by GitHub
co-authored by gemini-code-assist[bot]
parent 6c2e5fcd91
commit 9a1a9a4209
4 changed files with 28 additions and 17 deletions
+17 -7
View File
@@ -6,7 +6,7 @@ SGLANG_VERSION_FILE="$(dirname "$0")/../../python/sglang/version.py"
SGLANG_VERSION="v0.5.5" # Default version, will be overridden if version.py is found
TMP_VERSION_FILE=$(mktemp)
if git fetch origin main --quiet; then
if git fetch --depth=1 origin main; then
if git show origin/main:python/sglang/version.py >"$TMP_VERSION_FILE" 2>/dev/null; then
VERSION_FROM_FILE="v$(cat "$SGLANG_VERSION_FILE" | cut -d'"' -f2)"
if [ -n "$VERSION_FROM_FILE" ]; then
@@ -25,8 +25,9 @@ rm -f "$TMP_VERSION_FILE"
# Default base tags (can be overridden by command line arguments)
DEFAULT_MI30X_BASE_TAG="${SGLANG_VERSION}-rocm700-mi30x"
DEFAULT_MI35X_BASE_TAG="${SGLANG_VERSION}-rocm700-mi35x"
ROCM_VERSION="rocm700"
DEFAULT_MI30X_BASE_TAG="${SGLANG_VERSION}-${ROCM_VERSION}-mi30x"
DEFAULT_MI35X_BASE_TAG="${SGLANG_VERSION}-${ROCM_VERSION}-mi35x"
# Parse command line arguments
MI30X_BASE_TAG="${DEFAULT_MI30X_BASE_TAG}"
@@ -116,6 +117,15 @@ find_latest_image() {
fi
done
echo "No recent images found. Searching any cached local images matching ROCm+arch…" >&2
local any_local
any_local=$(docker images --format '{{.Repository}}:{{.Tag}}' --filter "reference=rocm/sgl-dev:*${ROCM_VERSION}*${gpu_arch}*" | sort -r | head -n 1)
if [[ -n "$any_local" ]]; then
echo "Using cached fallback image: ${any_local}" >&2
echo "${any_local}"
return 0
fi
echo "Error: no ${gpu_arch} image found in the last 7 days for base ${base_tag}" >&2
echo "Using hard-coded fallback…" >&2
if [[ "${gpu_arch}" == "mi35x" ]]; then
@@ -130,9 +140,9 @@ IMAGE=$(find_latest_image "${GPU_ARCH}")
echo "Pulling Docker image: ${IMAGE}"
docker pull "${IMAGE}"
HF_CACHE_HOST=/home/runner/sgl-data/hf-cache
if [[ -d "$HF_CACHE_HOST" ]]; then
CACHE_VOLUME="-v $HF_CACHE_HOST:/hf_home"
CACHE_HOST=/home/runner/sgl-data
if [[ -d "$CACHE_HOST" ]]; then
CACHE_VOLUME="-v $CACHE_HOST:/sgl-data"
else
CACHE_VOLUME=""
fi
@@ -145,7 +155,7 @@ docker run -dt --user root --device=/dev/kfd ${DEVICE_FLAG} \
--shm-size 32g \
--cap-add=SYS_PTRACE \
-e HF_TOKEN="${HF_TOKEN:-}" \
-e HF_HOME=/hf_home \
-e HF_HOME=/sgl-data/hf-cache \
--security-opt seccomp=unconfined \
-w /sglang-checkout \
--name ci_sglang \