Skip to content

refactor: rename LTX_MEGACACHE_* env to generic DI_MEGACACHE_* (backward-compat)#13

Open
Johan-de-R wants to merge 1 commit into
deep-main-v1.1.1-videogenfrom
johan/megacache-rename
Open

refactor: rename LTX_MEGACACHE_* env to generic DI_MEGACACHE_* (backward-compat)#13
Johan-de-R wants to merge 1 commit into
deep-main-v1.1.1-videogenfrom
johan/megacache-rename

Conversation

@Johan-de-R

Copy link
Copy Markdown

What

Renames the Mega-Cache env vars from the LTX_-prefixed names to generic DI_-prefixed ones:

old new
LTX_MEGACACHE_DIR DI_MEGACACHE_DIR
LTX_MEGACACHE_BLOB DI_MEGACACHE_BLOB
LTX_MEGACACHE_SAVE_EVERY DI_MEGACACHE_SAVE_EVERY

Also renames patches/ltx23_gpu_worker_megacache.patchpatches/gpu_worker_megacache.patch and the private helpers _ltx_megacache_*_megacache_*.

Why

The mechanism is torch.compiler Mega-Cache (save/load_cache_artifacts) — a PyTorch-level portable compile-cache wired at the FastVideo gpu_worker level. It is not LTX-specific; it works for any video family (fastwan, ltx2, ltx23, …). We're moving to enable it by default on our self-run video models, so the LTX_ name is misleading. Renaming now, before it gets baked into more images.

Backward compatibility (no breakage mid-transition)

  • lib/pool.py reads DI_MEGACACHE_DIR or LTX_MEGACACHE_DIR, and exports both DI_MEGACACHE_BLOB and LTX_MEGACACHE_BLOB to the worker child.
  • The gpu_worker patch reads DI_MEGACACHE_BLOB or LTX_MEGACACHE_BLOB (and same for SAVE_EVERY).

So already-baked images and any in-flight LTX-2.3 bakes that set LTX_MEGACACHE_DIR keep working. Drop the LTX_ fallbacks in a follow-up once every video image has been rebuilt on this change.

Coordination

Touches shared lib/pool.py + the gpu_worker patch, which the LTX-2.3 speed ship (#12, merged) also uses. Backward-compat means no action required from that thread; adopt DI_MEGACACHE_DIR at the next LTX image rebuild.

Validation

  • black/isort clean on lib/pool.py.
  • Patch edits only touch added (+) lines; hunk line-count unchanged, so git apply behavior is identical to before.
  • Megacache mechanism itself validated end-to-end on FastWan (di-slc-22 H100): loads blobs, bit-exact output vs cold, ~15% faster boot.

🤖 Generated with Claude Code

…ard-compat)

The compile-cache mechanism is torch.compiler Mega-Cache (save/load_cache_artifacts),
a PyTorch-level portable-compile-cache that is NOT LTX-specific -- it is wired at the
FastVideo gpu_worker level and applies to any video family (fastwan, ltx2, ltx23, ...).
As we make it the default for our self-run video models, the LTX_-prefixed env name is
misleading, so rename before it proliferates into more baked images:

  LTX_MEGACACHE_DIR        -> DI_MEGACACHE_DIR
  LTX_MEGACACHE_BLOB       -> DI_MEGACACHE_BLOB
  LTX_MEGACACHE_SAVE_EVERY -> DI_MEGACACHE_SAVE_EVERY

Also renames patches/ltx23_gpu_worker_megacache.patch -> gpu_worker_megacache.patch
and the private helper methods _ltx_megacache_* -> _megacache_*.

Backward-compatible so nothing breaks mid-transition:
- lib/pool.py reads `DI_MEGACACHE_DIR or LTX_MEGACACHE_DIR` and exports BOTH
  DI_MEGACACHE_BLOB and LTX_MEGACACHE_BLOB to the worker child.
- the gpu_worker patch reads `DI_MEGACACHE_BLOB or LTX_MEGACACHE_BLOB` (and same for
  SAVE_EVERY).
So already-baked images and any in-flight bakes that set LTX_MEGACACHE_DIR keep working.
Drop the LTX_ fallbacks once every video image has been rebuilt on this change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added refactor documentation Improvements or additions to documentation labels Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant