Skip to content

Commit ee56019

Browse files
sstamenkclaude
andcommitted
ci: add ROCm 7.14 support
Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b4057b8 commit ee56019

3 files changed

Lines changed: 81 additions & 19 deletions

File tree

.github/scripts/build-rocm.sh

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,48 @@ set -xeuo pipefail
44
: "${RUNNER_OS:?RUNNER_OS must be set (Linux/Windows)}"
55
: "${ROCM_VERSION:?ROCM_VERSION must be set}"
66

7+
rocm_version_at_least() {
8+
local required_version="$1"
9+
local current_major current_minor required_major required_minor
10+
11+
IFS=. read -r current_major current_minor _ <<< "${ROCM_VERSION}"
12+
IFS=. read -r required_major required_minor _ <<< "${required_version}"
13+
14+
if ((current_major > required_major)); then
15+
return 0
16+
fi
17+
if ((current_major < required_major)); then
18+
return 1
19+
fi
20+
if ((current_minor >= required_minor)); then
21+
return 0
22+
fi
23+
return 1
24+
}
25+
726
bnb_rocm_arch="gfx90a;gfx942;gfx1100;gfx1101;gfx1102;gfx1103"
827

928
# ROCm 6.4+ - Add RDNA4 and RDNA3.5 targets. Note we assume >=6.4.4.
10-
[[ "${ROCM_VERSION}" == 6.4.* || "${ROCM_VERSION}" == 7.* ]] && bnb_rocm_arch="${bnb_rocm_arch};gfx1150;gfx1151;gfx1152;gfx1153;gfx1200;gfx1201"
29+
if rocm_version_at_least "6.4"; then
30+
bnb_rocm_arch="${bnb_rocm_arch};gfx1150;gfx1151;gfx1152;gfx1153;gfx1200;gfx1201"
31+
fi
1132

1233
# ROCm 7.0+ - Add gfx950
13-
[[ "${ROCM_VERSION}" == 7.* ]] && bnb_rocm_arch="${bnb_rocm_arch};gfx950"
34+
if rocm_version_at_least "7.0"; then
35+
bnb_rocm_arch="${bnb_rocm_arch};gfx950"
36+
fi
37+
38+
# ROCm 7.14+ - Add CDNA1 and RDNA2 targets.
39+
if rocm_version_at_least "7.14"; then
40+
bnb_rocm_arch="${bnb_rocm_arch};gfx908;gfx1030;gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036"
41+
fi
1442

1543
if [ "${RUNNER_OS}" == "Linux" ]; then
16-
image=rocm/dev-ubuntu-22.04:${ROCM_VERSION}-complete
44+
image_suffix="complete"
45+
if rocm_version_at_least "7.14"; then
46+
image_suffix="full"
47+
fi
48+
image=rocm/dev-ubuntu-22.04:${ROCM_VERSION}-${image_suffix}
1749
echo "Using image $image"
1850
docker run --rm -i \
1951
-w /src -v "$PWD:/src" "$image" sh -c \
@@ -23,15 +55,23 @@ if [ "${RUNNER_OS}" == "Linux" ]; then
2355
else
2456
bnb_rocm_arch="gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201"
2557

26-
# Install ROCm SDK wheels from repo.radeon.com.
27-
rocm_base_url="https://repo.radeon.com/rocm/windows/rocm-rel-${ROCM_VERSION}"
28-
pip install \
29-
"${rocm_base_url}/rocm_sdk_core-${ROCM_VERSION}-py3-none-win_amd64.whl" \
30-
"${rocm_base_url}/rocm_sdk_devel-${ROCM_VERSION}-py3-none-win_amd64.whl" \
31-
"${rocm_base_url}/rocm_sdk_libraries_custom-${ROCM_VERSION}-py3-none-win_amd64.whl" \
32-
"${rocm_base_url}/rocm-${ROCM_VERSION}.tar.gz"
58+
if rocm_version_at_least "7.14"; then
59+
# Add RDNA2 and additional RDNA3.5 targets.
60+
bnb_rocm_arch="${bnb_rocm_arch};gfx1030;gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036;gfx1152;gfx1153"
61+
62+
pip install --index-url https://repo.amd.com/rocm/whl-multi-arch/ "rocm[devel]==${ROCM_VERSION}"
63+
else
64+
# Install ROCm SDK wheels from repo.radeon.com.
65+
rocm_base_url="https://repo.radeon.com/rocm/windows/rocm-rel-${ROCM_VERSION}"
66+
pip install \
67+
"${rocm_base_url}/rocm_sdk_core-${ROCM_VERSION}-py3-none-win_amd64.whl" \
68+
"${rocm_base_url}/rocm_sdk_devel-${ROCM_VERSION}-py3-none-win_amd64.whl" \
69+
"${rocm_base_url}/rocm_sdk_libraries_custom-${ROCM_VERSION}-py3-none-win_amd64.whl" \
70+
"${rocm_base_url}/rocm-${ROCM_VERSION}.tar.gz"
71+
72+
fi
3373

34-
# Expand the devel tarball
74+
# Expand the devel tarball.
3575
rocm-sdk init
3676

3777
ROCM_PATH="$(rocm-sdk path --root | tr '\\' '/')"

.github/workflows/python-package.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,12 @@ jobs:
118118
strategy:
119119
matrix:
120120
os: [ubuntu-22.04]
121-
rocm_version: ["6.2.4", "6.3.4", "6.4.4", "7.0.2", "7.1.1", "7.2.4"]
121+
rocm_version: ["6.4.4", "7.0.2", "7.1.1", "7.2.4", "7.14.0"]
122122
include:
123123
- os: windows-2025
124124
rocm_version: "7.2.1"
125+
- os: windows-2025
126+
rocm_version: "7.14.0"
125127
runs-on: ${{ matrix.os }}
126128
steps:
127129
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

docs/source/installation.mdx

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ The currently distributed `bitsandbytes` are built with the following configurat
241241

242242
| **OS** | **ROCm** | **Targets**
243243
|--------------------|----------|---------------------------------------------------------------------|
244-
| **Linux x86-64** | 6.2.4 | CDNA: gfx90a, gfx942 / RDNA: gfx1100, gfx1101, gfx1102, gfx1103
245-
| **Linux x86-64** | 6.3.4 | CDNA: gfx90a, gfx942 / RDNA: gfx1100, gfx1101, gfx1102, gfx1103
246244
| **Linux x86-64** | 6.4.4 | CDNA: gfx90a, gfx942 / RDNA: gfx1100, gfx1101, gfx1102, gfx1103, gfx1150, gfx1151, gfx1152, gfx1153, gfx1200, gfx1201
247245
| **Linux x86-64** | 7.0.2 | CDNA: gfx90a, gfx942, gfx950 / RDNA: gfx1100, gfx1101, gfx1102, gfx1103, gfx1150, gfx1151, gfx1152, gfx1153, gfx1200, gfx1201
248246
| **Linux x86-64** | 7.1.1 | CDNA: gfx90a, gfx942, gfx950 / RDNA: gfx1100, gfx1101, gfx1102, gfx1103, gfx1150, gfx1151, gfx1152, gfx1153, gfx1200, gfx1201
249247
| **Linux x86-64** | 7.2.4 | CDNA: gfx90a, gfx942, gfx950 / RDNA: gfx1100, gfx1101, gfx1102, gfx1103, gfx1150, gfx1151, gfx1152, gfx1153, gfx1200, gfx1201
248+
| **Linux x86-64** | 7.14.0 | CDNA: gfx908, gfx90a, gfx942, gfx950 / RDNA: gfx1030, gfx1031, gfx1032, gfx1033, gfx1034, gfx1035, gfx1036, gfx1100, gfx1101, gfx1102, gfx1103, gfx1150, gfx1151, gfx1152, gfx1153, gfx1200, gfx1201
250249
| **Windows x86-64** | 7.2.1 | RDNA: gfx1100, gfx1101, gfx1102, gfx1150, gfx1151, gfx1200, gfx1201
250+
| **Windows x86-64** | 7.14.0 | RDNA: gfx1030, gfx1031, gfx1032, gfx1033, gfx1034, gfx1035, gfx1036, gfx1100, gfx1101, gfx1102, gfx1150, gfx1151, gfx1152, gfx1153, gfx1200, gfx1201
251251

252252
Use `pip` or `uv` to install the latest release:
253253

@@ -257,14 +257,14 @@ pip install bitsandbytes
257257

258258
### Compile from Source[[rocm-compile]]
259259

260-
bitsandbytes can be compiled from ROCm 6.2 - ROCm 7.2.4. See the `CMakeLists.txt` for additional options.
260+
bitsandbytes can be compiled from ROCm 6.4 - ROCm 7.14.0. See the `CMakeLists.txt` for additional options.
261261

262262
<hfoptions id="rocm-source">
263263
<hfoption id="Linux">
264264

265265
To compile from source, you need CMake >= **3.31.6** and Python >= **3.10** installed. Make sure you have a compiler installed to compile C++ (`gcc`, `make`, headers, etc.).
266266

267-
You should also have a ROCm installation (system-wide or via Docker). The current minimum supported version is **6.2**.
267+
You should also have a ROCm installation (system-wide or via Docker). The current minimum supported version is **6.4**.
268268

269269
```bash
270270
# Install bitsandbytes from source
@@ -284,18 +284,38 @@ pip install -e . # `-e` for "editable" install, when developing BNB (otherwise
284284

285285
Compilation on Windows requires Visual Studio 2022 with C++ support, CMake, Ninja, and Python >= **3.10**.
286286

287-
Instead of a system-wide ROCm installation, you can use the pip-installable ROCm SDK wheels from [repo.radeon.com](https://repo.radeon.com/rocm/windows/):
287+
Instead of a system-wide ROCm installation, use the pip-installable ROCm SDK.
288+
289+
For ROCm 7.14.0, install the current multi-architecture SDK from [repo.amd.com](https://repo.amd.com/rocm/whl-multi-arch/):
290+
291+
```bash
292+
pip install ninja cmake
293+
pip install --index-url https://repo.amd.com/rocm/whl-multi-arch/ "rocm[devel]==7.14.0"
294+
295+
# Expand the devel tarball
296+
rocm-sdk init
297+
298+
# Set ROCM_PATH and activate Visual Studio environment, then build
299+
export ROCM_PATH="$(rocm-sdk path --root)"
300+
export PATH="${ROCM_PATH}/bin:${PATH}"
301+
git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/
302+
# Replace gfx1100 with your GPU architecture.
303+
cmake -G Ninja -DCOMPUTE_BACKEND=hip -DBNB_ROCM_ARCH="gfx1100" -DCMAKE_BUILD_TYPE=Release -DCMAKE_HIP_COMPILER_ROCM_ROOT="${ROCM_PATH}" -S .
304+
cmake --build . --config Release
305+
pip install .
306+
```
307+
308+
For the legacy ROCm 7.2.1 SDK, use the direct wheels from [repo.radeon.com](https://repo.radeon.com/rocm/windows/):
288309

289310
```bash
290-
# Install ROCm SDK wheels (adjust version as needed)
291311
pip install ninja cmake
292312
pip install \
293313
https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/rocm_sdk_core-7.2.1-py3-none-win_amd64.whl \
294314
https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/rocm_sdk_devel-7.2.1-py3-none-win_amd64.whl \
295315
https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/rocm_sdk_libraries_custom-7.2.1-py3-none-win_amd64.whl \
296316
https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/rocm-7.2.1.tar.gz
297317

298-
# Expand the devel tarball
318+
# Expand the devel tarball.
299319
rocm-sdk init
300320

301321
# Set ROCM_PATH and activate Visual Studio environment, then build

0 commit comments

Comments
 (0)