Skip to content

Add AMD Strix Halo (gfx1151 / ROCm) support - #152

Closed
smfworks wants to merge 10 commits into
jayleaton:mainfrom
smfworks:amd-strix-halo-upstream
Closed

smfworks wants to merge 10 commits into
jayleaton:mainfrom
smfworks:amd-strix-halo-upstream

Conversation

@smfworks

@smfworks smfworks commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Hi Jay! As discussed in #151, this adds AMD Strix Halo (Ryzen AI Max+ 395 / Radeon 8060S, gfx1151, ROCm 7.2) support. Everything is additive: the NVIDIA and macOS paths are unchanged, and no Zig engine code changes beyond one small option. Ten commits, each standing on its own, so we're happy to split this into smaller PRs or drop anything you'd rather not carry.

Closes #151

Changes

  1. install: AMD detection (tools/install/lib.sh, doctor.sh). When nvidia-smi sees no GPU, these read the amdgpu card from sysfs and rocminfo (GPU name and gfx target), plus the ROCm version and GTT size/usage. Profiles can optionally require hardware.min_rocm, .gfx and .min_gtt_gib. doctor shows GTT in use with AMD hints, reads min_free_gib from the profile (default 88, as before), and can check a systemd-transient service.
  2. speech: tools/speech/openai_audio. A stdlib-only cmd worker for any OpenAI-compatible audio server (/v1/audio/speech streamed as PCM into speech.wav, /v1/audio/transcriptions → transcript.json). It starts and stops the model's own server like openai_server does for chat. Includes a fake-server test.
  3. whisper: ROCm venv (tools/speech/whisper/rocm). The existing worker with a lock on PyTorch's ROCm 7.2 wheels (torch 2.13.0+rocm7.2). The existing lock is untouched.
  4. tools/gufo: serve.sh. Runs a Gufo server (an MIT-licensed gfx1151 inference engine for Qwen3.8 Flash-Next, Qwen3-TTS, Qwen3-ASR, …) in rootless Podman, in the foreground under a worker, reachable on loopback only. It stops cleanly on SIGTERM so GPU memory is free when it exits.
  5. deploy: strix-halo-gfx1151 profile + deploy/strix-halo kit (status: preview).
    • Tools: Flash-Next chat via Gufo (Q4 + MTP) and via llama.cpp llama-server (Q3 + MTP) as openai_server tools, plus Qwen3-TTS and Qwen3-ASR via Gufo behind openai_audio, plus Whisper on ROCm.
    • budget_bytes = GTT minus 2 GiB, because GPU allocations past GTT fail even when MemAvailable has room.
    • The daemon runs as a transient systemd --user unit, with render/start/stop/status scripts. An optional site file overrides env.sh.
  6. comfyui: tools/comfyui/worker.py. A generic, stdlib-only cmd worker that serves image/video tools through ComfyUI.
    • It starts its own ComfyUI (or uses a running one) and fills an API-format workflow through explicit bindings.
    • It reports progress from /ws, fetches outputs via /view, and supports cancel via SIGUSR1.
    • Fields a workflow can't honour are refused, not ignored.
    • options.modes.image_edit / image_to_video give requests with input images their own workflow and bindings. References, an optional mask, and a first frame are uploaded to ComfyUI and wired in through added LoadImage nodes (IMAGE, or MASK for a mask).
    • image_edit may set defaults and an unmasked overlay (workflow, bindings, defaults) used when a request has input images but no mask; request fields (size, steps, guidance) still override. Masked / local edits keep the tool's fast defaults.
    • Also adds default_width/default_height options in engine.fill, so a cmd video tool can declare its own size (with a unit test). Includes a fake-ComfyUI test (29 checks).
  7. deploy/strix-halo: MiniMax H3 and H3-Image through ComfyUI. Workflows and opt-in tools (minimax-h3 text/image-to-video with audio, minimax-h3-image text-to-image and edits, including an optional mask).
    • Both are booked at the whole budget, because ComfyUI stages weights in host RAM, which on an APU is the same memory but isn't counted in GTT. The scheduler therefore unloads chat and voice first, and the voice models come back after the job.
    • Edits auto-select by whether a mask is supplied: masked / local edits stay on the fast path (Q4_K_M, about 1 MP, 6 steps, cfg 1.0); whole-scene edits (no mask) use Q8_0 at about 2 MP (1440x1440 when square) and 30 steps, cfg 1.0. A request may still set size, steps or guidance.
    • Licence note: both MiniMax Community Licenses exclude the US, EU, UK and South Korea. The tools are opt-in: the profile's minimax model requires --accept. The README opens that section with a note, and the tools' license fields list the excluded regions. Happy to leave the MiniMax commits out if you'd rather not ship them.
  8. deploy/strix-halo: ComfyUI auto-install. comfyui/install.sh (the profile's minimax model: steps comfyui and weights) installs, without sudo and idempotently, pinned ComfyUI + ComfyUI-GGUF, a Python 3.13 venv with PyTorch ROCm 7.2, the H3-Image GGUF loader node, and pinned weights linked into ComfyUI/models (Q4_K_M and Q8_0 for H3-Image). A checkout with local changes is left alone. COMFY_HF=DIR reuses an existing download. The MiniMax download is still behind --accept.

Tested on gfx1151 (Radeon 8060S, 96 GiB GTT, ROCm 7.2.4, Podman 6.1 with runc)

  • zig build -Doptimize=ReleaseSafe OK (no -Dnvcc); zig build test 33/33 steps, 72/72 tests passed; openai_audio test 8/8; comfyui test 29/29 against a fake ComfyUI.
  • /v1/chat/completions (Flash-Next Q4 via Gufo): 17.5 s cold load, 56 tokens in 1.69 s, streaming OK.
  • /v1/audio/speech (Qwen3-TTS, streamed PCM): 226 ms to first audio, about 2.4× real time.
  • /v1/audio/transcriptions: Qwen3-ASR 2.4 s cold, 0.58 s warm. Whisper large-v3-turbo on ROCm 9.8 s cold, 0.52 s warm; WER 4.09% on 73 LibriSpeech dev-clean clips at 17× real time.
  • Voice loop over /v1/realtime (voice_e2e.py --smoke --skip-barge, chat on the Q3 tool): passed all 11 checks. First audio 1217 / 1376 ms on warm turns; a 42.6 s spoken reply with 0 underruns.
  • MiniMax via ComfyUI, with chat + TTS + ASR loaded beforehand (all three unloaded in about 2 s):
    • H3-Image 1024x1024: 47.4 s, GTT peak 29.6 GiB.
    • H3 512x288, 2 s with AAC audio: 56.0 s, GTT peak 36.1 GiB.
    • H3-Image edit, 1024x1024 input (no size). Masked (Q4_K_M, about 1 MP, 6 steps, cfg 1.0): 104–111 s, GTT peak 30.7 GiB. With a mask, the change lands inside it and the outside matches the input. Whole-scene (Q8_0, about 2 MP, 30 steps, cfg 1.0): a rain-to-snow restyle was convincing (falling snow, a white street, snow on rooftops and signs, neon and the figure kept) in 384 s, GTT peak 37.2 GiB. At 1 MP, neither Q8_0 nor 30 steps was enough (the street stayed wet).
    • H3 image-to-video, 512x288, 2 s: 64.7 s, GTT peak 41.0 GiB; the first frame is the input's centre crop, then the scene moves as asked, with sound.
    • Outputs carry LocalRouter's machine-generated label.

Known gaps

  • Barge-in in the voice loop is untested (the smoke run used --skip-barge).
  • doctor.sh reports zig/uv and the Whisper venv/model as missing when they're installed outside the profile's $J prefix (site-specific paths).
  • A MiniMax request with a size off its 32-px grid is refused only after ComfyUI loads, since the check is in the worker.
  • Not wired: H3's last frame (last_frame), and H3-Image's prompt expansion. ComfyUI's own H3-Image template still scales to about 4 MP and expands the prompt with a separate LLM; we locked in 2 MP / 30 steps as the whole-scene default because it was enough on this box.
  • The compiled-in CUDA engines (Qwen-Image, MiniMax H3, Kandinsky-6) don't run on AMD, which is why the ComfyUI path exists.

Thanks for localrouter. Any feedback welcome, and we can rework or split as you prefer.

lib.sh: when nvidia-smi sees no GPU, hw_gpu/hw_driver/hw_vram/hw_summary read the
first amdgpu card (sysfs) and rocminfo (marketing name, gfx target), hw_rocm the ROCm
version, hw_gtt/hw_gtt_used the GTT pool an APU's GPU maps. hw_match gains optional
hardware.min_rocm, hardware.gfx and hardware.min_gtt_gib. The NVIDIA and macOS paths
are unchanged.

doctor.sh: the free-memory warning reads hardware.min_free_gib (default 88, as before)
and, on AMD, shows GTT in use and AMD-side hints; a deploy.service of
"systemd-transient" (systemd-run --user) is checked by is-active instead of a unit file.
…rver

tools/speech/openai_audio/worker.py serves speech (POST /v1/audio/speech, raw PCM
streamed into speech.wav) and transcription (POST /v1/audio/transcriptions ->
transcript.json) through a model's own server, which it starts from options.server
({port}, {id}, {weights}) and stops on exit, as openai_server does for chat; or an
existing options.url. Standard library only. Server 4xx -> invalid_request_error,
503/unreachable -> service_unavailable; 64-bit seeds are folded to 32 bits.
test_worker.py runs it against a fake server (no GPU).
tools/speech/whisper/rocm/{pyproject.toml,uv.lock}: the same worker and pins as the
Spark, with torch and triton-rocm from PyTorch's ROCm 7.2 index for x86_64 Linux AMD
GPUs. The existing lock is untouched. Measured on gfx1151: WER 4.09% on 73
LibriSpeech clips, 17x real time.
serve.sh NAME PORT [podman opts] -- gufo serve ...: foreground, loopback-only, stops
the container on SIGTERM and waits so GPU memory is free; --replace clears leftovers;
video/render groups by name (keep-groups needs crun).
AMD Strix Halo (Radeon 8060S, gfx1151, 96 GiB GTT): Qwen3.8 Flash-Next chat via Gufo
(Q4 + MTP) and llama.cpp (Q3 + MTP) as openai_server tools, Qwen3-TTS and Qwen3-ASR via
Gufo behind openai_audio, Whisper on ROCm. budget_bytes = GTT less 2 GiB. The daemon
runs as a transient systemd user unit (render/start/stop/status.sh); site files
override env.sh. Tested end to end: /v1 chat, /v1/audio, and the voice loop
(voice_e2e.py --smoke) passing with 1.2-1.4 s first audio on warm turns.
tools/comfyui/worker.py starts its own ComfyUI (options.comfy_dir/python/args/env,
loopback, a private output directory) or uses options.url, fills an API-format
workflow from the request through explicit bindings (node.input), queues it,
reports progress from /ws, waits on /history and fetches 0.png.. or video.mp4
through /view. Unbound fields (negative prompt, steps, guidance), edits and
image-to-video are refused, never ignored; sizes, frame grids (frame_multiple /
frame_offset) and fps are checked; audio off removes a bound input. Cancel is
SIGUSR1 (/queue delete + /interrupt), and the worker stays loaded. Standard
library only; test_worker.py runs it against a fake ComfyUI (16 checks).

engine.fill: a video tool's options may name default_width/default_height for
requests without a size (a cmd model's own size); else 1344x768 as before.
Two workflows (comfyui/minimax-h3-t2va.json: int8 DiT + 4-step turbo LoRA, video
with audio; comfyui/minimax-h3-image-t2i.json: Q4_K_M GGUF, 6 steps) served by
tools/comfyui as minimax-h3 (text_to_video, 512x288 default, 17k+5 frames at 24
fps) and minimax-h3-image (text_to_image) on their own ComfyUI ports. Both are
booked at the whole GTT budget: ComfyUI stages weights in host RAM, the same
memory on this APU, which the GTT budget does not count, so every other model
is unloaded first and the voice models return after the job. Licences carry
the excluded regions. Tested through /v1/images/generations and /v1/videos.

The README opens the MiniMax section with a licence note: both Community Licenses
exclude the United States, the EU, the UK and South Korea; the tools are opt-in
examples.
options.modes.image_edit / image_to_video give requests with input images
their own workflow and bindings, merged over the tool's. references, mask
and first_frame are uploaded to ComfyUI (/upload/image, into the worker's
private input directory, cleaned per job) and wired in through added
LoadImage nodes (IMAGE, or MASK for a mask). Requests a tool cannot honour
are still refused. Tests: 24 checks against a fake ComfyUI.
…ideo

comfyui/install.sh (profile model 'minimax', needs --accept for the MiniMax
licences): pinned ComfyUI + ComfyUI-GGUF, a Python 3.13 venv with PyTorch
ROCm 7.2, the H3-Image GGUF loader node, and pinned weights linked into
ComfyUI/models; idempotent, no sudo. minimax-h3-image gains image_edit
(minimax-h3-image-edit.json: up to 5 images, optional mask composited back),
minimax-h3 gains image_to_video (first frame). README: install, measurements
on gfx1151, licence note.
@smfworks

Copy link
Copy Markdown
Contributor Author

Hi Jay — following up on the gaps I mentioned in the original description.

I've pushed two more commits onto this PR:

  • 2fca516 comfyui: edits and image to video: modes and input images
  • d8105b3 deploy/strix-halo: ComfyUI install step, MiniMax edits and image to video

The profile now has an automatic ComfyUI install (deploy/strix-halo/comfyui/install.sh, idempotent, no sudo). The MiniMax weights stay opt-in: the profile's minimax model needs --accept, and the README notes that both Community Licenses exclude the US, EU, UK and South Korea. minimax-h3-image can do edits (including a masked edit), and minimax-h3 can do image-to-video from a first frame.

Re-tested on gfx1151: zig build OK, zig build test 33/33 steps and 72/72 tests passed, and python3 -I tools/comfyui/test_worker.py 24/24 against a fake ComfyUI. One measured caveat, also in the README: at the fast settings (Q4, ~1 MP, 6 steps) whole-scene restyles come out weak; masked edits land correctly.

Happy to split or drop any of this if you'd rather take it separately.

image_edit may set defaults and an unmasked overlay (workflow, bindings,
defaults) used when a request has input images but no mask; request fields
still override. Masked edits keep the tool's fast defaults.

deploy/strix-halo: whole-scene H3-Image edits use Q8_0 at about 2 MP and
30 steps (cfg 1.0); masked edits stay Q4_K_M, 1 MP, 6 steps. install.sh
fetches the Q8_0 GGUF (still behind --accept). README: rain-to-snow
comparison on gfx1151 (384 s, GTT peak 37.2 GiB). Tests cover the
auto-select and overrides (29 checks).
@jayleaton

Copy link
Copy Markdown
Owner

Thanks for this, @smfworks, and for the detailed hardware results and the offer to split. We reviewed 944f585a1. Your three newer commits (ComfyUI edits and image-to-video, up to 8493bb772) arrived during the review and aren't covered yet.

The existing NVIDIA and macOS paths look preserved: min_free_gib still defaults to 88, the transient-service branch is opt-in, and we found no new failure path on hosts without an AMD GPU. Gufo publishes only 127.0.0.1:PORT, and there's no curl|sh, no committed secrets and no telemetry in the diff. We didn't audit the third-party image's contents. New files stay under the 600-line convention. The Zig change is narrow: engine defaults keep precedence, and the fallback has a unit test.

These need fixing before we can merge:

  • Unhashed Torch wheel (tools/speech/whisper/rocm/uv.lock:384). The Torch wheel has no SHA-256. Its version and source are fixed, but its contents aren't verified. Please add the wheel's hash, and a check that rejects unhashed artifacts.
  • Unpinned image and model downloads (tools/gufo/serve.sh:17, deploy/profiles/strix-halo-gfx1151.json:162). Gufo defaults to the mutable ghcr.io/gufo-org/toolboxes/gufo-runtime:latest. The Hugging Face downloads have no revisions and only check that the files exist, so two clean installs can get different artifacts. Please pin the image by digest and the models by revision, and verify file integrity.
  • GUFO_IMAGE not reaching the workers (deploy/strix-halo/start.sh:12). The transient service gets only PATH and HOME, so an exported GUFO_IMAGE override doesn't reach the workers. Bootstrap can pull the pinned image while the workers start latest. Please pass the chosen image into the unit, and add a test that it gets through.
  • Ignored transcription options (tools/speech/openai_audio/worker.py:263). Transcription silently replaces the requested temperature with 0 and ignores timestamp granularity: a temperature=0.7, timestamps=word request succeeds with no words. Please forward the supported options, request the matching response format, and reject unsupported timestamp requests explicitly. Please also add tests, since the current 8 don't cover this.
  • GPU diagnostic runs under --no-gpu (deploy/profiles/strix-halo-gfx1151.json:137). gufo diagnose uses the GPU devices but isn't marked gpu: true, so --no-gpu still runs it. Please split the image download from the diagnostic, and mark the diagnostic as a GPU step.
  • Nit: new tests and scripts missing from CI (.github/workflows/ci.yml:20). Please add the new Python test suites and the Strix/Gufo scripts to CI. Right now the suites aren't run, and the shell syntax check skips those scripts.

On splitting: yes please, since the newer commits make this even broader. A shape that would review well:

  1. AMD detection and doctor, with regression fixtures.
  2. The generic openai_audio worker.
  3. ROCm Whisper, pinned Gufo and the Strix deployment.
  4. The generic ComfyUI worker and the Zig size options.
  5. The MiniMax workflows and examples.

Locally, everything in scope passed: the Zig build (10/10), host unit checks (26/26), audio (8/8), ComfyUI (16/16), the syntax checks and the whitespace check. CI is waiting on first-time-contributor approval, and we'll approve it on the split PRs.

@smfworks

smfworks commented Nov 16, 2026 via email

Copy link
Copy Markdown
Contributor Author

@smfworks

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review, @jayleaton. I've split this into the five PRs you suggested, and each one also covers the newer commits (ComfyUI edits and image to video, up to 8493bb7):

  1. install: detect AMD GPUs (amdgpu, ROCm, GTT) with regression fixtures #153 AMD detection and doctor, with regression fixtures
  2. speech: openai_audio, a cmd worker for any OpenAI-compatible audio server #154 the generic openai_audio worker
  3. strix-halo: ROCm Whisper, pinned Gufo and the gfx1151 deployment #155 ROCm Whisper, pinned Gufo and the Strix deployment (stacks on install: detect AMD GPUs (amdgpu, ROCm, GTT) with regression fixtures #153 and merges speech: openai_audio, a cmd worker for any OpenAI-compatible audio server #154)
  4. comfyui: a cmd worker for image and video tools, and engine size options #156 the generic ComfyUI worker and the Zig size options
  5. strix-halo: MiniMax H3 / H3-Image workflows through ComfyUI #157 the MiniMax workflows and examples (stacks on strix-halo: ROCm Whisper, pinned Gufo and the gfx1151 deployment #155 and merges comfyui: a cmd worker for image and video tools, and engine size options #156)

Every review item is addressed:

Locally, every branch passes zig build test, zig build test-unit (26/26), the syntax and whitespace checks, and the suites in its scope.

This PR can be closed in favor of #153–#157.

@jayleaton

Copy link
Copy Markdown
Owner

Thanks @smfworks, the split is exactly what we hoped for. I'm closing this one in favour of #153–#157, which cover everything here plus the newer ComfyUI commits. I've approved CI on all five, and the review will happen on each of them.

@jayleaton jayleaton closed this Nov 16, 2026
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.

AMD Strix Halo (gfx1151 / ROCm) support: interested in a PR?

2 participants