mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #345] HIP: build and enable the vision encoder on AMD GPUs #478
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#478
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/mw00/project-maya/pull/345
Author: @Ehco
Created: 10/21/2026
Status: 🔄 Open
Base:
main← Head:hip-vision-encoder📝 Commits (1)
c75f890HIP: build and enable the vision encoder on AMD GPUs📊 Changes
2 files changed (+27 additions, -11 deletions)
View changed files
📝
maya.py(+18 -11)📝
tools/vision/CMakeLists.txt(+9 -0)📄 Description
What
The HIP port was text-only:
maya-visionbuilt CUDA-only, and setup returned early on HIP ("HIP port: text only; vision is not enabled").maya-visionis llama.cpp's mtmd at the pinned commit, though, and its ggml has had a HIP backend for years - so the CUDA build wires up the same way there, and the engine side needs nothing (it reads the embeddings from files, and its VLEND / VRECLAIM lending already covers the on-demand encoder).Changes
tools/vision/CMakeLists.txt: aSTRATA_VISION_HIPoption that turnsGGML_HIPon (withAMDGPU_TARGETS/CMAKE_HIP_ARCHITECTURESfrom the targets), mutually exclusive withSTRATA_VISION_CUDA(which stays what setsGGML_CUDA).maya.py,compile_vision(): a HIP branch that passes the target flags instead of nvcc's, and-DCMAKE_EXE_LINKER_FLAGS=-no-pie(Ubuntu's PIE default breaks the final link: ggml-hip's objects are position-dependent while the executable defaults to PIE - BFD answers "relocation R_X86_64_32 ... can not be used when making a PIE object").maya.py,vision_step(): no more HIP early-return - HIP setups download the mmproj and vocab and build like CUDA setups do.VSTAMPrecords the backend beside the archs, so a rebuild after switching backends triggers.Tested
Ubuntu 24.04, ROCm 7.2.2, RDNA4 (gfx1201, 32 GB):
--measurereports a 2.9 GB footprint (weights + work buffers at the 2048 px warm-up), and a test picture encodes with the right result/v1/chat/completionscame back correct - 391 image tokens in the prompt, 164 tok/s prefill, 16 tok/s decode on this box--gpu, and the automatic fallback when the card cannot lend) encode correctly tooOne caveat found on the way (not addressed here):
--no-flash-attnon the GPU wants roughly 28 GB of graph buffers at the 2048 px warm-up - the no-FA attention - which a card shared with the engine cannot give; ggml's allocator does not check the failed reserve, so the process segfaults. With flash attention (the default) the encoder is 2.9 GB and works. A guard at that allocation site might be worth its own issue.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.