From 9b7ddaea4a32b33f56924dac7c43c5bbecac4fc1 Mon Sep 17 00:00:00 2001 From: Donato Capitella Date: Sat, 9 Aug 2025 10:10:29 +0100 Subject: [PATCH] Added rocm-6.4.2 with ROCWAAM for faster Flash attention kernels --- .github/workflows/build_and_publish.yml | 2 +- toolboxes/Dockerfile.rocm-6.4.2-rocwaam | 45 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 toolboxes/Dockerfile.rocm-6.4.2-rocwaam diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index 9a55c16..554169a 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -28,7 +28,7 @@ jobs: IN='${{ inputs.backends }}' if [[ "$IN" == "all" || -z "$IN" ]]; then - JSON='["rocm-6.4.2","rocm-7beta","rocm-7rc","vulkan-amdvlk","vulkan-radv"]' + JSON='["rocm-6.4.2","rocm-6.4.2-rocwaam", "rocm-7beta","rocm-7rc","vulkan-amdvlk","vulkan-radv"]' else # Remove spaces and build JSON array from comma list IN_CLEAN=$(echo "$IN" | tr -d '[:space:]') diff --git a/toolboxes/Dockerfile.rocm-6.4.2-rocwaam b/toolboxes/Dockerfile.rocm-6.4.2-rocwaam new file mode 100644 index 0000000..5e90b4d --- /dev/null +++ b/toolboxes/Dockerfile.rocm-6.4.2-rocwaam @@ -0,0 +1,45 @@ +FROM fedora:rawhide + +# Install build dependencies and tools +RUN dnf install -y \ + make gcc cmake lld clang clang-devel compiler-rt libcurl-devel \ + rocminfo radeontop 'rocm-*' 'rocblas-*' 'hipblas' 'hipblas-*' \ + git vim rsync \ + && dnf clean all + + +WORKDIR /opt/ +RUN git clone -b release/rocm-rel-7.0 https://github.com/ROCm/rocWMMA.git +RUN sudo mkdir -p /usr/include/rocwmma +RUN sudo rsync -a rocWMMA/library/include/rocwmma/ /usr/include/rocwmma/ + +# Set up working directory +WORKDIR /opt/llama.cpp + +# Clone llama.cpp repository (with submodules) +RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git . + +# Build llama.cpp with HIP support +RUN git clean -xdf \ + && git pull \ + && git submodule update --recursive \ + && \ + # Configure and compile with HIP toolchain + HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \ + 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 + +RUN find /opt/llama.cpp/build -type f -name 'lib*.so*' -exec cp {} /usr/lib64/ \; \ + && ldconfig + +COPY gguf-vram-estimator.py /usr/local/bin/gguf-vram-estimator.py +RUN chmod +x /usr/local/bin/gguf-vram-estimator.py + +# Default to interactive shell +CMD ["/bin/bash"]