Skip to content

feat: move circular padding to per-generation params#1748

Merged
leejet merged 1 commit into
leejet:masterfrom
fszontagh:feat/circular-per-gen
Jul 6, 2026
Merged

feat: move circular padding to per-generation params#1748
leejet merged 1 commit into
leejet:masterfrom
fszontagh:feat/circular-per-gen

Conversation

@fszontagh

@fszontagh fszontagh commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Moves the circular_x / circular_y flags from sd_ctx_params_t to sd_img_gen_params_t and sd_vid_gen_params_t. Previously users had to unload and reload the model to switch between tileable and non-tileable output; now they can vary it per generate call on a persistent context.

The setter set_circular_axes is just two bool assignments on the runner context, and the VAE encode/decode entry points already take circular_x / circular_y as function arguments, so nothing about the plumbing required a load-time decision.

Related Issue / Discussion

None.

Additional Information

Behavior verified

Loaded AcornXL_V2 (SDXL) once, ran two consecutive generations of "seamless tiling brick wall texture, flat lighting" at 512x512, 20 steps, karras, seed 42:

  • With --circular: log shows Using circular padding for convolutions (x=true, y=true), output has wrapped edges.
  • Without: log stays silent, output is a normal brick wall.

Same executable, same code path, no reload.

Changes

  • sd_ctx_params_t: dropped circular_x, circular_y (default init, param string, and print). Load-time set_circular_axes calls in StableDiffusionGGML::load_from_file removed.
  • sd_img_gen_params_t, sd_vid_gen_params_t: appended circular_x, circular_y; wired defaults in _init and printing in sd_img_gen_params_to_str.
  • New helper apply_circular_axes_to_diffusion(sd_ctx, cx, cy) invoked at the top of generate_image / generate_video. Sets the sd struct fields (so the existing VAE guard picks them up) and calls set_circular_axes on diffusion_model, high_noise_diffusion_model, and control_net. Logs only when a flag is on.
  • CLI: --circular, --circularx, --circulary moved from SDParams to SDGenerationParams; assignment routed to sd_img_gen_params_t / sd_vid_gen_params_t in to_sd_img_gen_params_t and to_sd_vid_gen_params_t.
  • Enum values and existing gen struct field order preserved; new fields appended.

Notes

  • No CUDA / Vulkan gating - circular padding is model-side conv padding, backend-agnostic.
  • The VAE tiling adjust logic (configure_image_vae_axes) continues to read sd_ctx->sd->circular_x/y. Those are now set from gen params at generate-time, one line before the guard runs.

Checklist

@leejet leejet merged commit e071aa3 into leejet:master Jul 6, 2026
12 checks passed
@fszontagh fszontagh deleted the feat/circular-per-gen branch July 7, 2026 07:05
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