my-server
← Back to Blog

High-Performance Local Image and Video Generation on AMD Strix Halo and Kubernetes

Executive Summary and Technical Overview

Local AI inference has transitioned from a niche developer interest to a primary requirement for enterprise data privacy, cost predictability, and system autonomy.1 The development of highly optimized C++ frameworks has enabled standard consumer and workstation hardware to run large-scale diffusion models that previously required enterprise data center accelerators.2
The AMD Strix Halo platform, represented by the Ryzen AI Max+ 395, introduces a paradigm shift in local compute by leveraging a massive unified memory architecture.3 Featuring an integrated Radeon 8060S GPU (built on the RDNA 3.5 architecture) and up to 128 GB of shared LPDDR5-8000 memory, this system circumvents the physical VRAM limitations that traditional discrete consumer GPUs face when handling state-of-the-art diffusion models.2
To deploy this hardware within an automated, containerized environment, systems architects can pair the optimized execution capabilities of stable-diffusion.cpp with the orchestration scaling of Kubernetes. By wrapping the C++ generation engine in an OpenAI-compatible REST API, developers can create a drop-in replacement for cloud APIs like DALL-E 3 or FLUX.1 web endpoints. This setup integrates seamlessly with routing layers like LiteLLM, allowing downstream applications to request local generations dynamically.

User RequirementTechnical ImplementationOperational Nuance & Mitigation
Local Image/Video Enginestable-diffusion.cpp compiled via GGML 2Compiles with Vulkan (Mesa RADV) to bypass ROCm regressions.3
Silicon-Level OptimizationAMD Ryzen AI Max+ 395Pinned 96 GB VRAM configuration utilizing Vulkan.3
Containerization & OrchestrationKubernetes Pod running customized Alpine/UbuntuDeployed via DaemonSet with direct /dev/dri and /dev/kfd access.
OpenAI/LiteLLM Integrationsd-server / LocalAI wrapping stable-diffusion.cppExposes /v1/images/generations natively for containerized microservices.

The Local Image and Video Generation Landscape

Image and video generation has shifted from heavy PyTorch runtimes to optimized, native compilation models. At the forefront of this movement is stable-diffusion.cpp, a C++ framework built on the ggml backend. Just as llama.cpp revolutionized the local deployment of LLMs, stable-diffusion.cpp allows consumer and edge hardware to run massive diffusion structures with zero Python dependencies.

Model Support and Quantitative Optimization

The framework is actively developed and supports a broad array of generative models.2 In addition to legacy architectures like Stable Diffusion 1.5, 2.1, and SDXL, the engine natively executes high-parameter models such as FLUX.1-dev, FLUX.1-schnell, and FLUX.2-dev.2
Furthermore, stable-diffusion.cpp has incorporated localized video synthesis, supporting advanced architectures like Wan2.1, Wan2.2, and LTX-2.3.2 This brings video generation—previously restricted to high-end cloud instances—directly to the local workspace.
The underlying system utilizes GGUF quantization formats to shrink model footprints. For example, the 12-billion parameter FLUX.1-schnell model can be run at various quantization levels 4:

This means that with a massive 96 GB VRAM allocation, high-fidelity image models can be pinned entirely within the iGPU's active cache without swapping to disk or overflowing system memory barriers.
To accelerate performance, stable-diffusion.cpp integrates Winograd's fast convolution algorithms.5 By analyzing the dependent and independent calculation graphs of 2D convolutions, the framework reduces the mathematical complexity of floating-point operations.5 This optimization yields up to a 2.76-fold acceleration for individual convolution layers and up to a 4.79-fold speedup for the overall image generation process compared to baseline configurations.5

Exposing an OpenAI-Compatible API Layer

To make local generation a drop-in replacement for hosted cloud providers, the backend must expose an OpenAI-compatible REST API. Under this paradigm, upstream routers (like LiteLLM or custom API gateways) can redirect standard payloads originally designed for OpenAI to your local cluster.

API Shape Analysis: Chat Completions vs. Image Generations

Understanding the difference in payload and response schemas between standard text/chat completions and image generation is critical when mapping to a C++ engine like stable-diffusion.cpp.

AspectChat Completions (/v1/chat/completions)Image Generations (/v1/images/generations)
Core InputA sequential array of message objects (messages) capturing the dialogue history.1A single descriptive string (prompt).
Output TypeText or token stream (using Server-Sent Events).1Base64-encoded image string (b64_json).
SizingToken counts controlled by max_tokens.7Pixel dimensions specified by size (e.g., "1024x1024").
Hyperparameterstemperature, top_p, presence_penalty.1Diffusion-specific fields (steps, cfg_scale, sampler_name, seed).

1. Chat Completion API Payload

The standard chat completions payload expects structured conversational turns 1:

JSON
{
"model": "qwen3:8b",
"messages": [
{
"role": "user",
"content": "Generate a highly detailed prompt for a cybernetic landscape."
}
],
"temperature": 0.7
}

The response contains the text nested under choices.message.content.1

2. Standard Image Generation API Payload

In contrast, the standard OpenAI images endpoint expects a flat, single-prompt instruction 1:

JSON
{
"model": "flux",
"prompt": "A cybernetic landscape with glowing fiber-optic trees",
"size": "1024x1024",
"response_format": "b64_json"
}

The non-streaming response returns a flat structure containing the raw data list:

JSON
{
"created": 1716940000,
"data":
}

Mapping to stable-diffusion.cpp (sd-server)

The compiled sd-server binary exposes an OpenAI-compatible endpoint at /v1/images/generations. However, because the standard OpenAI specification lacks native fields for essential diffusion parameters (such as steps, seed, sampler_name, or cfg_scale), sd-server implements a unique workaround to prevent upstream routers or strict JSON schemas from discarding these values.

The Prompt-Embedded Arguments Workaround (<sd_cpp_extra_args>)

To pass execution parameters without violating standard OpenAPI schema validation (which occurs in gateways like LiteLLM), sd-server parses a special JSON-encoded metadata string embedded directly inside the prompt field.
An API request to your local sd-server with custom settings should look like this:

JSON
{
"model": "flux",
"prompt": "A cybernetic landscape with glowing fiber-optic trees<sd_cpp_extra_args>{\"seed\": 440103671, \"steps\": 20, \"cfg_scale\": 1.0, \"sampling_method\": \"euler\"}</sd_cpp_extra_args>",
"n": 1,
"size": "1024x1024",
"response_format": "b64_json"
}

Containerized API Deployment Manifest

An optimized deployment manifest for running LocalAI with Vulkan acceleration and a local storage mount for GGUF model files is structured as follows:

YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: local-ai-diffusion
namespace: generative-ai
spec:
replicas: 1
selector:
matchLabels:
app: local-ai-diffusion
template:
metadata:
labels:
app: local-ai-diffusion
spec:
nodeSelector:
accelerator: amd-strix-halo
containers:
- name: local-ai-container
image: localai/localai:latest
env:
- name: MODELS_PATH
value: /models
- name: BACKEND_ASSETS_PATH
value: /tmp
- name: REBUILD
value: "false"
- name: THREADS
value: "16" # Align with the 16 execution cores of the 395 APU
resources:
limits:
amd.com/gpu: "1"
memory: 64Gi
requests:
amd.com/gpu: "1"
memory: 32Gi
volumeMounts:
- name: model-storage
mountPath: /models
- name: dev-dri
mountPath: /dev/dri
- name: dev-kfd
mountPath: /dev/kfd
volumes:
- name: model-storage
persistentVolumeClaim:
claimName: local-ai-model-pvc
- name: dev-dri
hostPath:
path: /dev/dri
- name: dev-kfd
hostPath:
path: /dev/kfd

Once deployed, the Kubernetes service is registered with the cluster's ingress controller or mapped directly into LiteLLM. The underlying engine executes the model's diffusion steps on the RDNA 3.5 compute units, utilizing the Vulkan-managed unified memory.2 The resulting image is encoded into a Base64 string and returned as a standard JSON payload, mimicking the cloud API response format.

Production Best Practices and Actionable Recommendations

To ensure maximum performance and system stability when deploying local image and video generation on this platform, the following deployment steps are highly recommended:

  1. Deploy the Kubernetes AMD Device Plugin: Run the official ROCm Kubernetes device plugin as a privileged DaemonSet on nodes with the amd-strix-halo label. This registers the integrated GPU as a schedulable amd.com/gpu resource.8 Ensure the container runtime mounts /dev/kfd and /dev/dri into container namespaces with write permissions.
  2. Use the Vulkan (RADV) Driver Pipeline: Avoid the ROCm 7.x driver path for image generation, as it suffers from performance regressions and memory access faults on Strix Halo APUs.2 Compile stable-diffusion.cpp using the Vulkan backend to ensure system stability and achieve peak prompt processing speeds of ~881 t/s.2
  3. Embed Parameters in Prompts for Gateways: When routing requests through strict API proxies like LiteLLM, avoid adding non-standard keys to the JSON root body. Instead, package parameters like steps, seed, and sampler_name inside the <sd_cpp_extra_args>{"seed":123}</sd_cpp_extra_args> wrapper block in the prompt string.
  4. Pin Large Models in Memory: With 96 GB VRAM available, load and keep text encoders and diffusion models fully inside VRAM. Avoid aggressive on-the-fly component unloading unless running multiple workflows simultaneously, as model reloading incurs a performance penalty.

Works cited

  1. OpenAI compatibility - Ollama's documentation, accessed May 30, 2026, https://docs.ollama.com/api/openai-compatibility
  2. leejet/stable-diffusion.cpp: Diffusion model(SD,Flux,Wan ... - GitHub, accessed May 30, 2026, https://github.com/leejet/stable-diffusion.cpp
  3. spike: AMD ROCm support — Ryzen AI Max 395 (Strix Halo ... - GitHub, accessed May 30, 2026, https://github.com/Foxlight-Foundation/Skulk/issues/144
  4. leejet/FLUX.1-schnell-gguf - Hugging Face, accessed May 30, 2026, https://huggingface.co/leejet/FLUX.1-schnell-gguf
  5. Open-Source Acceleration of Stable-Diffusion.cpp - arXiv, accessed May 30, 2026, https://arxiv.org/html/2412.05781v1
  6. Deep Dive: Setting Up AMD iGPU Passthrough in Harvester | by Davide Ruti | Medium, accessed May 30, 2026, https://medium.com/@davide.ruti/part-2-deep-dive-setting-up-amd-igpu-passthrough-in-harvester-778546c26386
  7. hekmon/comfyui-openai-api - GitHub, accessed May 30, 2026, https://github.com/hekmon/comfyui-openai-api
  8. AMD GPU Device Plugin for Kubernetes - Instinct™ Docs, accessed May 30, 2026, https://instinct.docs.amd.com/projects/k8s-device-plugin/en/latest/
  9. Rocm support for AMD Ryzen AI MAX+ Pro 395 - GFX1151 · Issue ..., accessed May 30, 2026, https://github.com/lmstudio-ai/lmstudio-bug-tracker/issues/1502