Skip to content

LTX-2.5 on 8 and 12 GB cards and in less host RAM - #75

Merged
TroyHernandez merged 3 commits into
mainfrom
feat/ltx25-small-cards
Oct 29, 2026
Merged

TroyHernandez merged 3 commits into
mainfrom
feat/ltx25-small-cards

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

LTX-2.5 on 8 and 12 GB cards, and in less host RAM.

Small cards

  • ltx23_load_pipeline(resident_gb = ) keeps the leading NF4 blocks on the GPU and streams the rest from pinned host memory, one block per TorchScript call. Below 7 GB the text connectors stream too.
  • load_gemma4_nf4(stream = TRUE) streams the Gemma 4 layers.
  • ltx23_memory_profile() picks resident_gb = vram - 4 below 14 GB and stream_text below 12 GB.

Simulated with a ballast tensor on the 16 GB card, 768x512x121: 12 GB and 8 GB both render in ~84 s, the same as 16 GB.

Less host RAM

The one-process flow needs ~31 GB of host RAM (pinned staging plus Gemma 4). Two ways to need less:

  1. Split text phase. Encode with Gemma, free it, run the connectors on a connectors-only pipeline with the new ltx23_text_embeds(), free that, then load the render pipeline without connectors and pass connector_embeds.
  2. resident_from = "disk". The GPU-resident blocks keep no host copy and are re-read from the artifact each render (~1 GB/s through safetensors).

pin = FALSE on ltx23_load_pipeline now also disables the staging pins. Freed pinned memory stays in torch's host cache, so a pipeline you plan to drop has to load unpinned.

ltx23_memory_profile(host_ram_gb = ) detects available RAM and returns split_text (below 32 GB) and resident_from ("disk" below 22 GB).

Measured under a 20 GB cgroup cap, 768x512x121, render 2:

Setup Host RAM high-water Render
One process (before) ~31 GB 84 s
8 GB card, split text, host copies 20.1 GB 82 s
8 GB card, split text, from disk 16.0 GB 90 s
12 GB card, split text, from disk 14.9 GB at load, 10.4 GB rendering 92 s

The text phase peaks at 12.4 GB. Host and disk latents are bit-identical.

Not done

  • Not run on real 8 or 12 GB hardware.
  • serve.R and recommend("ltx") don't use the new profile fields yet.
  • Disk mode still reads the whole transformer into RAM at load before dropping the resident part; that sets the 14.9 GB load peak.

Tests

Full suite: 1611 passed, 0 failed. New tests cover disk-staging parity (exact output match across offload/onload), the host-RAM profile cases, and the loader and ltx23_text_embeds errors.

Version 0.2.2.18.

ltx23_text_embeds() runs the connectors on a connectors-only pipeline
(optionally from raw prompt_embeds), so Gemma, the connectors and the
render pipeline never share host RAM. ltx23_load_pipeline(resident_from
= "disk") keeps no host copy of the GPU-resident NF4 blocks and re-reads
them from the artifact per render. pin = FALSE now also leaves staging
buffers unpinned. ltx23_memory_profile() picks split_text and
resident_from from available host RAM.
@TroyHernandez
TroyHernandez merged commit bfac4d6 into main Oct 29, 2026
2 checks passed
@TroyHernandez
TroyHernandez deleted the feat/ltx25-small-cards branch October 29, 2026 03:04
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