Addin rocm7-rocwaam toolbox
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
FROM fedora:rawhide
|
||||
|
||||
# 1) Install dependencies
|
||||
RUN dnf install -y \
|
||||
make gcc cmake lld clang clang-devel compiler-rt libcurl-devel \
|
||||
radeontop git vim patch curl ninja-build \
|
||||
&& dnf clean all
|
||||
|
||||
# 2) Download ROCm nightly tarball
|
||||
WORKDIR /tmp
|
||||
RUN curl -L -o therock.tar.gz \
|
||||
https://github.com/ROCm/TheRock/releases/download/nightly-tarball/therock-dist-linux-gfx1151-7.0.0rc20250714.tar.gz
|
||||
|
||||
# 3) Extract into /opt/rocm-7.0
|
||||
RUN mkdir -p /opt/rocm-7.0 \
|
||||
&& tar xvf therock.tar.gz -C /opt/rocm-7.0 --strip-components=1
|
||||
|
||||
# 4) Bake in ROCm env + full system PATH
|
||||
ENV ROCM_PATH=/opt/rocm-7.0 \
|
||||
HIP_PLATFORM=amd \
|
||||
HIP_PATH=/opt/rocm-7.0 \
|
||||
HIP_CLANG_PATH=/opt/rocm-7.0/llvm/bin \
|
||||
HIP_INCLUDE_PATH=/opt/rocm-7.0/include \
|
||||
HIP_LIB_PATH=/opt/rocm-7.0/lib \
|
||||
HIP_DEVICE_LIB_PATH=/opt/rocm-7.0/lib/llvm/amdgcn/bitcode \
|
||||
PATH=/opt/rocm-7.0/bin:/opt/rocm-7.0/llvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||
LD_LIBRARY_PATH=/opt/rocm-7.0/lib:/opt/rocm-7.0/lib64:/opt/rocm-7.0/llvm/lib \
|
||||
LIBRARY_PATH=/opt/rocm-7.0/lib:/opt/rocm-7.0/lib64 \
|
||||
CPATH=/opt/rocm-7.0/include \
|
||||
PKG_CONFIG_PATH=/opt/rocm-7.0/lib/pkgconfig
|
||||
|
||||
# 5) profile.d snippet for login & interactive shells
|
||||
RUN printf '%s\n' \
|
||||
'export ROCM_PATH=/opt/rocm-7.0' \
|
||||
'export HIP_PLATFORM=amd' \
|
||||
'export HIP_PATH=/opt/rocm-7.0' \
|
||||
'export HIP_CLANG_PATH=/opt/rocm-7.0/llvm/bin' \
|
||||
'export HIP_INCLUDE_PATH=/opt/rocm-7.0/include' \
|
||||
'export HIP_LIB_PATH=/opt/rocm-7.0/lib' \
|
||||
'export HIP_DEVICE_LIB_PATH=/opt/rocm-7.0/lib/llvm/amdgcn/bitcode' \
|
||||
'export PATH="$ROCM_PATH/bin:$HIP_CLANG_PATH:$PATH"' \
|
||||
'export LD_LIBRARY_PATH="$HIP_LIB_PATH:$ROCM_PATH/lib:$ROCM_PATH/lib64:$ROCM_PATH/llvm/lib"' \
|
||||
'export LIBRARY_PATH="$HIP_LIB_PATH:$ROCM_PATH/lib:$ROCM_PATH/lib64"' \
|
||||
'export CPATH="$HIP_INCLUDE_PATH"' \
|
||||
'export PKG_CONFIG_PATH="$ROCM_PATH/lib/pkgconfig"' \
|
||||
'export ROCBLAS_USE_HIPBLASLT=1' \
|
||||
> /etc/profile.d/rocm.sh \
|
||||
&& chmod +x /etc/profile.d/rocm.sh \
|
||||
&& echo 'source /etc/profile.d/rocm.sh' >> /etc/bashrc
|
||||
|
||||
# Install ROCWAAM
|
||||
WORKDIR /opt/
|
||||
COPY ./build-rocwaam.sh .
|
||||
RUN chmod +x build-rocwaam.sh
|
||||
RUN ./build-rocwaam.sh
|
||||
|
||||
# 6) Clone llama.cpp
|
||||
WORKDIR /opt/llama.cpp
|
||||
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git . \
|
||||
&& git clean -xdf \
|
||||
&& git submodule update --recursive
|
||||
|
||||
# Apply PAtch for ROCWAAM
|
||||
COPY ./apply-rocwmma-fix.sh /opt
|
||||
RUN chmod +x /opt/apply-rocwmma-fix.sh
|
||||
RUN /opt/apply-rocwmma-fix.sh /opt/llama.cpp
|
||||
|
||||
# 7) Apply patchpatch and apply
|
||||
COPY hip-rocm7rc.patch /opt/llama.cpp/hip-rocm7rc.patch
|
||||
RUN patch -p1 < hip-rocm7rc.patch
|
||||
|
||||
# 8) Configure, build & install llama.cpp with HIP
|
||||
RUN cmake -S . -B build \
|
||||
-DGGML_HIP=ON \
|
||||
-DAMDGPU_TARGETS=gfx1151 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLAMA_HIP_UMA=ON \
|
||||
-DGGML_HIP_ROCWMMA_FATTN=ON \
|
||||
&& cmake --build build --config Release -- -j$(nproc) \
|
||||
&& cmake --install build --config Release
|
||||
|
||||
# 9) Copy the .so from build/bin into /usr/lib64 so ldconfig can see it
|
||||
RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \
|
||||
&& ldconfig
|
||||
|
||||
# 10) Install helper script
|
||||
COPY gguf-vram-estimator.py /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/gguf-vram-estimator.py
|
||||
|
||||
# 11) Default to interactive bash
|
||||
CMD ["/bin/bash"]
|
||||
Reference in New Issue
Block a user