Skip to content

Add a Linux ROCm leg to the prebuilt pipeline, so AMD hosts stop landing on the CPU build - #5

Open
oobabooga wants to merge 5 commits into
masterfrom
prebuilt-amd-legs
Open

oobabooga wants to merge 5 commits into
masterfrom
prebuilt-amd-legs

Conversation

@oobabooga

@oobabooga oobabooga commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Studio's MiniMax-H3 GGUF path asks this mirror for an sd-cli built for rocm. The latest release has none: macOS, Linux CPU, Linux CUDA, Linux aarch64, Windows CPU. So the installer falls back to leejet's upstream ROCm build, which doesn't carry the H3 fixes in this repo, and when that binary doesn't list a GPU, video.py drops to the CPU build.

That's unslothai/unsloth#8814:

Minimax H3 won't run on AMD card using Linux

7900 XTX on CachyOS, H3 goes installed to load_failed within a second. A Discord report this week on the same card and distro is the other shape of it: H3 Q3_K fills 30 GB of RAM and 36 GB of swap while VRAM sits at 1.5 GB.

What this adds

A build-linux-rocm leg in unsloth-sd-prebuilt.yml, same rule as the CUDA leg: continue-on-error, not in the coverage gate, so it can never hold back the CPU, Apple and Vulkan assets. The Linux and Windows Vulkan legs this PR first added came to master with unslothai#22, so they were dropped when master was merged in.

leg runner asset
build-linux-rocm ubuntu-24.04 Linux-Ubuntu-24.04-x86_64-rocm-7.14.0
  • The leg builds against TheRock 7.14.0 wheels like upstream's build.yml, for 20 consumer targets (gfx1010 to gfx1201, including the gfx1150 to gfx1153 APUs), and ships the ROCm userspace it linked against: every library ldd resolves from the wheel tree, rocBLAS / hipBLASLt kernel trees, and the per-target .kpack archives the kpack-split libraries load. The binaries get rpath $ORIGIN/lib, the libraries $ORIGIN, and the leg fails if anything is still unresolved with the wheel tree hidden. Upstream's zip doesn't bundle the runtime, so it only runs on a host with a matching ROCm, which is the #8814 failure.
  • package_bundle.py gains KEEP_LAYOUT=1, which ships the staged tree as is (sd-cli, sd-server, lib/, .kpack/); the other legs still land flat.
  • src/model_manager.cpp: a device whose free-memory report exceeds its total was treated as Vulkan's budget underflow and given 0 bytes. On a ROCm integrated GPU (Strix Halo) ggml reports free memory from /proc/meminfo and total from hipMemGetInfo, so free is above total and every allocation was refused: every render aborted. That rejection now applies to Vulkan only, as upstream did in fix: handle GPU memory reports and LLM encoding failures leejet/stable-diffusion.cpp#2020, and a failed LLM prompt encode returns an error instead of aborting (the same upstream change).

Asset names are what Studio's resolve_release_asset already matches for rocm, so a ROCm host picks this up with no Studio change. Not here: Windows ROCm.

Validation

what result
the leg, run as written on a GitHub-hosted ubuntu-24.04 runner builds, bundles 21 ROCm libraries and 20 kpack archives, ldd gate passes; zip 1802 MiB (GitHub's per-asset limit is 2 GiB)
the bundle on a Strix Halo (gfx1151) host with ROCm 7.2.1 installed Z-Image 1024x1024 and MiniMax-H3 640x384x56 render on the GPU; the only file it maps from /opt/rocm is the optional libhsa-amd-aqlprofile64
the bundle in a clean ubuntu:24.04 container with no ROCm (only /dev/kfd, /dev/dri) both render on the GPU (the #8814 case)
upstream's ROCm zip that Studio falls back to today, same host renders, but loads HIP, hipBLAS, rocBLAS and the HSA runtime from the system ROCm
this tree without the model_manager.cpp change on gfx1151 every render aborts (available 0.00 MB device)
merged with the open MiniMax-H3 stack and unslothai#21 merges cleanly; the combined tree builds and renders on HIP, Vulkan and CUDA

Not run: a discrete AMD GPU (only the gfx1151 APU was available).

LeoBorcherding and others added 2 commits September 11, 2026 12:23
# Conflicts:
#	.github/workflows/unsloth-sd-prebuilt.yml
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 8, 2026
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 8, 2026
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 8, 2026
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 8, 2026
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 8, 2026
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 8, 2026
@oobabooga

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 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-09T19:03:38.090012Z 68136c0 Manual request
ℹ️ 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.

@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: 6aa1e903c3

ℹ️ 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".

cp -r "$ROCM_PATH/lib/hipblaslt/library" "$BIN/hipblaslt/"
fi
for f in "$BIN"/sd-cli "$BIN"/sd-server "$BIN"/*.so*; do
[ -f "$f" ] && patchelf --set-rpath '$ORIGIN' "$f"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use TheRock's patched patchelf for ROCm libraries

On this Ubuntu runner, this invokes the stock patchelf installed by apt above on every copied TheRock shared object. TheRock documents that released patchelf versions through 0.18.0 corrupt the PHDR of kpack-split ELF libraries and specifically requires Ubuntu users to install its patched build. The following validation only greps for not found, so an ldd loader error caused by that corruption takes the false branch and the broken ZIP can still be uploaded; use the pinned patched tool or avoid rewriting the affected libraries.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Not reproducible here. The PHDR bug needs patchelf to grow and relocate the program headers; every rewrite in this step shrinks the RPATH to $ORIGIN or $ORIGIN/lib, which patchelf does in place. With stock patchelf 0.18.0 on every library in the 7.14.0 libraries wheel, including the kpack-split ones whose PHDR is in a trailing LOAD (librocblas, librccl, librocsolver, ...), the PHDR address is unchanged, readelf reports no errors, and the patched librocblas dlopens and resolves its whole closure from the bundle.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: d2ae8f84e6

ℹ️ 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".

@oobabooga oobabooga changed the title Add Linux ROCm and Vulkan legs to the prebuilt pipeline, so AMD hosts stop landing on the CPU build Add a Linux ROCm leg to the prebuilt pipeline, so AMD hosts stop landing on the CPU build Oct 9, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 68136c0934

ℹ️ 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".

Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 9, 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.

3 participants