Skip to content

FLUX 3 on 8 and 12 GB cards: stream Qwen3-VL layers and fp8 linears - #74

Merged
TroyHernandez merged 2 commits into
mainfrom
feat/flux3-8gb
Oct 28, 2026
Merged

TroyHernandez merged 2 commits into
mainfrom
feat/flux3-8gb

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

FLUX 3 Image Klein on 8 and 12 GB cards. flux3_load_pipeline() decides what streams based on the card size (vram_gb, detected by default). Version 0.2.2.17.

Streaming

  • stream_text (default below 10 GB): the Qwen3-VL layers stay in pinned host memory and move to the GPU one at a time during the encode, which takes about 1 s. The whole encoder would need about 9 GB at once.
  • resident_gb (default vram_gb - 6.5 below 12 GB): that many GB of fp8 transformer weights stay on the GPU. The remaining linears copy in from pinned memory inside each forward, reusing the existing host path in ltx23_fp8_linear.
  • 12 GB and up: nothing streams, same as before.

Garbage collection

  • FLUX 3 now runs a minor R gc after every transformer block, including the per-mode blocks. Previously it ran a full gc after the joint blocks only.
  • The VAE encoder and decoder blocks run a minor gc after each resnet when diffuseR.block_gc is on.
  • Streaming mode sets its own allocator gc gates: reserved 0.6, allocated 0.8. torch for R runs R's gc only on an allocator miss, and skips it entirely while reserved memory is below reserved_rate × total. The 12 GB-footprint default works out to 0.92 on an 8 GB card, so no gc ran there even when an allocation failed.

Measured (RTX 5060 Ti 16 GB, fp8; smaller cards simulated by holding memory in an unused tensor)

Card 1024² text-to-image 1 MP edit
8 GB (simulated) 30 s 56 s
12 GB (simulated, no streaming) 27 s 53 s
16 GB 27 s, peak 9.1 GB (was 44 s, 11.7 GB) 53 s, peak 10.7 GB (was 50 s, 13.8 GB)
  • The 4 MP edit is unchanged at 285 s and a 14.1 GB peak.
  • The streamed 8 GB image matches the resident one at 58.7 dB PSNR.
  • tinytest: 1561 passed, 0 failed (21 new in test_flux3_stream.R: the plan, Qwen layer streaming parity, and the fp8 split census and parity).

Not in this PR

  • A run on real 8 and 12 GB hardware.
  • A recommend() entry for FLUX 3.
  • Applying the minor-gc change to klein and Z-Image.

@TroyHernandez
TroyHernandez merged commit ecaeecc into main Oct 28, 2026
2 checks passed
@TroyHernandez
TroyHernandez deleted the feat/flux3-8gb branch October 28, 2026 21:14
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.

1 participant