Skip to content

Conversation

@Phylliida
Copy link

@Phylliida Phylliida commented Oct 24, 2025

Adds additional functions:

  • ggml_conv_2d_circular
  • ggml_conv_2d_dw_direct_circular
  • ggml_conv_2d_direct_circular
  • ggml_pad_circular

These tweak the inputs to the shaders (which are modified in cuda, cpp, and vulkan) to cause them to behave in a "circular" way (like on a torus, the boundaries wrap around).

This is useful for making seamless textures, for example here is a texture generated using this command in stable-diffusion-cpp:

./bin/sd  --diffusion-model /home/bepis/Documents/world/models/qwen-image-lighting-8steps-V1.0-Q4_K_S.gguf  --vae /home/bepis/Documents/world/models/qwen_image_vae.safetensors  --qwen2vl /home/bepis/Documents/world/models/Qwen2.5-VL-7B-Instruct-IQ4_XS.gguf --cfg-scale 2.5 --sampling-method euler -p "onion" --circular --seed 420
output

By default this should be enough to make stable diffusion circular. For qwen image, you need to also adjust the rope settings, see my PR here leejet/stable-diffusion.cpp#914 for the stable-diffusion-cpp side of it.

@CISC
Copy link
Contributor

CISC commented Oct 26, 2025

Please be aware you may have better luck submitting this PR (with tests) to llama.cpp instead, see CONTRIBUTING.md.

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