mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2060] [CLOSED] Linux AMD: images on the GPU through Vulkan, on a chosen card or the integrated GPU (vision.device) #3834
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3834
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2060
Author: @ChangXiang-SCU
Created: 10/12/2026
Status: ❌ Closed
Base:
main← Head:linux-amd-vision-device📝 Commits (3)
d33f01bvision: choose the encoder's GPU by PCI address or name (--device, vision.device); Vulkan build option1d1d25fdocs: Linux AMD images on the GPU through Vulkan, by hand; the "device" key354dd9ddocs: the PCI address is stable only while the same cards are present; Windows drivers may not report it📊 Changes
7 files changed (+169 additions, -9 deletions)
View changed files
📝
docs/AMD_HIP.md(+56 -2)📝
docs/DETAILS.md(+12 -0)📝
serve/server.py(+2 -0)📝
serve/test_server.py(+9 -1)📝
tools/test_setup_config.py(+3 -1)📝
tools/vision/CMakeLists.txt(+3 -1)📝
tools/vision/strata_vision.cpp(+84 -4)📄 Description
Title
Linux AMD: images on the GPU through Vulkan, on a chosen card or the integrated GPU (
vision.device)Issue: none. Related: #1768 (Windows AMD, Vulkan encoder in setup), #1521.
Summary
On Linux with an AMD card, setup builds the image encoder for the CPU only. Built with ggml's Vulkan backend, the same encoder runs on a Radeon through Mesa's RADV driver, 20-30x faster. What was missing is a way to say which GPU it runs on. With two cards, mtmd takes the first discrete GPU in Vulkan's order, which can be the engine's own card. On a Ryzen APU it never picks the integrated GPU while a discrete one is present.
This PR adds that choice, plus the build option and the Linux docs:
strata-vision --device <GPU>(with--gpu) takes a PCI address (0000:03:00.0, or03:00.0) or ggml's name for the device (Vulkan1,CUDA0), and hands it to mtmd asmtmd_context_params.device.strata-vision --list-devicesprints the GPUs the build sees and exits."device"in the config's"vision"section is passed as--device. It is a hand-edited key, and a setup run again keeps it.STRATA_VISION_VULKANintools/vision: the same two lines as #1768, so the two PRs merge in either order. I checked this withgit merge-treeagainst #1768's head.docs/AMD_HIP.md: how to build and set it up on Linux by hand, with measurements.docs/DETAILS.md: the"device"key.Without
"device"/--devicenothing changes. On the test PC the default picked the same card as before, and its embeddings were bit-identical to--device 0000:03:00.0and--device Vulkan1. The new stderr line naming the GPU is printed only with--device.Measured
Setup
0000:06:00.0.OK ... ms), 3 runs after the warm-up.--list-devicesoutput on this PC:"device": "0000:03:00.0")"device": "0000:6a:00.0")--vram-reserve-mib 700--vram-reserve-mib 1300"device"set in the config: the same correct answer (three shapes, their colours, the textZX-4096), in 8.8 s on the 6950 XT, 10.7 s on the 780M, and 19.7 s on the CPU.What changed
tools/vision/strata_vision.cpp:--deviceand--list-devices.ERRline on stdout, as for the other start errors, when the GPU is not found or--deviceis given without--gpu.--device).ggml_backend_dev_get_props().device_id), so it is the same for every backend.tools/vision/CMakeLists.txt: theSTRATA_VISION_VULKANoption (builds ggml-vulkan).serve/server.py:Visionpassesvision.deviceas--device, only when it is set.serve/test_server.py:--deviceis passed only when set.tools/test_setup_config.py: a setup run again keeps"device".docs/AMD_HIP.md: "Images on the GPU through Vulkan (Linux, by hand)", and the two lines that said images are CPU-only now link to it.docs/DETAILS.md: the"device"key, next to"cuda_device".setup.pyis untouched; #1768 already adds--vision gpufor AMD there.How I checked
Builds of
tools/visionsm_120: on a 4x RTX 5090 Linux box.Runtime
--deviceby address and by name: on the 6950 XTs and the 780M, as measured above.--list-devicesgivesCUDA0..3with0000:01:00.0,0000:02:00.0,0000:41:00.0and0000:85:00.0.--device 01:00.0and--device CUDA3select those cards.CUDA_VISIBLE_DEVICES=2, the card at0000:41:00.0becomesCUDA0. That renumbering is why the address is the stable name.--list-devicessays there is no GPU, and--devicewithout--gpuends with anERRline. An unknown address ends withERR no GPU ... here.Tests
main+ this PR:python -m unittest serve.test_server(297),tools/test_setup_config.py(15) andtools/test_setup_amd.py(36) pass.serve.test_server(292).Extra Notes
--deviceuses the same ggml calls there, but I have not run it."device"itself, choosing a card the engine does not use or the integrated GPU, and raise the reserve when it has to share.🤖 Generated with Claude Code
https://claude.ai/code/session_01JokSyf43q6Br7d5XnWwCgN
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.