-
Notifications
You must be signed in to change notification settings - Fork 177
Add ROCm GPU backend support for stable-diffusion.cpp #980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
makn87amd
commented
Jan 29, 2026
- Add sdcpp_backend option with --sdcpp CLI flag and LEMONADE_SDCPP env var
- Support 'cpu' (default) and 'rocm' backends for sd.cpp
- Download ROCm-enabled sd.cpp binaries for AMD GPU acceleration
- Add backend-specific versioning in backend_versions.json
- Set PATH for ROCm DLLs on Windows for HIP runtime loading
- Add api_image_gen_rocm.py example demonstrating ROCm image generation
- Fix example script to use correct API parameters (model_name, model)
- Add sdcpp_backend option with --sdcpp CLI flag and LEMONADE_SDCPP env var - Support 'cpu' (default) and 'rocm' backends for sd.cpp - Download ROCm-enabled sd.cpp binaries for AMD GPU acceleration - Add backend-specific versioning in backend_versions.json - Set PATH for ROCm DLLs on Windows for HIP runtime loading - Add api_image_gen_rocm.py example demonstrating ROCm image generation - Fix example script to use correct API parameters (model_name, model)
|
The example needs to be pruned. It was auto-generated and has a ton of helper functions |
| {"ctx_size", 4096}, | ||
| {"llamacpp_backend", "vulkan"}, | ||
| {"llamacpp_args", ""}, | ||
| {"sdcpp_backend", "cpu"}, // ADDED: sd.cpp backend selection (cpu or rocm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty noisy/pointless comment, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look @superm1, but the PR is still in draft state. I would expect @makn87amd to clean up on his own prior to marking Ready for Review.
| {"envname", "LEMONADE_LLAMACPP_ARGS"}, | ||
| {"help", "Custom arguments to pass to llama-server (must not conflict with managed args)"} | ||
| }}, | ||
| // ADDED: sd.cpp backend selection option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty noisy/pointless comment, no?
| return {"ctx_size"}; | ||
| } else if (recipe == "sd-cpp") { | ||
| return {"steps", "cfg_scale", "width", "height"}; | ||
| // ADDED: Include sdcpp_backend for backend selection (cpu vs rocm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty noisy/pointless comment, no?
| } else if (model_info.recipe == "sd-cpp") { | ||
| std::cout << "[Router] Creating SDServer backend" << std::endl; | ||
| new_server = std::make_unique<backends::SDServer>(log_level_, model_manager_); | ||
| // ADDED: Pass sdcpp_backend from default_options_ to SDServer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty noisy/pointless comment, no?
| {"option_name", "sdcpp_backend"}, | ||
| {"type_name", "BACKEND"}, | ||
| {"allowed_values", {"cpu", "rocm"}}, | ||
| {"envname", "LEMONADE_SDCPP"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add this new environment variable to data/lemonade.conf
| // macOS ARM build | ||
| filename = "sd-" + short_version + "-bin-Darwin-macOS-15.7.2-arm64.zip"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this actually going to be published initially? I feel like this should be in the #else block
| // Helper to get the install directory for sd executable | ||
| static std::string get_sd_install_dir() { | ||
| return (fs::path(get_downloaded_bin_dir()) / "sd-cpp").string(); | ||
| // ADDED: Include backend subdirectory to support multiple backends |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noisy comment
|
|
||
| // Helper to get stable-diffusion.cpp version from configuration | ||
| static std::string get_sd_version() { | ||
| // ADDED: Support for backend-specific versions (cpu vs rocm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noisy comment