Skip to content

Feature: attention slicing + VAE tile decoding for low-memory Apple Silicon #718

Description

@dahai80

Context

fusion-mlx (local model serving on Apple Silicon, Metal/MLX) uses mflux-fusion 0.18.0 as its image-generation backend. For large diffusion models (Qwen-Image-2512, Flux2-Dev 12B, SDXL at 1024+) the per-step attention and the VAE decode peak memory can exceed available unified memory on 16GB MacBooks, causing Metal OOM.

diffusers solves this with two APIs:

  • enable_attention_slicing() — chunked attention computation (trade speed for memory)
  • enable_vae_slicing() / enable_tiling() — VAE decode in tiles

Current behavior

mflux-fusion 0.18.0 has no slicing/chunking API on the inference path. Grepping the package finds only dataset __getitem__(slice) and SeedVR2 window slicing — none relevant to diffusion inference memory. The transformer forward and VAE decode run fully materialized.

There is no way to reduce peak memory without lowering resolution or step count.

Requested

  1. An opt-in attention slicing mode on the Flux/Qwen transformer forward (process the sequence dimension in chunks, accumulate).
  2. A VAE tiling decode option (decode latent in spatial tiles, blend overlaps).
  3. Exposed as kwargs on generate_image() (e.g. attention_slice_size, vae_tile_size) or engine-level setters.

Impact

Blocks fusion-mlx issue #848 (attention/vae slicing support). Without it, 16GB machines cannot run Qwen-Image-2512 at 1024x1024 without OOM. Currently fusion-mlx must warn-and-skip when slicing is requested.

Workaround on our side

Env-gated stub that logs slicing unavailable when a user sets FUSION_IMAGE_SLICING=1, then proceeds without slicing. Not a real fix — needs the upstream API.

Happy to contribute a PR if there's appetite for the feature.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions