Skip to content

About

Real-ESRGAN x2/x4 upscaling as a Gufo extension (HIP, Strix Halo, Windows)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

upscale-gufo-extension

Real-ESRGAN image upscaling (x2 / x4) as a Gufo extension. It runs the compact Real-ESRGAN models (SRVGGNetCompact: realesr-animevideov3, realesr-general-x4v3, realesr-general-wdn-x4v3) natively on HIP, to bring generated images and video frames to a delivery size such as 1920x1088. The target is AMD Strix Halo (gfx1151) on Windows; the manifest lists only windows until Linux has been tested (the sources have no Windows-only code, and Linux build notes are below).

Status: GPU validated on Strix Halo (Windows), 2026-11-12. Installed as a module with gufo extension install into upstream Gufo main 0d238d4f, x2 and x4 outputs are bit-identical to the in-tree upscaler of gufo-studio-windows. Open items (PyTorch reference, full HTTP suite, Linux) are listed in CONFORMANCE.md.

Item Value
Registry name upscale (provider ID realesrgan)
Maintainer @D3rPapts
Extension API >= 0.3.0 (built against Gufo main 0d238d4f, API 0.3.4)
Platforms windows (Strix Halo gfx1151); Linux untested, not claimed
Capability image_generation, reference-image edits only (POST /v1/images/edits)
Weights Real-ESRGAN v0.2.5.0 .pth, converted to FP32 safetensors (not bundled)
License MIT (this code); Real-ESRGAN architecture and weights BSD-3-Clause (see NOTICE)

The HIP upscaler, the host helpers and the weight check come from gufo-studio-windows, where they ship inside gufo serve upscale and gufo video-upscale. The ImageRunner glue for Gufo's image capability is new in this repository.

Install

Once a release is listed in the Gufo extension registry:

gufo extension install upscale

Before that, from a checkout or a pinned commit:

gufo extension install ./upscale-gufo-extension
gufo extension install https://github.com/D3rPapts/upscale-gufo-extension@<commit> --yes

Modules are compiled on install, so they need the Gufo SDK and the same compiler / ROCm as the Gufo binary. After a Gufo update run gufo extension update. On Windows a module is a DLL that loads only into gufo.exe.

Build with Gufo

Linux (CMake, untested)

Add "linux" to platforms in extension.json first; Gufo refuses an extension on a platform its manifest does not list.

cmake --preset release -DGUFO_EXTENSION_DIRS=/absolute/path/to/upscale-gufo-extension
cmake --build --preset release --parallel 4
./build/release/gufo diagnose --section extensions

Windows (clang-cl, TheRock ROCm, vcpkg)

python tools/windows/check_extension_packages.py --extension-dir D:\path\to\upscale-gufo-extension
cmake --preset windows-release -DGUFO_EXTENSION_DIRS=D:/path/to/upscale-gufo-extension
cmake --build --preset windows-release --parallel 4
.\build\windows-release\gufo.exe diagnose --section extensions

A CPU-only build (ENGINE_ENABLE_HIP=OFF) still builds the host library and the tests; the provider then reports itself unavailable with a reason.

Nix

flake.nix pins one Gufo revision. flake.lock is not committed: it needs a nix flake lock run on Linux, which has not happened yet.

Weights and licences

Download a checkpoint from the Real-ESRGAN v0.2.5.0 release and convert it once. The converter needs only the Python standard library and reads the pickle with a restricted unpickler (no code from the checkpoint runs):

python -I tools/convert_realesrgan_pth.py realesr-animevideov3.pth realesr-animevideov3.safetensors
Checkpoint Use
realesr-animevideov3 anime / drawn video (default)
realesr-general-x4v3 general scenes
realesr-general-wdn-x4v3 general scenes, stronger denoising

Real-ESRGAN (code and the released weights) is BSD-3-Clause, Copyright (c) 2021 Xintao Wang; its notice is reproduced in NOTICE. Weights are never bundled here. Model details and the numerical path are in docs/realesrgan.md.

Use

gufo serve image --model realesr-animevideov3.safetensors --upscale-scale 4

POST /v1/images/edits with exactly one reference image returns it upscaled to size (centre crop, Lanczos-3 from the x4 network output).

Option Meaning
--upscale-scale Largest magnification per axis the provider accepts: 4 (native) or 2
--upscale-tile-pixels Largest tile per network pass, in input pixels (default 512 Ki)
--upscale-fp32 Direct FP32 convolutions instead of FP16 WMMA (validation path)

Limits

  • The Gufo host checks every edit request before the provider: output sides must be multiples of 32, at most 4096 per side and at most 4 megapixels. A native x4 of 832x480 (3328x1920, 6.4 MP) and 1920x1080 (1080 is not a multiple of 32) are rejected; 1664x960 (x2) and 1920x1088 pass.
  • size=auto is mapped by the host to about one megapixel, so there is no "native x4 without a size" request. Requests above --upscale-scale get HTTP 400.
  • Large images are processed in tiles with a halo of one pixel per convolution, so tiling does not change the result.
  • Video upscaling (src/upscale_video.*) is not wired yet: it needs an FFmpeg reader under src/ and an ffmpeg package in the manifest. The NPU / ONNX Runtime path of gufo-studio-windows is not ported.
  • cpu_post.cpp runs without OpenMP (the OpenMP target fails Gufo's external-extension compile-option check on clang-cl).

Status

  • Done: builds against upstream Gufo main 0d238d4f (Windows, windows-cpu-test preset); ctest -L realesrgan 4 of 4 pass (cpu_post, tile_plan, srvgg_weights, request_mapping); extension.json validates against Gufo's extension schema.
  • GPU validated on Strix Halo, 2026-11-12 (Windows 11, gfx1151, TheRock ROCm 10.0.0): Gufo main 0d238d4f built with HIP (windows-release, no built-in extensions); this extension installed as a module with gufo extension install (commit 464ed8b). realesr-general-x4v3, 480x272 test image: x2 (960x544) 0.051 s and x4 (1920x1088) 0.162 s per request (HTTP wall time, median of 3 after one warm-up). Both outputs are bit-identical (max difference 0) to gufo serve upscale --device gpu of gufo-studio-windows, where this upscaler runs in-tree.
  • Pending: comparison against the PyTorch reference, the full HTTP test list, Linux, flake.lock, a tagged release and the registry entry. See CONFORMANCE.md.

Release history

  • 0.1.0 (2026-11-12): first release. Extracted from gufo-studio-windows; ImageRunner glue, CPU build and weight-free tests against upstream 0d238d4f (2026-11-12); renamed to upscale-gufo-extension; module install and GPU run on Strix Halo (Windows), bit-identical to the in-tree upscaler.

License

The extension source is released under the MIT License. The Real-ESRGAN architecture it ports and the model weights are BSD-3-Clause (see NOTICE); weights are downloaded separately.


Written with AI assistance (Claude Code); reviewed by D3rPapts.

About

Real-ESRGAN x2/x4 upscaling as a Gufo extension (HIP, Strix Halo, Windows)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages