Skip to content

perf([ref-watch-phosphene-pin-mlx-lazy-eval-cadence-envs]): pin MLX lazy-eval cadence to =1 for ~25x faster LTX-2 denoise#520

Merged
atomantic merged 1 commit into
mainfrom
claim/ref-watch-phosphene-pin-mlx-lazy-eval-cadence-envs
May 29, 2026
Merged

perf([ref-watch-phosphene-pin-mlx-lazy-eval-cadence-envs]): pin MLX lazy-eval cadence to =1 for ~25x faster LTX-2 denoise#520
atomantic merged 1 commit into
mainfrom
claim/ref-watch-phosphene-pin-mlx-lazy-eval-cadence-envs

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

Bumps LTX2_DIT_EVAL_EVERY and LTX2_GEMMA_EVAL_EVERY from 01 in scripts/generate_ltx2.py. These envs govern lazy MLX graph-eval cadence on M-series Macs and must be set before any ltx_core_mlx import (the transformer module reads them at import time).

Phosphene's published M4 Max 64 GB I2V Balanced 5s / 121 f matrix shows:

Cadence Per-step Notes
=8 (upstream default) ~3 min/step per-block Metal command-buffer churn
=1 (this PR) ~7 s/step ~25× faster denoise
=0 (prior PortOS value) also fast extends post-decode deallocator hang

=1 wins on both axes: full denoise speedup + clean shutdown. The defense-in-depth os._exit(0) added in 0f5b7384 stays in place either way.

setdefault is preserved so a caller-supplied env var still wins.

Test plan

  • Smoke-test t2v / i2v / fflf / extend / a2v on M-series hardware (=1 interacts with the same post-decode hang [ref-watch-phosphene-sigkill-watchdog-videogen-local] plans to defense-in-depth; not autonomously verifiable without a real Apple Silicon Mac)
  • Confirm the env values from scripts/generate_ltx2.py:53-54 reach the child process (the helper's stderr should NOT mention any upstream "lazy-eval disabled" warning)

Slug: [ref-watch-phosphene-pin-mlx-lazy-eval-cadence-envs]

…azy-eval cadence to =1 for ~25x faster LTX-2 denoise

Phosphene's M4 Max 64 GB I2V Balanced 5s / 121 f matrix:
  LTX2_DIT_EVAL_EVERY=8 (upstream default): ~3 min/step
  LTX2_DIT_EVAL_EVERY=1: ~7 s/step (~25x faster)
  LTX2_DIT_EVAL_EVERY=0: also fast, but extends the post-decode
    deallocator hang the prior commit (os._exit(0)) mitigates.

=1 wins on both axes (denoise speed + clean shutdown). The existing
defense-in-depth os._exit(0) at helper teardown stays in place.

Also flips LTX2_GEMMA_EVAL_EVERY to match. Both still use setdefault
so a caller-supplied env var overrides.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Changes the default MLX lazy-eval cadence env vars in the LTX-2 helper from 0 to 1 to retain the ~25× denoise speedup over the upstream =8 default while avoiding the post-decode deallocator hang associated with =0. Comment, PLAN entry, and changelog updated accordingly.

Changes:

  • Bump LTX2_DIT_EVAL_EVERY / LTX2_GEMMA_EVAL_EVERY defaults 01 in scripts/generate_ltx2.py (with updated rationale comment).
  • Remove completed PLAN item for this slug.
  • Add changelog entry under Next.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
scripts/generate_ltx2.py Pin lazy-eval cadence envs to =1 before LTX imports
PLAN.md Drop the now-shipped planning entry
.changelog/NEXT.md User-facing note for faster LTX-2 renders

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@atomantic atomantic merged commit de81578 into main May 29, 2026
3 checks passed
@atomantic atomantic deleted the claim/ref-watch-phosphene-pin-mlx-lazy-eval-cadence-envs branch May 29, 2026 05:13
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