first commit

This commit is contained in:
Donato Capitella
2025-07-28 19:44:18 +01:00
parent d9a961a568
commit c76c69d8d8
3 changed files with 182 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
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 \
&& dnf clean all
# 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 \
&& 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
# Default to interactive shell
CMD ["/bin/bash"]
+30
View File
@@ -0,0 +1,30 @@
FROM fedora:rawhide
# Install build tools, Vulkan headers/loader, and glslc
RUN dnf install -y \
git vim \
make gcc cmake ninja-build lld clang clang-devel compiler-rt libcurl-devel \
vulkan-loader-devel mesa-vulkan-drivers \
glslc \
&& dnf clean all
WORKDIR /opt/llama.cpp
# Clone llama.cpp
RUN git clone --recursive https://github.com/ggerganov/llama.cpp.git .
# Build with Vulkan support
RUN git clean -xdf \
&& git pull \
&& git submodule update --recursive \
&& cmake -S . -B build -G Ninja \
-DGGML_VULKAN=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLLAMA_BUILD_TESTS=OFF \
-DLLAMA_BUILD_EXAMPLES=ON \
-DLLAMA_BUILD_SERVER=ON \
&& cmake --build build --config Release \
&& cmake --install build --config Release
CMD ["/bin/bash"]
+117
View File
@@ -1 +1,118 @@
# amd-strix-halo-toolboxes # amd-strix-halo-toolboxes
This repository provides two Fedora Rawhidebased Dockerfiles for building isolated dev containers with AMDs new **Strix Halo** GPUs (gfx1151):
- **Docker.rocm**: Builds `llama.cpp` with ROCm (HIP) support targeting gfx1151
- **Docker.vulkan**: Builds `llama.cpp` with Vulkan compute support
Both images load the latest ROCm/Vulkan libraries from Fedora Rawhide to ensure compatibility with Strix Halo.
## Repository Structure
```
.
├── Docker.rocm # HIP-based build for ROCm (gfx1151)
├── Docker.vulkan # Vulkan-based build
└── README.md # This documentation
```
## Prerequisites
- **Podman** (or Docker aliased to Podman) installed on a Fedora Rawhide (or compatible) host
- **Fedora Toolbox** (for creating dev containers)
- AMD GPU drivers (ROCm/Vulkan) installed on the host
## 1. Building the Images
### ROCm (HIP) Image
```bash
podman build -t llama-rocm -f Docker.rocm .
```
### Vulkan Image
```bash
podman build -t llama-vulkan -f Docker.vulkan .
```
## 2. Creating Toolbox Containers
Toolbox will automatically mount your home directory, map your UID:GID, enable X11, and use the host network. You only need to pass through the GPU devices and relax seccomp.
### ROCm Toolbox
```bash
toolbox create llama-rocm \
--image localhost/llama-rocm:latest \
-- \
--device /dev/kfd \
--device /dev/dri \
--group-add video \
--security-opt seccomp=unconfined
```
### Vulkan Toolbox
```bash
toolbox create llama-vulkan \
--image localhost/llama-vulkan:latest \
-- \
--device /dev/dri \
--group-add video \
--security-opt seccomp=unconfined
```
## 3. Entering and Testing
After creation, enter each container and verify that your GPU and libraries are accessible.
### ROCm (HIP) Test
```bash
toolbox enter llama-rocm
# inside container:
llama-cli --list-devices
```
You should see your Strix Halo gfx1151 device listed.
### Vulkan Test
```bash
toolbox enter llama-vulkan
# inside container:
vulkaninfo | head -n 10
llama-cli --help
```
If `vulkaninfo` reports your GPU and `llama-cli` runs without errors, the Vulkan build is working.
## Host Configuration
The following host details and kernel settings ensure optimal performance and unified memory access for Strix Halo:
- **Machine**: HP Z2 Mini G1a
- **Memory**: 128 GB RAM, with 512 MB allocated to the GPU in BIOS
- **Host OS**: Fedora 42, kernel 6.15.6-200.fc42.x86_64
- **Kernel boot parameters** (in `/etc/default/grub`):
```text
amd_iommu=off amdgpu.gttsize=131072 ttm.pages_limit=335544321
```
- `amd_iommu=off` disables IOMMU for lower latency and avoids address translation overhead.
- `amdgpu.gttsize=131072` sets the GPU GTT (Graphics Translation Table) size, enabling a unified memory window so the GPU can directly access up to 128 GB of system RAM.
- `ttm.pages_limit=335544321` raises the TTM (Translation Table Maps) page limit to allow larger pinned allocations.
- **Apply parameters**: after editing `/etc/default/grub`, run
```bash
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
```
## Notes
Both images pull Fedora Rawhide packages for the newest ROCm/Vulkan support.