Skip to content

Commit

Permalink
ROCm 6.1 package
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterJH5574 committed Aug 23, 2024
1 parent f4fed53 commit 4b13131
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 37 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/wheel_manylinux_nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,21 @@ jobs:
# matrix of build configs
config:
- gpu: 'none'
image: 'mlcaidev/package-cpu:7a83f97'
image: 'mlcaidev/package-cpu:16b1781'
- gpu: 'cuda-12.1'
image: 'mlcaidev/package-cu121:7a83f97'
image: 'mlcaidev/package-cu121:16b1781'
- gpu: 'cuda-12.2'
image: 'mlcaidev/package-cu122:7a83f97'
# - gpu: 'rocm-5.6'
# image: 'mlcaidev/package-rocm56:7a83f97'
# - gpu: 'rocm-5.7'
# image: 'mlcaidev/package-rocm57:7a83f97'
image: 'mlcaidev/package-cu122:16b1781'
- gpu: 'rocm-6.1'
image: 'mlcaidev/package-rocm61:16b1781'
- gpu: 'rocm-6.2'
image: 'mlcaidev/package-rocm62:16b1781'
exclude:
- pkg_kind: ${{ github.event_name == 'schedule' && 'stable' || '' }}

runs-on: ubuntu-latest
runs-on: [self-hosted, Linux, X64]

steps:
- name: Reclaim disk space
run: |
df -h
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/.ghcup
df -h
- uses: actions/checkout@v3
with:
submodules: 'recursive'
Expand All @@ -56,24 +48,32 @@ jobs:
git clone https://github.com/mlc-ai/mlc-llm mlc-llm --recursive
- name: Sync MLC AI Package
run: |
python scripts/sync_package.py --gpu ${{ matrix.config.gpu }} --package tvm --package-name ${{ matrix.pkg_kind == 'nightly' && 'mlc-ai-nightly' || 'mlc-ai' }} --revision origin/mlc ${{ matrix.pkg_kind == 'nightly' && '--skip-checkout' || '' }} --skip-conda
python3 scripts/sync_package.py --gpu ${{ matrix.config.gpu }} --package tvm --package-name ${{ matrix.pkg_kind == 'nightly' && 'mlc-ai-nightly' || 'mlc-ai' }} --revision origin/mlc ${{ matrix.pkg_kind == 'nightly' && '--skip-checkout' || '' }} --skip-conda
- name: Sync MLC LLM Package
if: matrix.pkg_kind == 'nightly'
run: |
python scripts/sync_package.py --gpu ${{ matrix.config.gpu }} --package mlc-llm --package-name ${{ matrix.pkg_kind == 'nightly' && 'mlc-llm-nightly' || 'mlc-llm' }} --revision origin/main ${{ matrix.pkg_kind == 'nightly' && '--skip-checkout' || '' }} --skip-conda
python3 scripts/sync_package.py --gpu ${{ matrix.config.gpu }} --package mlc-llm --package-name ${{ matrix.pkg_kind == 'nightly' && 'mlc-llm-nightly' || 'mlc-llm' }} --revision origin/main ${{ matrix.pkg_kind == 'nightly' && '--skip-checkout' || '' }} --skip-conda
- name: Build TVM Unity
uses: gacts/run-and-post-run@v1
env:
IMAGE: ${{ matrix.config.image }}
GPU: ${{ matrix.config.gpu }}
run: |
docker/bash.sh --no-gpu $IMAGE ./scripts/build_mlc_ai_wheel_manylinux.sh --gpu $GPU
with:
run: |
docker/bash.sh --no-gpu $IMAGE ./scripts/build_mlc_ai_wheel_manylinux.sh --gpu $GPU
post: |
docker/bash.sh --no-gpu $IMAGE ./scripts/cleanup_workspace.sh
- name: Build MLC-LLM
if: matrix.pkg_kind == 'nightly'
uses: gacts/run-and-post-run@v1
env:
IMAGE: ${{ matrix.config.image }}
GPU: ${{ matrix.config.gpu }}
run: |
docker/bash.sh --no-gpu $IMAGE ./scripts/build_mlc_llm_wheel_manylinux.sh --gpu $GPU
with:
run: |
docker/bash.sh --no-gpu $IMAGE ./scripts/build_mlc_llm_wheel_manylinux.sh --gpu $GPU
post: |
docker/bash.sh --no-gpu $IMAGE ./scripts/cleanup_workspace.sh
- name: Wheel-Deploy
if: github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@v1
Expand Down
15 changes: 8 additions & 7 deletions scripts/build_mlc_ai_wheel_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source /opt/rh/gcc-toolset-11/enable # GCC-11 is the hightest GCC version compat
function usage() {
echo "Usage: $0 [--gpu GPU-VERSION]"
echo
echo -e "--gpu {none cuda-11.7 cuda-11.8 cuda-12.1 cuda-12.2 rocm-5.6 rocm-5.7}"
echo -e "--gpu {none cuda-11.7 cuda-11.8 cuda-12.1 cuda-12.2 rocm-6.1 rocm-6.2}"
echo -e "\tSpecify the GPU version (CUDA/ROCm) in the TVM (default: none)."
}

Expand Down Expand Up @@ -44,7 +44,7 @@ function audit_mlc_ai_wheel() {
TVM_PYTHON_DIR="/workspace/tvm/python"
PYTHON_VERSIONS_CPU=("3.7" "3.8" "3.9" "3.10" "3.11" "3.12")
PYTHON_VERSIONS_GPU=("3.7" "3.8" "3.9" "3.10" "3.11" "3.12")
GPU_OPTIONS=("none" "cuda-11.7" "cuda-11.8" "cuda-12.1" "cuda-12.2" "rocm-5.6" "rocm-5.7")
GPU_OPTIONS=("none" "cuda-11.7" "cuda-11.8" "cuda-12.1" "cuda-12.2" "rocm-6.1" "rocm-6.2")
GPU="none"

while [[ $# -gt 0 ]]; do
Expand All @@ -71,7 +71,7 @@ done
if ! in_array "${GPU}" "${GPU_OPTIONS[*]}"; then
echo "Invalid GPU option: ${GPU}"
echo
echo 'GPU version can only be {"none", "cuda-11.7" "cuda-11.8" "cuda-12.1" "cuda-12.2" "rocm-5.6" "rocm-5.7"}'
echo 'GPU version can only be {"none", "cuda-11.7" "cuda-11.8" "cuda-12.1" "cuda-12.2" "rocm-6.1" "rocm-6.2"}'
exit -1
fi

Expand All @@ -86,7 +86,7 @@ fi
AUDITWHEEL_OPTS="--plat ${AUDITWHEEL_PLAT} -w repaired_wheels/"
AUDITWHEEL_OPTS="--exclude libtinfo ${AUDITWHEEL_OPTS}"
if [[ ${GPU} == rocm* ]]; then
AUDITWHEEL_OPTS="--exclude libamdhip64 --exclude libhsa-runtime64 --exclude librocm_smi64 --exclude librccl ${AUDITWHEEL_OPTS}"
AUDITWHEEL_OPTS="--exclude libamdhip64 --exclude libhsa-runtime64 --exclude librocm_smi64 --exclude librccl --exclude libhipblas --exclude libhipblaslt ${AUDITWHEEL_OPTS}"
elif [[ ${GPU} == cuda* ]]; then
AUDITWHEEL_OPTS="--exclude libcuda --exclude libcudart --exclude libnvrtc --exclude libcublas --exclude libcublasLt ${AUDITWHEEL_OPTS}"
fi
Expand All @@ -105,9 +105,10 @@ elif [[ ${GPU} == cuda* ]]; then
fi

if [[ ${GPU} == rocm* ]]; then
echo set\(USE_LLVM \"/opt/rocm/llvm/bin/llvm-config --ignore-libllvm --link-static\"\) >>config.cmake
echo set\(USE_LLVM \"llvm-config --ignore-libllvm --link-static\"\) >>config.cmake
echo set\(USE_ROCM ON\) >>config.cmake
echo set\(USE_RCCL /opt/rocm/rccl/ \) >>config.cmake
echo set\(USE_HIPBLAS ON\) >>config.cmake
echo set\(USE_RCCL /opt/rocm/\) >>config.cmake
elif [[ ${GPU} == cuda* ]]; then
echo set\(USE_LLVM \"llvm-config --ignore-libllvm --link-static\"\) >>config.cmake
echo set\(USE_CUDA ON\) >>config.cmake
Expand Down Expand Up @@ -135,7 +136,7 @@ git config --global --add safe.directory /workspace/tvm
mkdir -p build
cd build
cmake ..
make -j$(nproc)
make -j12
find . -type d -name 'CMakeFiles' -exec rm -rf {} +

UNICODE_WIDTH=32 # Dummy value, irrelevant for Python 3
Expand Down
13 changes: 7 additions & 6 deletions scripts/build_mlc_llm_wheel_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source /opt/rh/gcc-toolset-11/enable # GCC-11 is the hightest GCC version compat
function usage() {
echo "Usage: $0 [--gpu GPU-VERSION]"
echo
echo -e "--gpu {none cuda-11.7 cuda-11.8 cuda-12.1 cuda-12.2 rocm-5.6 rocm-5.7}"
echo -e "--gpu {none cuda-11.7 cuda-11.8 cuda-12.1 cuda-12.2 rocm-6.1 rocm-6.2}"
echo -e "\tSpecify the GPU version (CUDA/ROCm) in the MLC-LLM (default: none)."
}

Expand Down Expand Up @@ -44,7 +44,7 @@ function audit_mlc_llm_wheel() {
MLC_LLM_PYTHON_DIR="/workspace/mlc-llm/python"
PYTHON_VERSIONS_CPU=("3.7" "3.8" "3.9" "3.10" "3.11" "3.12")
PYTHON_VERSIONS_GPU=("3.7" "3.8" "3.9" "3.10" "3.11" "3.12")
GPU_OPTIONS=("none" "cuda-11.7" "cuda-11.8" "cuda-12.1" "cuda-12.2" "rocm-5.6" "rocm-5.7")
GPU_OPTIONS=("none" "cuda-11.7" "cuda-11.8" "cuda-12.1" "cuda-12.2" "rocm-6.1" "rocm-6.2")
GPU="none"

while [[ $# -gt 0 ]]; do
Expand All @@ -71,7 +71,7 @@ done
if ! in_array "${GPU}" "${GPU_OPTIONS[*]}"; then
echo "Invalid GPU option: ${GPU}"
echo
echo 'GPU version can only be {"none", "cuda-11.7" "cuda-11.8" "cuda-12.1" "cuda-12.2" "rocm-5.6" "rocm-5.7"}'
echo 'GPU version can only be {"none", "cuda-11.7" "cuda-11.8" "cuda-12.1" "cuda-12.2" "rocm-6.1" "rocm-6.2"}'
exit -1
fi

Expand All @@ -86,7 +86,7 @@ fi
AUDITWHEEL_OPTS="--plat ${AUDITWHEEL_PLAT} -w repaired_wheels/"
AUDITWHEEL_OPTS="--exclude libtvm --exclude libtvm_runtime --exclude libvulkan ${AUDITWHEEL_OPTS}"
if [[ ${GPU} == rocm* ]]; then
AUDITWHEEL_OPTS="--exclude libamdhip64 --exclude libhsa-runtime64 --exclude librocm_smi64 --exclude librccl ${AUDITWHEEL_OPTS}"
AUDITWHEEL_OPTS="--exclude libamdhip64 --exclude libhsa-runtime64 --exclude librocm_smi64 --exclude librccl --exclude libhipblas --exclude libhipblaslt ${AUDITWHEEL_OPTS}"
elif [[ ${GPU} == cuda* ]]; then
AUDITWHEEL_OPTS="--exclude libcuda --exclude libcudart --exclude libnvrtc --exclude libcublas --exclude libcublasLt ${AUDITWHEEL_OPTS}"
fi
Expand All @@ -103,7 +103,8 @@ fi

if [[ ${GPU} == rocm* ]]; then
echo set\(USE_ROCM ON\) >>config.cmake
echo set\(USE_RCCL /opt/rocm/rccl/ \) >>config.cmake
echo set\(USE_HIPBLAS ON\) >>config.cmake
echo set\(USE_RCCL /opt/rocm/\) >>config.cmake
elif [[ ${GPU} == cuda* ]]; then
echo set\(USE_CUDA ON\) >>config.cmake
echo set\(USE_CUTLASS ON\) >>config.cmake
Expand All @@ -127,7 +128,7 @@ fi
mkdir -p build
cd build
cmake ..
make -j$(nproc)
make -j12
find . -type d -name 'CMakeFiles' -exec rm -rf {} +

UNICODE_WIDTH=32 # Dummy value, irrelevant for Python 3
Expand Down
3 changes: 3 additions & 0 deletions scripts/cleanup_workspace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

rm -rf /workspace/tvm/* /workspace/mlc-llm/*
4 changes: 2 additions & 2 deletions scripts/sync_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def main():
"cuda-11.8",
"cuda-12.1",
"cuda-12.2",
"rocm-5.6",
"rocm-5.7",
"rocm-6.1",
"rocm-6.2",
],
help="GPU (CUDA/ROCm) version to be linked to the resultant binaries,"
"or none, to disable CUDA/ROCm. Defaults to none.",
Expand Down

0 comments on commit 4b13131

Please sign in to comment.