Skip to content

docs: add gosd (pure Go bindings) to README#1480

Merged
leejet merged 1 commit into
leejet:masterfrom
l8bloom:update-readme-with-new-go-bindings
May 14, 2026
Merged

docs: add gosd (pure Go bindings) to README#1480
leejet merged 1 commit into
leejet:masterfrom
l8bloom:update-readme-with-new-go-bindings

Conversation

@l8bloom
Copy link
Copy Markdown
Contributor

@l8bloom l8bloom commented May 7, 2026

Hello,

I've developed gosd, a set of pure Go (no CGO) bindings for stable-diffusion.cpp. I noticed that existing Go implementations in the README are currently out of sync with the latest upstream APIs, so I built this to provide a modern alternative.

Key features:

  • Pure Go: Uses FFI (no CGO), making cross-platform builds seamless.
  • Up-to-date: 100% stable-diffusion.cpp API coverage with CI/CD that tracks upstream changes to ensure compatibility.
  • Cross-platform: Regularly tested on Windows, Linux, and macOS.
  • Versioning: Clearly maps gosd releases to specific sd.cpp versions.

I believe this would be a valuable addition for Go developers looking to integrate this project.
Thank you for all the work on this engine!

@l8bloom
Copy link
Copy Markdown
Contributor Author

l8bloom commented May 13, 2026

@leejet can you please have a look?

The bindings cover 100% of stable-diffusion.cpp API and is tested regularly.

@leejet
Copy link
Copy Markdown
Owner

leejet commented May 14, 2026

Nice job!

@leejet leejet merged commit 60477fd into leejet:master May 14, 2026
@l8bloom l8bloom deleted the update-readme-with-new-go-bindings branch May 15, 2026 09:41
fszontagh added a commit to fszontagh/stable-diffusion.cpp that referenced this pull request May 15, 2026
Picks up 8 commits since the previous sync at 90e87bc:

  0b82969 docs: add .github/pull_request_template.md
  381e0df docs: add CONTRIBUTING.md
  0665a7f feat: add hidream o1 image support (leejet#1485)
  eeac950 fix: Use PkgConfig for WebP and WebM (leejet#1400)
  57ff2eb feat: support for memory-mapping model weights (leejet#1414)
  9d68341 feat: add Euler CFG++ and Euler-A CFG++ samplers (leejet#1354)
  60477fd docs: add new go bindings for stable-diffusion.cpp (leejet#1480)
  6ee0684 feat: display server url with "http://" prefix. (leejet#1486)

Conflicts, all in src/ggml_extend.hpp:

1. copy_data_to_backend_tensor signature: upstream made gf required
   (graph-cut needs the segment's graph to restrict uploads); our
   layer-streaming path needs gf=nullptr so each mini-graph uploads
   its full backend_tensor_data_map without filtering. Resolution:
   keep gf optional (default nullptr) and guard the graph_tensor_set
   filter on gf != nullptr. Upstream's new read_graph_tensor<T>
   template is added unchanged above copy_data_to_backend_tensor.

2. Tensor-loop null check: upstream added tensor/data null guards and
   a single ggml_get_name() lookup. Kept both, with our gf-gate
   layered on top of upstream's set-membership check.

3. alloc_params_buffer: upstream's mmap fast-path (skip allocation
   when every tensor already has data, since ggml_backend_alloc_ctx_tensors
   would hit n_buffers==0) and our pinned-host fast-path (allocate
   weights in the GPU device's host buffer for async H2D under
   offload) collide on the same function. Resolution: mmap check
   runs first and returns early — mmapped tensors can't be moved
   into pinned host memory — then the pinned-host path runs for the
   non-mmap CPU-params-with-GPU-runtime case, then the original
   pageable params_backend alloc as the final fallback.

Smoke-tested on Z-Image-Turbo Q8 at 512x512:
  --offload-mode layer_streaming  -> 4.0s total (coarse-stage path)
  --offload-to-cpu --max-vram 4   -> 8.3s total (3 graph-cut segments)

HiDream O1 streaming hooks deferred to a follow-up commit.
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.

2 participants