A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 16, 20:45 UTC
[ROCm] Cleanup Dockerfile and remove outdated patch (#6482)
Hongxia Yang committed
Jul 17, 2024 at 01:47 UTC
10383887e03412196a2689b9398290719c4797bf
3 files changed
+14
-77
Dockerfile.rocm
+1
-26
@@ -1,11 +1,6 @@
1
# Default ROCm 6.1 base image
2
ARG BASE_IMAGE="rocm/pytorch:rocm6.1.2_ubuntu20.04_py3.9_pytorch_staging"
3
4
-# Tested and supported base rocm/pytorch images
5
-ARG ROCm_5_7_BASE="rocm/pytorch:rocm5.7_ubuntu20.04_py3.9_pytorch_2.0.1" \
6
- ROCm_6_0_BASE="rocm/pytorch:rocm6.0_ubuntu20.04_py3.9_pytorch_2.1.1" \
7
- ROCM_6_1_BASE="rocm/pytorch:rocm6.1.2_ubuntu20.04_py3.9_pytorch_staging"
8
-
4
# Default ROCm ARCHes to build vLLM for.
5
ARG PYTORCH_ROCM_ARCH="gfx908;gfx90a;gfx942;gfx1100"
6
@@ -54,18 +49,6 @@ RUN pip install --upgrade pip
49
RUN apt-get purge -y sccache; pip uninstall -y sccache; rm -f "$(which sccache)"
50
# Install torch == 2.5.0 on ROCm
51
RUN case "$(ls /opt | grep -Po 'rocm-[0-9]\.[0-9]')" in \
57
- *"rocm-5.7"*) \
58
- pip uninstall -y torch torchaudio torchvision \
59
- && pip install --no-cache-dir --pre \
60
- torch==2.5.0.dev20240710 torchaudio==2.4.0.dev20240710 \
61
- torchvision==0.20.0.dev20240710 \
62
- --index-url https://download.pytorch.org/whl/nightly/rocm5.7;; \
63
- *"rocm-6.0"*) \
64
- pip uninstall -y torch torchaudio torchvision \
65
- && pip install --no-cache-dir --pre \
66
- torch==2.5.0.dev20240710 torchaudio==2.4.0.dev20240710 \
67
- torchvision==0.20.0.dev20240710 \
68
- --index-url https://download.pytorch.org/whl/nightly/rocm6.0;; \
52
*"rocm-6.1"*) \
53
pip uninstall -y torch torchaudio torchvision \
54
&& pip install --no-cache-dir --pre \
@@ -104,11 +87,6 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \
87
&& cd flash-attention \
88
&& git checkout "${FA_BRANCH}" \
89
&& git submodule update --init \
107
- && case "$(ls /opt | grep -Po 'rocm-[0-9]\.[0-9]')" in \
108
- *"rocm-5.7"*) \
109
- export VLLM_TORCH_PATH="$(python3 -c 'import torch; print(torch.__path__[0])')" \
110
- && patch "${VLLM_TORCH_PATH}"/utils/hipify/hipify_python.py hipify_patch.patch;; \
111
- *) ;; esac \
90
&& GPU_ARCHS="${FA_GFX_ARCHS}" python3 setup.py bdist_wheel --dist-dir=/install; \
91
# Create an empty directory otherwise as later build stages expect one
92
else mkdir -p /install; \
@@ -161,12 +139,9 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \
139
--mount=type=cache,target=/root/.cache/pip \
140
pip install -U -r requirements-rocm.txt \
141
&& case "$(ls /opt | grep -Po 'rocm-[0-9]\.[0-9]')" in \
164
- *"rocm-6.0"*) \
165
- patch /opt/rocm/include/hip/amd_detail/amd_hip_bf16.h rocm_patch/rocm_bf16.patch;; \
142
*"rocm-6.1"*) \
143
# Bring in upgrades to HIP graph earlier than ROCm 6.2 for vLLM
168
- wget -N https://github.com/ROCm/vllm/raw/fa78403/rocm_patch/libamdhip64.so.6 -P rocm_patch \
169
- && cp rocm_patch/libamdhip64.so.6 /opt/rocm/lib/libamdhip64.so.6 \
144
+ wget -N https://github.com/ROCm/vllm/raw/fa78403/rocm_patch/libamdhip64.so.6 -P /opt/rocm/lib \
145
# Prevent interference if torch bundles its own HIP runtime
146
&& rm -f "$(python3 -c 'import torch; print(torch.__path__[0])')"/lib/libamdhip64.so* || true;; \
147
*) ;; esac \
docs/source/getting_started/amd-installation.rst
+13
-36
@@ -3,7 +3,7 @@
3
Installation with ROCm
4
======================
5
6
-vLLM supports AMD GPUs with ROCm 5.7 and 6.0.
6
+vLLM supports AMD GPUs with ROCm 6.1.
7
8
Requirements
9
------------
@@ -11,7 +11,7 @@ Requirements
11
* OS: Linux
12
* Python: 3.8 -- 3.11
13
* GPU: MI200s (gfx90a), MI300 (gfx942), Radeon RX 7900 series (gfx1100)
14
-* ROCm 6.0 and ROCm 5.7
14
+* ROCm 6.1
15
16
Installation options:
17
@@ -27,10 +27,10 @@ You can build and install vLLM from source.
27
28
First, build a docker image from `Dockerfile.rocm <https://github.com/vllm-project/vllm/blob/main/Dockerfile.rocm>`_ and launch a docker container from the image.
29
30
-`Dockerfile.rocm <https://github.com/vllm-project/vllm/blob/main/Dockerfile.rocm>`_ uses ROCm 6.0 by default, but also supports ROCm 5.7.
30
+`Dockerfile.rocm <https://github.com/vllm-project/vllm/blob/main/Dockerfile.rocm>`_ uses ROCm 6.1 by default, but also supports ROCm 5.7 and 6.0 in older vLLM branches.
31
It provides flexibility to customize the build of docker image using the following arguments:
32
33
-* `BASE_IMAGE`: specifies the base image used when running ``docker build``, specifically the PyTorch on ROCm base image. We have tested ROCm 5.7 and ROCm 6.0. The default is `rocm/pytorch:rocm6.0_ubuntu20.04_py3.9_pytorch_2.1.1`
33
+* `BASE_IMAGE`: specifies the base image used when running ``docker build``, specifically the PyTorch on ROCm base image.
34
* `BUILD_FA`: specifies whether to build CK flash-attention. The default is 1. For `Radeon RX 7900 series (gfx1100) <https://rocm.docs.amd.com/projects/radeon/en/latest/index.html>`_, this should be set to 0 before flash-attention supports this target.
35
* `FX_GFX_ARCHS`: specifies the GFX architecture that is used to build CK flash-attention, for example, `gfx90a;gfx942` for MI200 and MI300. The default is `gfx90a;gfx942`
36
* `FA_BRANCH`: specifies the branch used to build the CK flash-attention in `ROCm's flash-attention repo <https://github.com/ROCmSoftwarePlatform/flash-attention>`_. The default is `ae7928c`
@@ -39,24 +39,17 @@ It provides flexibility to customize the build of docker image using the followi
39
Their values can be passed in when running ``docker build`` with ``--build-arg`` options.
40
41
42
-To build vllm on ROCm 6.0 for MI200 and MI300 series, you can use the default:
42
+To build vllm on ROCm 6.1 for MI200 and MI300 series, you can use the default:
43
44
.. code-block:: console
45
46
- $ docker build -f Dockerfile.rocm -t vllm-rocm .
46
+ $ DOCKER_BUILDKIT=1 docker build -f Dockerfile.rocm -t vllm-rocm .
47
48
-To build vllm on ROCm 6.0 for Radeon RX7900 series (gfx1100), you should specify ``BUILD_FA`` as below:
48
+To build vllm on ROCm 6.1 for Radeon RX7900 series (gfx1100), you should specify ``BUILD_FA`` as below:
49
50
.. code-block:: console
51
52
- $ docker build --build-arg BUILD_FA="0" -f Dockerfile.rocm -t vllm-rocm .
53
-
54
-To build docker image for vllm on ROCm 5.7, you can specify ``BASE_IMAGE`` as below:
55
-
56
-.. code-block:: console
57
-
58
- $ docker build --build-arg BASE_IMAGE="rocm/pytorch:rocm5.7_ubuntu22.04_py3.10_pytorch_2.0.1" \
59
- -f Dockerfile.rocm -t vllm-rocm .
52
+ $ DOCKER_BUILDKIT=1 docker build --build-arg BUILD_FA="0" -f Dockerfile.rocm -t vllm-rocm .
53
54
To run the above docker image ``vllm-rocm``, use the below command:
55
@@ -85,25 +78,12 @@ Option 2: Build from source
78
0. Install prerequisites (skip if you are already in an environment/docker with the following installed):
79
80
- `ROCm <https://rocm.docs.amd.com/en/latest/deploy/linux/index.html>`_
88
-- `Pytorch <https://pytorch.org/>`_
81
+- `PyTorch <https://pytorch.org/>`_
82
- `hipBLAS <https://rocm.docs.amd.com/projects/hipBLAS/en/latest/install.html>`_
83
91
-For installing PyTorch, you can start from a fresh docker image, e.g, `rocm/pytorch:rocm6.1.2_ubuntu20.04_py3.9_pytorch_staging`, `rocm/pytorch:rocm6.0_ubuntu20.04_py3.9_pytorch_2.1.1`, `rocm/pytorch-nightly`.
92
-
93
-Alternatively, you can install pytorch using pytorch wheels. You can check Pytorch installation guild in Pytorch `Getting Started <https://pytorch.org/get-started/locally/>`_
94
-
95
-For rocm6.0:
96
-
97
-.. code-block:: console
98
-
99
- $ pip3 install torch --index-url https://download.pytorch.org/whl/rocm6.0
100
-
101
-
102
-For rocm5.7:
103
-
104
-.. code-block:: console
84
+For installing PyTorch, you can start from a fresh docker image, e.g, `rocm/pytorch:rocm6.1.2_ubuntu20.04_py3.9_pytorch_staging`, `rocm/pytorch-nightly`.
85
106
- $ pip install torch --index-url https://download.pytorch.org/whl/rocm5.7
86
+Alternatively, you can install PyTorch using PyTorch wheels. You can check PyTorch installation guild in PyTorch `Getting Started <https://pytorch.org/get-started/locally/>`_
87
88
89
1. Install `Triton flash attention for ROCm <https://github.com/ROCm/triton>`_
@@ -115,8 +95,6 @@ Install ROCm's Triton flash attention (the default triton-mlir branch) following
95
Install ROCm's flash attention (v2.0.4) following the instructions from `ROCm/flash-attention <https://github.com/ROCm/flash-attention/tree/flash_attention_for_rocm#amd-gpurocm-support>`_
96
97
.. note::
118
- - If you are using rocm5.7 with pytorch 2.1.0 onwards, you don't need to apply the `hipify_python.patch`. You can build the ROCm flash attention directly.
119
- - If you fail to install `ROCm/flash-attention`, try cloning from the commit `6fd2f8e572805681cd67ef8596c7e2ce521ed3c6`.
98
- ROCm's Flash-attention-2 (v2.0.4) does not support sliding windows attention.
99
- You might need to downgrade the "ninja" version to 1.10 it is not used when compiling flash-attention-2 (e.g. `pip install ninja==1.10.2.4`)
100
@@ -131,7 +109,6 @@ Install ROCm's flash attention (v2.0.4) following the instructions from `ROCm/fl
109
110
.. tip::
111
134
- - You may need to turn on the ``--enforce-eager`` flag if you experience process hang when running the `benchmark_thoughput.py` script to test your installation.
112
- Triton flash attention is used by default. For benchmarking purposes, it is recommended to run a warm up step before collecting perf numbers.
136
- - To use CK flash-attention, please use this flag ``export VLLM_USE_TRITON_FLASH_ATTN=0`` to turn off triton flash attention.
137
- - The ROCm version of pytorch, ideally, should match the ROCm driver version.
113
+ - To use CK flash-attention or PyTorch naive attention, please use this flag ``export VLLM_USE_TRITON_FLASH_ATTN=0`` to turn off triton flash attention.
114
+ - The ROCm version of PyTorch, ideally, should match the ROCm driver version.
rocm_patch/rocm_bf16.patch
deleted
-15
@@ -1,15 +0,0 @@
1
---- amd_hip_bf16.h 2024-02-06 18:28:58.268699142 +0000
2
-+++ amd_hip_bf16.h.new 2024-02-06 18:28:31.988647133 +0000
3
-@@ -90,10 +90,10 @@
4
- #include "math_fwd.h" // ocml device functions
5
-
6
- #if defined(__HIPCC_RTC__)
7
--#define __HOST_DEVICE__ __device__
8
-+#define __HOST_DEVICE__ __device__ static
9
- #else
10
- #include <climits>
11
--#define __HOST_DEVICE__ __host__ __device__
12
-+#define __HOST_DEVICE__ __host__ __device__ static inline
13
- #endif
14
-
15
- // Since we are using unsigned short to represent data in bfloat16, it can be of different sizes on