From b128ce9e765017d86c2a647378681a37742831cf Mon Sep 17 00:00:00 2001 From: Gregory Shtrasberg Date: Fri, 1 Nov 2024 17:39:48 +0000 Subject: [PATCH 1/9] Creating ROCm whl upon release --- .github/workflows/publish.yml | 39 ++++++------------------------ .github/workflows/scripts/build.sh | 13 +++------- 2 files changed, 11 insertions(+), 41 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f959a1cacf866..d7f095d46e5d6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,9 @@ jobs: release: # Retrieve tag and create release name: Create Release - runs-on: ubuntu-latest + runs-on: self-hosted + container: + image: rocm/vllm:rocm6.2_mi300_ubuntu20.04_py3.9_vllm_0.6.4 outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} steps: @@ -41,51 +43,24 @@ jobs: wheel: name: Build Wheel - runs-on: ${{ matrix.os }} + runs-on: self-hosted + container: + image: rocm/vllm:rocm6.2_mi300_ubuntu20.04_py3.9_vllm_0.6.4 needs: release strategy: fail-fast: false - matrix: - os: ['ubuntu-20.04'] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] - pytorch-version: ['2.4.0'] # Must be the most recent version that meets requirements-cuda.txt. - cuda-version: ['11.8', '12.1'] steps: - name: Checkout uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - name: Setup ccache - uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14 - with: - create-symlink: true - key: ${{ github.job }}-${{ matrix.python-version }}-${{ matrix.cuda-version }} - - - name: Set up Linux Env - if: ${{ runner.os == 'Linux' }} - run: | - bash -x .github/workflows/scripts/env.sh - - - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 - with: - python-version: ${{ matrix.python-version }} - - - name: Install CUDA ${{ matrix.cuda-version }} - run: | - bash -x .github/workflows/scripts/cuda-install.sh ${{ matrix.cuda-version }} ${{ matrix.os }} - - - name: Install PyTorch ${{ matrix.pytorch-version }} with CUDA ${{ matrix.cuda-version }} - run: | - bash -x .github/workflows/scripts/pytorch-install.sh ${{ matrix.python-version }} ${{ matrix.pytorch-version }} ${{ matrix.cuda-version }} - - name: Build wheel shell: bash env: CMAKE_BUILD_TYPE: Release # do not compile with debug symbol to reduce wheel size run: | - bash -x .github/workflows/scripts/build.sh ${{ matrix.python-version }} ${{ matrix.cuda-version }} + bash -x .github/workflows/scripts/build.sh wheel_name=$(find dist -name "*whl" -print0 | xargs -0 -n 1 basename) asset_name=${wheel_name//"linux"/"manylinux1"} echo "wheel_name=${wheel_name}" >> "$GITHUB_ENV" diff --git a/.github/workflows/scripts/build.sh b/.github/workflows/scripts/build.sh index 122e4e101e201..13cde08333826 100644 --- a/.github/workflows/scripts/build.sh +++ b/.github/workflows/scripts/build.sh @@ -1,23 +1,18 @@ #!/bin/bash set -eux -python_executable=python$1 -cuda_home=/usr/local/cuda-$2 +python_executable=python3 # Update paths -PATH=${cuda_home}/bin:$PATH -LD_LIBRARY_PATH=${cuda_home}/lib64:$LD_LIBRARY_PATH - # Install requirements -$python_executable -m pip install -r requirements-build.txt -r requirements-cuda.txt +$python_executable -m pip install -r requirements-rocm.txt # Limit the number of parallel jobs to avoid OOM export MAX_JOBS=1 # Make sure release wheels are built for the following architectures -export TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6 8.9 9.0+PTX" -export VLLM_FA_CMAKE_GPU_ARCHES="80-real;90-real" +export PYTORCH_ROCM_ARCH="gfx90a;gfx942" -bash tools/check_repo.sh +rm -f $(which sccache) # Build $python_executable setup.py bdist_wheel --dist-dir=dist From 110cb225449ebb4b2bb5ee04eb5b3280aba5400e Mon Sep 17 00:00:00 2001 From: Gregory Shtrasberg Date: Fri, 1 Nov 2024 19:30:35 +0000 Subject: [PATCH 2/9] Base image --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d7f095d46e5d6..e872c57cd78b1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,7 +18,7 @@ jobs: name: Create Release runs-on: self-hosted container: - image: rocm/vllm:rocm6.2_mi300_ubuntu20.04_py3.9_vllm_0.6.4 + image: rocm/pytorch:rocm6.2_ubuntu20.04_py3.9_pytorch_release_2.3.0 outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} steps: @@ -45,7 +45,7 @@ jobs: name: Build Wheel runs-on: self-hosted container: - image: rocm/vllm:rocm6.2_mi300_ubuntu20.04_py3.9_vllm_0.6.4 + image: rocm/pytorch:rocm6.2_ubuntu20.04_py3.9_pytorch_release_2.3.0 needs: release strategy: From 0cf10db37bfbcf379d7dfbd43be1539951c9b5da Mon Sep 17 00:00:00 2001 From: Gregory Shtrasberg Date: Fri, 1 Nov 2024 19:43:54 +0000 Subject: [PATCH 3/9] Also gradlib wheel --- .github/workflows/publish.yml | 20 ++++++++++++-------- .github/workflows/scripts/build.sh | 2 ++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e872c57cd78b1..38942db2aa153 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -63,10 +63,12 @@ jobs: bash -x .github/workflows/scripts/build.sh wheel_name=$(find dist -name "*whl" -print0 | xargs -0 -n 1 basename) asset_name=${wheel_name//"linux"/"manylinux1"} + gradlib_wheel_name=$(find gradlib/dist -name "*whl" -print0 | xargs -0 -n 1 basename) + gradlib_asset_name=${gradlib_wheel_name//"linux"/"manylinux1"} echo "wheel_name=${wheel_name}" >> "$GITHUB_ENV" echo "asset_name=${asset_name}" >> "$GITHUB_ENV" - - name: Upload Release Asset + - name: Upload vllm Release Asset uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -75,11 +77,13 @@ jobs: asset_path: ./dist/${{ env.wheel_name }} asset_name: ${{ env.asset_name }} asset_content_type: application/* + - name: Upload gradlib Release Asset + uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./dist/${{ env.gradlib_wheel_name }} + asset_name: ${{ env.gradlib_asset_name }} + asset_content_type: application/* - # (Danielkinz): This last step will publish the .whl to pypi. Warning: untested - # - name: Publish package - # uses: pypa/gh-action-pypi-publish@release/v1.8 - # with: - # repository-url: https://test.pypi.org/legacy/ - # password: ${{ secrets.PYPI_API_TOKEN }} - # skip-existing: true diff --git a/.github/workflows/scripts/build.sh b/.github/workflows/scripts/build.sh index 13cde08333826..bcf83b5977485 100644 --- a/.github/workflows/scripts/build.sh +++ b/.github/workflows/scripts/build.sh @@ -16,3 +16,5 @@ rm -f $(which sccache) # Build $python_executable setup.py bdist_wheel --dist-dir=dist +cd gradlib +$python_executable setup.py bdist_wheel --dist-dir=../dist From 8b33f50c7ba391d7fa909086e41bd707c40ab384 Mon Sep 17 00:00:00 2001 From: Gregory Shtrasberg Date: Fri, 1 Nov 2024 19:47:11 +0000 Subject: [PATCH 4/9] Fix sctript to actually use the new env --- .github/workflows/publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 38942db2aa153..9dbe8a6161273 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -67,6 +67,8 @@ jobs: gradlib_asset_name=${gradlib_wheel_name//"linux"/"manylinux1"} echo "wheel_name=${wheel_name}" >> "$GITHUB_ENV" echo "asset_name=${asset_name}" >> "$GITHUB_ENV" + echo "wheel_name=${gradlib_wheel_name}" >> "$GITHUB_ENV" + echo "asset_name=${gradlib_asset_name}" >> "$GITHUB_ENV" - name: Upload vllm Release Asset uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 From 6c17fb6d8ae56e0cd77494eb15aa040747421c54 Mon Sep 17 00:00:00 2001 From: Gregory Shtrasberg Date: Fri, 1 Nov 2024 19:50:16 +0000 Subject: [PATCH 5/9] Path fix --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9dbe8a6161273..fa1b6b3ee8c5c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -85,7 +85,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./dist/${{ env.gradlib_wheel_name }} + asset_path: ./gradlib/dist/${{ env.gradlib_wheel_name }} asset_name: ${{ env.gradlib_asset_name }} asset_content_type: application/* From fba7cca46e9899054ee1abb5875e4c3b429b54af Mon Sep 17 00:00:00 2001 From: Gregory Shtrasberg Date: Fri, 1 Nov 2024 20:20:49 +0000 Subject: [PATCH 6/9] max_jobs and path --- .github/workflows/scripts/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/scripts/build.sh b/.github/workflows/scripts/build.sh index bcf83b5977485..253077667dbed 100644 --- a/.github/workflows/scripts/build.sh +++ b/.github/workflows/scripts/build.sh @@ -14,7 +14,9 @@ export PYTORCH_ROCM_ARCH="gfx90a;gfx942" rm -f $(which sccache) +export MAX_JOBS=32 + # Build $python_executable setup.py bdist_wheel --dist-dir=dist cd gradlib -$python_executable setup.py bdist_wheel --dist-dir=../dist +$python_executable setup.py bdist_wheel --dist-dir=dist From 993ffeb687098be1eaf6e0fe895c5b7af1714343 Mon Sep 17 00:00:00 2001 From: Gregory Shtrasberg Date: Fri, 1 Nov 2024 20:40:16 +0000 Subject: [PATCH 7/9] Returning to the original folder --- .github/workflows/scripts/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/scripts/build.sh b/.github/workflows/scripts/build.sh index 253077667dbed..01131807d2021 100644 --- a/.github/workflows/scripts/build.sh +++ b/.github/workflows/scripts/build.sh @@ -20,3 +20,4 @@ export MAX_JOBS=32 $python_executable setup.py bdist_wheel --dist-dir=dist cd gradlib $python_executable setup.py bdist_wheel --dist-dir=dist +cd .. \ No newline at end of file From 3103abbf28d6c332a876d38422b46e21f2d2f816 Mon Sep 17 00:00:00 2001 From: Gregory Shtrasberg Date: Fri, 1 Nov 2024 21:11:48 +0000 Subject: [PATCH 8/9] Fixing env names --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fa1b6b3ee8c5c..ca27a8294c7bc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -67,8 +67,8 @@ jobs: gradlib_asset_name=${gradlib_wheel_name//"linux"/"manylinux1"} echo "wheel_name=${wheel_name}" >> "$GITHUB_ENV" echo "asset_name=${asset_name}" >> "$GITHUB_ENV" - echo "wheel_name=${gradlib_wheel_name}" >> "$GITHUB_ENV" - echo "asset_name=${gradlib_asset_name}" >> "$GITHUB_ENV" + echo "gradlib_wheel_name=${gradlib_wheel_name}" >> "$GITHUB_ENV" + echo "gradlib_asset_name=${gradlib_asset_name}" >> "$GITHUB_ENV" - name: Upload vllm Release Asset uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 From 0f820f35ebc910d29870fe08ab44c91ffb464040 Mon Sep 17 00:00:00 2001 From: Gregory Shtrasberg Date: Fri, 1 Nov 2024 21:44:36 +0000 Subject: [PATCH 9/9] Installing torch and triton first so that gradlib is built compatible --- .github/workflows/publish.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ca27a8294c7bc..830a2fff4dbe4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -52,6 +52,11 @@ jobs: fail-fast: false steps: + - name: Prepare + run: | + pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2 + pip3 install -U triton + - name: Checkout uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1