Skip to content

Docker ROCm Studio image: run GGUF chat on the GPU through Vulkan - #13852

Merged
danielhanchen merged 5 commits into
mainfrom
docker-rocm-gguf-gpu
Oct 15, 2026
Merged

danielhanchen merged 5 commits into
mainfrom
docker-rocm-gguf-gpu

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Fixes #5405

GGUF chat in the AMD Studio image (unsloth/unsloth-rocm, the studio tag and -studio tags) ran on the CPU. Training, the notebooks and PyTorch inference already used the GPU, but Dockerfile.studio-rocm installed the CPU llama.cpp bundle, because a ROCm bundle is built per gfx family and would pin the image to one card.

This installs the Vulkan llama.cpp bundle instead, run by Mesa's RADV driver. Vulkan is not tied to one architecture, the /dev/dri node it opens is one ROCm already needs, and it is the backend Studio picks by itself on the Strix APUs outside Docker.

  • libvulkan1 + mesa-vulkan-drivers (RADV). No VK_DRIVER_FILES pin: ggml already drops lavapipe as a CPU device, and an image-wide pin would override a user's own VK_ICD_FILENAMES.
  • UNSLOTH_LLAMA_CPP_BACKEND=vulkan for install.sh in place of cpu, plus a build-time assert that the installed marker says vulkan.
  • Docker Hub page text updated, including that Vulkan does not read HIP_VISIBLE_DEVICES (on a multi-GPU host, pick the chat GPU in Studio or pass only that card's render node). The CUDA images, the ROCm training image (latest built from Dockerfile.rocm) and the WSL2 DXG path are unchanged.

Tested on a Strix Halo (Radeon 8060S, gfx1151), Linux, Docker

The head image was built on the runner from this branch's docker/, on the same published base digest (sha-133a807) and the same Studio commit as the published sha-133a807-studio, which is the base arm. Only Dockerfile.studio-rocm differs. Each arm is a fresh container with the docs' flags (--device /dev/kfd --device /dev/dri plus numeric group ids), Studio started by the image's own launcher, unsloth/Qwen3-4B-Instruct-2507-GGUF Q4_K_M loaded through /api/inference/load, then three 256-token chats through /v1/chat/completions, in the order base, head, head, base.

base (published) head (this PR)
llama.cpp bundle linux-x64-cpu, Available devices: (none) linux-x64-vulkan, Vulkan0: Radeon 8060S Graphics (RADV GFX1151)
llama-server placement -ngl -1 --fit off -ngl -1 --fit off --device Vulkan0
model weights CPU model buffer size = 692.63 MiB, CPU_REPACK ... = 1683.28 MiB Vulkan0 model buffer size = 2375.91 MiB
GPU memory in use (GTT) 43 MiB 3342 MiB
chat tok/s, run 1 (3 prompts) 38.3 / 38.8 / 38.8 69.5 / 69.0 / 73.3
chat tok/s, run 2 (3 prompts) 38.6 / 39.0 / 39.0 71.6 / 70.8 / 72.6

tok/s is wall time per request including prefill, with Studio's default settings. The answers start with the same text on both sides.

Build: llama.cpp b11541-mix-2500203 app-b11541-mix-2500203-linux-x64-vulkan.tar.gz from the new assert, and Vulkan selected for GGUF inference; the PyTorch training backend is unchanged from install.sh. The image grows by about 245 MB uncompressed.

A second build at this head (no ICD pin) on the same runner covered the fallback and the upgrade path, same model and prompts:

result
head with RADV disabled (VK_LOADER_DRIVERS_DISABLE=*radeon*, lavapipe still installed: how a CDNA host looks to llama.cpp) Available devices: (none) (ggml drops the CPU rasterizer), weights in CPU / CPU_REPACK buffers, chat works at 38.6 / 39.0 / 39.1 tok/s, no error
Studio volume created by the published image, then the head image started on it the home relinks to the new bundle: --device Vulkan0, Vulkan0 model buffer size = 2375.91 MiB, 70.0 / 70.7 / 72.8 tok/s
head, plain using device Vulkan0 (Radeon 8060S Graphics (RADV GFX1151)), 70.5 / 70.6 / 71.6 tok/s

Tests: tests/python/test_docker_rocm.py gains two checks on the Dockerfile (Vulkan backend plus the marker assert, the RADV packages); both fail on main. Every test file that reads the changed files passes (123 tests).

Not covered on real hardware: discrete RDNA cards, CDNA (RADV does not drive it, so llama.cpp sees no Vulkan device and stays on the CPU, the case simulated above), and the WSL2 DXG path, which has no /dev/dri.

The Studio regression switchboard (auth, settings, page crawl) at this head: NO_REGRESSION, 36 same, 3 DOM-only with 0 changed pixels (no Studio source differs).

@danielhanchen danielhanchen self-assigned this Oct 15, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T14:26:14.701005Z 9844a2c Manual request
🔒 Security Review ⚠️ Failed 2026-10-15T13:00:17.787596Z 9f7aa3c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 9f7aa3cbdf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9844a2cf8f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 101 to +103
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl git ca-certificates supervisor ffmpeg \
curl git ca-certificates supervisor ffmpeg libvulkan1 mesa-vulkan-drivers \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pin the Vulkan loader to the RADV ICD

On mixed-GPU hosts, installing mesa-vulkan-drivers without setting VK_DRIVER_FILES exposes the other Mesa ICDs as well as RADV. Studio's Vulkan probe will therefore include non-AMD adapters, and its automatic placement can prefer a discrete Intel GPU or split across unintended devices instead of using the ROCm AMD card. Neither this Dockerfile nor another image setting pins the loader, so resolve the installed radeon_icd*.json path and bake that into VK_DRIVER_FILES as intended.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not pinning on purpose. An image-wide VK_DRIVER_FILES overrides any VK_ICD_FILENAMES a user sets in the container and dangles if Mesa renames the manifest, while the case it guards (a discrete Intel or other non-AMD Vulkan GPU passed into the ROCm image next to the AMD card) still runs chat on a GPU, picked by the same placement Studio uses on bare-metal Vulkan hosts. Without the pin, Studio still used Vulkan0 RADV on gfx1151, and lavapipe is dropped by ggml as a CPU device.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 9844a2cf8f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] AMD: use the GPU in the Docker image (Strix Halo ran on CPU)

1 participant