diff --git a/.github/workflows/release-docker-amd-rocm10.yml b/.github/workflows/release-docker-amd-rocm10.yml index 663c704932..43c5be15e8 100644 --- a/.github/workflows/release-docker-amd-rocm10.yml +++ b/.github/workflows/release-docker-amd-rocm10.yml @@ -11,6 +11,7 @@ on: - 'all' - publish - publish-gfx1250 + - publish-gfx1250-rocm101 gpu_arch: description: 'Select which ROCm 10 GPU arch to build' required: false @@ -118,6 +119,78 @@ jobs: docker tag "rocm/sgl-dev:${IMAGE_TAG}" "lmsysorg/sglang-rocm:${IMAGE_TAG}" docker push "lmsysorg/sglang-rocm:${IMAGE_TAG}" + publish-gfx1250-rocm101: + if: github.repository == 'sgl-project/sglang' && (github.event_name != 'workflow_dispatch' || inputs.job_select == 'all' || inputs.job_select == 'publish-gfx1250-rocm101') + runs-on: amd-docker-scale + environment: 'prod' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Set date + run: echo "DATE=$(date +%Y%m%d)" >> "$GITHUB_ENV" + + - name: Get version from latest tag + id: version + run: | + VERSION=$(python3 scripts/release/get_version_tag.py --tag-only | sed 's/^v//') + + if [ -z "$VERSION" ]; then + echo "::error::Could not determine version from git tags" + exit 1 + fi + + COMMIT_HASH=$(git rev-parse --short HEAD) + PRETEND_VERSION="${VERSION}.dev${DATE}+g${COMMIT_HASH}" + + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "pretend_version=${PRETEND_VERSION}" >> "$GITHUB_OUTPUT" + + - name: Login to Docker Hub (AMD) + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_AMD_USERNAME }} + password: ${{ secrets.DOCKERHUB_AMD_TOKEN }} + + - name: Build and push to rocm/sgl-dev + env: + PRETEND_VERSION: ${{ steps.version.outputs.pretend_version }} + VERSION: ${{ steps.version.outputs.version }} + run: | + image_tag="v${VERSION}-rocm101-mi45x-${DATE}" + echo "IMAGE_TAG=${image_tag}" >> "$GITHUB_ENV" + + docker build . \ + -f docker/rocm.Dockerfile \ + --build-arg "SGL_BRANCH=${GITHUB_SHA}" \ + --build-arg BUILD_TYPE=all \ + --build-arg GPU_ARCH=gfx1250-rocm1010 \ + --build-arg ENABLE_MORI=0 \ + --build-arg ENABLE_NIXL=1 \ + --build-arg "SETUPTOOLS_SCM_PRETEND_VERSION=${PRETEND_VERSION}" \ + --build-arg UBUNTU_MIRROR=https://archive.ubuntu.com \ + -t "rocm/sgl-dev:${image_tag}" \ + --no-cache + docker push "rocm/sgl-dev:${image_tag}" + + - name: Login to Docker Hub (lmsys) + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Push to lmsysorg/sglang-rocm + run: | + docker tag "rocm/sgl-dev:${IMAGE_TAG}" "lmsysorg/sglang-rocm:${IMAGE_TAG}" + docker push "lmsysorg/sglang-rocm:${IMAGE_TAG}" + # gfx1250 (MI45x) runs on the same schedule as the pair above but stays a # separate job: no MI450 runner pool consumes the image, so a bring-up build # failure must not gate the released gfx942/gfx950 images. diff --git a/docker/rocm.Dockerfile b/docker/rocm.Dockerfile index 8c2bd0ff19..3ae035e009 100644 --- a/docker/rocm.Dockerfile +++ b/docker/rocm.Dockerfile @@ -5,9 +5,10 @@ # docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx950 -t v0.5.17-rocm700-mi35x -f rocm.Dockerfile . # docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx950-rocm720 -t v0.5.17-rocm720-mi35x -f rocm.Dockerfile . # docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx950-rocm724 -t v0.5.17-rocm724-mi35x -f rocm.Dockerfile . -# docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx942-rocm1000 -t v0.5.17-rocm1000-mi30x -f rocm.Dockerfile . -# docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx950-rocm1000 -t v0.5.17-rocm1000-mi35x -f rocm.Dockerfile . -# docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx1250-rocm1000 -t v0.5.17-rocm1000-mi45x -f rocm.Dockerfile . +# docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx942-rocm1000 -t v0.5.17-rocm10-mi30x -f rocm.Dockerfile . +# docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx950-rocm1000 -t v0.5.17-rocm10-mi35x -f rocm.Dockerfile . +# docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx1250-rocm1000 -t v0.5.17-rocm10-mi45x -f rocm.Dockerfile . +# docker build --build-arg SGL_BRANCH=v0.5.17 --build-arg GPU_ARCH=gfx1250-rocm1010 -t v0.5.17-rocm101-mi45x -f rocm.Dockerfile . # # Flavor notes: # GPU_ARCH=*-rocm724 is built on a Python 3.12 base and upgrades the stack to @@ -19,6 +20,8 @@ # GPU_ARCH=gfx1250-rocm1000 carries the gfx1250 bring-up onto that same GA # wheel channel. The gfx1250 workarounds key off GPU_ARCH_LIST=gfx1250 rather # than the flavor name. +# GPU_ARCH=*-rocm1010 is ROCm 10.1 + torch 2.12 off the same channel, and +# keeps the SDK's Triton instead of building one. # Usage (to build SGLang ROCm + Mori docker image): # remove --build-arg NIC_BACKEND=ainic since new MoRI JIT will do NIC auto detection on target @@ -43,11 +46,12 @@ ARG BASE_IMAGE_942_ROCM724="rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_re ARG BASE_IMAGE_950="rocm/sgl-dev:rocm7-vllm-20250904" ARG BASE_IMAGE_950_ROCM720="rocm/pytorch:rocm7.2_ubuntu22.04_py3.10_pytorch_release_2.9.1" ARG BASE_IMAGE_950_ROCM724="rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_release_2.10.0" -# The ROCm 10.0.0 flavors default to the rocm1000-base stage below rather +# The ROCm 10 flavors default to the rocm1000-base stage below rather # than a published image; point these at one to build on a prebuilt base. ARG BASE_IMAGE_942_ROCM1000="rocm1000-base" ARG BASE_IMAGE_950_ROCM1000="rocm1000-base" ARG BASE_IMAGE_1250_ROCM1000="rocm1000-base" +ARG BASE_IMAGE_1250_ROCM1010="rocm1000-base" ARG BASE_IMAGE_ROCM1000="ubuntu:24.04" # This is necessary for scope purpose @@ -144,14 +148,14 @@ RUN mkdir -p /etc/sglang/constraints && : > /etc/sglang/constraints/torch-rocm.t ENV HSA_ENABLE_IPC_MODE_LEGACY=1 # =============================== -# Shared ROCm 10.0.0 base for gfx942 and gfx950. Assemble the stack from +# Shared ROCm 10 base for gfx942, gfx950 and gfx1250. Assemble the stack from # AMD's stable wheels on a plain Ubuntu base so each output image carries only # its own GPU device payload. # The SDK lands in site-packages instead of /opt/rocm, which the rest of this # Dockerfile and AITER both assume, hence the path fixups below. # # This is deliberately AMD's stable channel, not a prerelease or nightly. -# Every ROCm/PyTorch artifact below is pinned to the 10.0.0 release. +# Every ROCm/PyTorch artifact below is pinned to an exact release. # # Python 3.12 (the Ubuntu 24.04 default) rather than 3.13/3.14: st_attn==0.0.7, # vsa==0.0.4, petit_kernel==0.0.2 and wave-lang==3.8.2 publish wheels only up to @@ -162,14 +166,21 @@ FROM $BASE_IMAGE_ROCM1000 AS rocm1000-base # only the device payload for its target image (gfx942 or gfx950). ARG GPU_ARCH -# ROCM_TRITON_VERSION rather than TRITON_VERSION: the final stage declares a -# TRITON_VERSION of its own for the ROCm 7.2 wheel, and a --build-arg would -# otherwise land on both. -ARG ROCM_SDK_VERSION="10.0.0" -ARG ROCM_TORCH_VERSION="2.11.0" -ARG ROCM_TORCHVISION_VERSION="0.26.0" -ARG ROCM_TORCHAUDIO_VERSION="2.11.0" -ARG ROCM_TRITON_VERSION="3.8.0+git4cff872c" +# One pinned stack per flavor; the RUN below picks by the GPU_ARCH suffix. +# Prefixed names so a --build-arg cannot land on the ROCm 7.2 TRITON_VERSION +# that the final stage declares. +ARG ROCM1000_SDK_VERSION="10.0.0" +ARG ROCM1000_TORCH_VERSION="2.11.0" +ARG ROCM1000_TORCHVISION_VERSION="0.26.0" +ARG ROCM1000_TORCHAUDIO_VERSION="2.11.0" +ARG ROCM1000_TRITON_VERSION="3.8.0+git4cff872c" + +ARG ROCM1010_SDK_VERSION="10.1.0" +ARG ROCM1010_TORCH_VERSION="2.12.0" +ARG ROCM1010_TORCHVISION_VERSION="0.27.0" +ARG ROCM1010_TORCHAUDIO_VERSION="2.11.0" +ARG ROCM1010_TRITON_VERSION="3.8.0+git669b31ac" + ARG ROCM_INDEX_URL="https://stable.repo.amd.com/rocm/whl-next/" # Keep device targets data-driven: adding a new image should require one list # entry here, not another pairwise OTHER_ROCM_DEVICE_ARCH mapping. @@ -203,20 +214,31 @@ RUN set -eux; \ ROCM_DEVICE_ARCH="${GPU_ARCH%%-*}"; \ case " ${ROCM_DEVICE_ARCH_LIST} " in \ *" ${ROCM_DEVICE_ARCH} "*) ;; \ - *) echo "Unsupported ROCm 10.0.0 GPU_ARCH=${GPU_ARCH}"; exit 1 ;; \ + *) echo "Unsupported GPU_ARCH=${GPU_ARCH}"; exit 1 ;; \ + esac; \ + case "${GPU_ARCH##*-}" in \ + rocm1000) \ + sdk="${ROCM1000_SDK_VERSION}"; torch="${ROCM1000_TORCH_VERSION}"; \ + vision="${ROCM1000_TORCHVISION_VERSION}"; audio="${ROCM1000_TORCHAUDIO_VERSION}"; \ + triton="${ROCM1000_TRITON_VERSION}" ;; \ + rocm1010) \ + sdk="${ROCM1010_SDK_VERSION}"; torch="${ROCM1010_TORCH_VERSION}"; \ + vision="${ROCM1010_TORCHVISION_VERSION}"; audio="${ROCM1010_TORCHAUDIO_VERSION}"; \ + triton="${ROCM1010_TRITON_VERSION}" ;; \ + *) echo "No pinned ROCm stack for GPU_ARCH=${GPU_ARCH}"; exit 1 ;; \ esac; \ python3 -m pip install --no-cache-dir \ --index-url ${ROCM_INDEX_URL} \ - "rocm-sdk-core==${ROCM_SDK_VERSION}" \ - "rocm-sdk-libraries==${ROCM_SDK_VERSION}" \ - "rocm-sdk-devel==${ROCM_SDK_VERSION}" \ - "rocm-sdk-device-${ROCM_DEVICE_ARCH}==${ROCM_SDK_VERSION}" \ - "torch==${ROCM_TORCH_VERSION}+rocm${ROCM_SDK_VERSION}" \ - "torchvision==${ROCM_TORCHVISION_VERSION}+rocm${ROCM_SDK_VERSION}" \ - "torchaudio==${ROCM_TORCHAUDIO_VERSION}+rocm${ROCM_SDK_VERSION}" \ - "amd-torch-device-${ROCM_DEVICE_ARCH}==${ROCM_TORCH_VERSION}+rocm${ROCM_SDK_VERSION}" \ - "amd-torchvision-device-${ROCM_DEVICE_ARCH}==${ROCM_TORCHVISION_VERSION}+rocm${ROCM_SDK_VERSION}" \ - "triton==${ROCM_TRITON_VERSION}.rocm${ROCM_SDK_VERSION}"; \ + "rocm-sdk-core==${sdk}" \ + "rocm-sdk-libraries==${sdk}" \ + "rocm-sdk-devel==${sdk}" \ + "rocm-sdk-device-${ROCM_DEVICE_ARCH}==${sdk}" \ + "torch==${torch}+rocm${sdk}" \ + "torchvision==${vision}+rocm${sdk}" \ + "torchaudio==${audio}+rocm${sdk}" \ + "amd-torch-device-${ROCM_DEVICE_ARCH}==${torch}+rocm${sdk}" \ + "amd-torchvision-device-${ROCM_DEVICE_ARCH}==${vision}+rocm${sdk}" \ + "triton==${triton}.rocm${sdk}"; \ for package in \ "rocm-sdk-device-${ROCM_DEVICE_ARCH}" \ "amd-torch-device-${ROCM_DEVICE_ARCH}" \ @@ -327,6 +349,24 @@ ENV TRITON_COMMIT_DEFAULT="76940ad348795521b3dc9f6c79acd7309ff924e3" ENV PIP_CONSTRAINT="/etc/sglang/constraints/torch-rocm.txt" RUN mkdir -p /etc/sglang/constraints && : > /etc/sglang/constraints/torch-rocm.txt +# =============================== +# Base image 1250 with ROCm 10.1.0 and args (Python 3.12 + torch 2.12) +FROM $BASE_IMAGE_1250_ROCM1010 AS gfx1250-rocm1010 +ENV BUILD_VLLM="0" +# Keep the Triton that comes with the SDK. The rocm1000 flavor builds a newer +# Triton from source, and that one no longer has block pointers or +# triton_kernels (triton-lang/triton#10833), which sglang still uses. +ENV BUILD_TRITON="0" +ENV BUILD_LLVM="0" +ENV BUILD_AITER_ALL="1" +ENV BUILD_MOONCAKE="1" +ENV AITER_COMMIT_DEFAULT="a6d2b564fd671724a3720b8edf70e8d674e4d694" +# hipBLASLt 10.1 looks for TensileLibrary_lazy_gfx1250.dat directly under +# library/, not library//, and every GEMM fails without this. +ENV HIPBLASLT_TENSILE_LIBPATH="/opt/venv/lib/python3.12/site-packages/_rocm_sdk_libraries/lib/hipblaslt/library/gfx1250" +ENV PIP_CONSTRAINT="/etc/sglang/constraints/torch-rocm.txt" +RUN mkdir -p /etc/sglang/constraints && : > /etc/sglang/constraints/torch-rocm.txt + # Local source stage: with BRANCH_TYPE=local the build context is copied here and # used instead of git clone (mirrors docker/Dockerfile's local_src stage). FROM scratch AS local_src @@ -454,8 +494,8 @@ RUN if [ -n "$UBUNTU_MIRROR" ]; then \ # See https://github.com/ROCm/ROCm/issues/5992 RUN set -eux; \ case "${GPU_ARCH}" in \ - *rocm1000*) \ - echo "ROCm 10.0.0 (GPU_ARCH=${GPU_ARCH}): pip SDK libdrm has the ids table built in, skipping"; \ + *rocm1000*|*rocm1010*) \ + echo "ROCm 10 (GPU_ARCH=${GPU_ARCH}): pip SDK libdrm has the ids table built in, skipping"; \ ;; \ *rocm724*) \ echo "ROCm 7.2.4 (GPU_ARCH=${GPU_ARCH}): installing libdrm-amdgpu from graphics/7.2.4 noble"; \ @@ -498,15 +538,29 @@ RUN apt-get purge -y sccache; python -m pip uninstall -y sccache; rm -f "$(which # Install AMD SMI Python package from ROCm distribution. # Neither the ROCm 7.2 base image (rocm/pytorch) nor the pip-installed ROCm 10.0.0 # SDK pre-installs this package. +# ROCm 10.1 ships it without a setup.py, so pip gets a generated pyproject.toml +# over the same directory instead. RUN set -eux; \ case "${GPU_ARCH}" in \ - *rocm720*|*rocm724*|*rocm1000*) \ - echo "ROCm 7.2 / 10.0.0 flavor detected from GPU_ARCH=${GPU_ARCH}"; \ - cd /opt/rocm/share/amd_smi \ - && python3 -m pip install --no-cache-dir . \ + *rocm720*|*rocm724*|*rocm1000*|*rocm1010*) \ + echo "ROCm 7.2 / 10 flavor detected from GPU_ARCH=${GPU_ARCH}"; \ + cd /opt/rocm/share/amd_smi; \ + if [ -f setup.py ] || [ -f pyproject.toml ]; then \ + python3 -m pip install --no-cache-dir . ; \ + else \ + version=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' amdsmi/_version.py); \ + test -n "${version}"; \ + rm -rf /tmp/amdsmi-pkg; \ + mkdir -p /tmp/amdsmi-pkg; \ + cp -r amdsmi /tmp/amdsmi-pkg/; \ + printf '[build-system]\nrequires = ["setuptools>=59.0"]\nbuild-backend = "setuptools.build_meta"\n\n[project]\nname = "amdsmi"\nversion = "%s"\ndescription = "AMDSMI Python LIB - AMD GPU Monitoring Library"\n\n[tool.setuptools]\npackages = ["amdsmi"]\ninclude-package-data = true\n' "${version}" > /tmp/amdsmi-pkg/pyproject.toml; \ + python3 -m pip install --no-cache-dir /tmp/amdsmi-pkg; \ + rm -rf /tmp/amdsmi-pkg; \ + fi; \ + cd / && python3 -c "import amdsmi; print('[amdsmi]', amdsmi.__file__)"; \ ;; \ *) \ - echo "Not rocm720/rocm724/rocm1000 (GPU_ARCH=${GPU_ARCH}), skip amdsmi installation"; \ + echo "Not a ROCm 7.2 / 10 flavor (GPU_ARCH=${GPU_ARCH}), skip amdsmi installation"; \ ;; \ esac @@ -530,7 +584,7 @@ RUN case "${GPU_ARCH}" in \ # Triton is left out: on rocm724 the BUILD_TRITON step installs it later, and on # rocm1000 it came from the ROCm SDK alongside torch. RUN case "${GPU_ARCH}" in \ - *-rocm724|*-rocm1000) \ + *-rocm724|*-rocm1000|*-rocm1010) \ python3 -m pip freeze \ | grep -E '^(torch|torchvision|torchaudio)(==| @ )' \ > /etc/sglang/constraints/torch-rocm.txt \ @@ -721,6 +775,10 @@ RUN cd sglang \ all_extras="all_hip_rocm724" ; \ CONS="-c /tmp/constraints.txt" ; \ ;; \ + *-rocm1010) srt_extras="srt_hip_rocm101,diffusion_hip"; \ + all_extras="all_hip_rocm101" ; \ + CONS="-c /tmp/constraints.txt" ; \ + ;; \ *-rocm724) srt_extras="srt_hip_rocm724,diffusion_hip"; \ all_extras="all_hip_rocm724" ; \ CONS="-c /tmp/constraints.txt" ; \ @@ -749,6 +807,7 @@ RUN python -m pip cache purge RUN case "${GPU_ARCH##*-}" in \ rocm724) expected_torch="2.11."; expected_audio="2.11."; expected_vision="0.26." ;; \ rocm1000) expected_torch="2.11."; expected_audio="2.11."; expected_vision="0.26." ;; \ + rocm1010) expected_torch="2.12."; expected_audio="2.11."; expected_vision="0.27." ;; \ *) exit 0 ;; \ esac \ && python3 -m pip check \ diff --git a/python/pyproject_other.toml b/python/pyproject_other.toml index d0bc6b9581..c8d82194b1 100755 --- a/python/pyproject_other.toml +++ b/python/pyproject_other.toml @@ -131,6 +131,16 @@ srt_hip_rocm724 = [ "wave-lang==3.8.2", ] +# Same as srt_hip_rocm724 above except for the torch pin; keep them in step by +# hand. ROCm 10.1 publishes no torch 2.11 wheel, so it has to be 2.12. +srt_hip_rocm101 = [ + "compressed-tensors==0.16.0", + "petit_kernel==0.0.2", + "sglang[runtime_common]", + "torch==2.12.0", + "wave-lang==3.8.2", +] + diffusion_hip = [ "cache-dit==1.3.0", "peft>=0.18.0,<0.19.0", # Pin to <0.19.0 due to torchao incompatibility @@ -216,12 +226,14 @@ test = [ all_hip = ["sglang[diffusion_hip]", "sglang[srt_hip]", "sglang[tracing]"] all_hip_rocm724 = ["sglang[diffusion_hip]", "sglang[srt_hip_rocm724]", "sglang[tracing]"] +all_hip_rocm101 = ["sglang[diffusion_hip]", "sglang[srt_hip_rocm101]", "sglang[tracing]"] all_hpu = ["sglang[srt_hpu]"] all_musa = ["sglang[diffusion_musa]", "sglang[srt_musa]"] all_mps = ["sglang[diffusion_mps]", "sglang[srt_mps]"] dev_hip = ["sglang[all_hip]", "sglang[test]"] dev_hip_rocm724 = ["sglang[all_hip_rocm724]", "sglang[test]"] +dev_hip_rocm101 = ["sglang[all_hip_rocm101]", "sglang[test]"] dev_hpu = ["sglang[all_hpu]", "sglang[test]"] dev_musa = ["sglang[all_musa]", "sglang[test]"] dev_mps = ["sglang[all_mps]", "sglang[test]"]