Skip to content

perf: LTX-2.3 SPEED on FA4 attention (10.4s to 7.3s)#16

Merged
Johan-de-R merged 1 commit into
deep-main-v1.1.1-videogenfrom
johan/ltx23-fa4-upstream
Jul 8, 2026
Merged

perf: LTX-2.3 SPEED on FA4 attention (10.4s to 7.3s)#16
Johan-de-R merged 1 commit into
deep-main-v1.1.1-videogenfrom
johan/ltx23-fa4-upstream

Conversation

@Johan-de-R

Copy link
Copy Markdown

What

Flips the LTX-2.3 SPEED profile from TORCH_SDPA to FLASH_ATTN (FA4) — the last recipe-level deviation from FastVideo's published fast path. 10.4s -> 7.3s/clip (~30%), quality on par or better.

Why FA4 didn't build before

FastVideo's June-26 pyproject pinned flash-attn-cute from the XOR-op/flash-attention fork (f4c68c7f, Feb 2026), which is stale against cutlass-dsl 4.5+ API moves (cute.core.ThrMma, cute.make_fragment renamed/relocated) — it crashes on the 4.6.0.dev0 our stack pulls. FastVideo hit the identical break and fixed it 2026-07-06 (hao-ai-lab/FastVideo#1564): they dropped the fork and now pin flash-attn-4 straight from the real upstream Dao-AILab/flash-attention at a CuTe-DSL-4.6-compatible commit (82d6441 = upstream PR ai-dynamo#2648). This PR reproduces that exact pin, plus FastVideo's own matching wrapper fix (the pinned _flash_attn_fwd returns a 4-tuple now; their wrapper takes [:2]).

Changes

  • Dockerfile.dreamverse: uninstall the baked XOR-op flash-attn-cute, install flash_attn/cute from Dao-AILab/flash-attention@82d6441 (ARG FA4_CUTE_REF, pinned — do not bump without re-validating).
  • patches/flash-attn-cute-fa4-tuple-fix.patch: [:2] on both _flash_attn_fwd callers in fastvideo/attention/utils/flash_attn_cute.py (git-am style, applied like the existing patches).
  • config.py profile_attention_backend: SPEED -> FLASH_ATTN.
  • bake_bench.py: derive the attention backend from the profile (was hardcoded TORCH_SDPA — would silently bake the wrong kernels into Mega-Cache); latency gate skips the i2v cold-compile pass (was a guaranteed false-positive); default gate 14s -> 10s for the FA4 baseline.

Validation (di-slc-47 B200, fresh boot from the image alone, dual-mode Mega-Cache blob)

preset: ltx2_distilled    backend: FLASH_ATTN
[megacache] LOADED 588233684 bytes   BOOT_WARM_S = 460.3s
GEN[musician] = 7.3s   GEN[dog] = 7.4s
latency gate: PASS
  • Timing vs current prod (5 seed-locked prompts market/surfer/cafe/fox/dancer): FA4 7.2-7.3s vs SDPA 10.3-10.5s, same tight variance band.
  • Quality: Johan sign-off — on par or better than SDPA.

Ship image built: 2.1.5-ltx23-fa4-d333ce5e (shape hash matches prod). Cutover (registry push + model repoint) is a separate step, to be done with explicit go-ahead; rollback stays the current 2.1.5-ltx23-speed-v2-d333ce5e.

🤖 Generated with Claude Code

Flips the SPEED profile from TORCH_SDPA (a stand-in shipped because FA4 never
built) to FLASH_ATTN -- FastVideo's actual streaming-recipe attention, the last
recipe-level deviation from their published fast path.

Root cause FA4 didn'\''t build: the XOR-op/flash-attention fork FastVideo'\''s
June-26 pyproject pinned (f4c68c7f) is stale against cutlass-dsl 4.5+ API moves
(cute.core.ThrMma, cute.make_fragment renamed/relocated). FastVideo hit the same
break and fixed it 2026-07-06 (hao-ai-lab/FastVideo#1564): dropped the fork,
pinned flash-attn-4 from Dao-AILab/flash-attention upstream at a
CuTe-DSL-4.6-compatible commit (82d6441, = upstream PR ai-dynamo#2648). This reproduces
that exact pin + FastVideo'\''s own matching wrapper fix (the pinned
_flash_attn_fwd now returns a 4-tuple; their wrapper takes [:2]).

Changes:
- Dockerfile.dreamverse: uninstall the baked XOR-op flash-attn-cute, install
  flash_attn/cute from Dao-AILab upstream @82d6441 (ARG FA4_CUTE_REF).
- patches/flash-attn-cute-fa4-tuple-fix.patch: [:2] on both _flash_attn_fwd
  callers in fastvideo/attention/utils/flash_attn_cute.py.
- config.py profile_attention_backend: SPEED -> FLASH_ATTN.
- bake_bench.py: derive attention backend from the profile (was hardcoded
  TORCH_SDPA -> would bake wrong kernels); latency gate skips the i2v cold pass;
  default gate 14s -> 10s for the FA4 baseline.

Validated (di-slc-47 B200, fresh-boot from the image alone, dual-mode Mega-Cache
blob): boot-warm 460s, warm gen 7.3-7.4s (vs SDPA 10.4s), preset ltx2_distilled,
FLASH_ATTN selected, latency gate pass. Quality OK'\''d by Johan (5 seed-locked
prompts vs SDPA): on par or better.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the perf label Jul 8, 2026
@Johan-de-R Johan-de-R changed the title perf: LTX-2.3 SPEED on FA4 attention (10.4s -> 7.3s) perf: LTX-2.3 SPEED on FA4 attention (10.4s to 7.3s) Jul 8, 2026
@Johan-de-R Johan-de-R merged commit 1fee697 into deep-main-v1.1.1-videogen Jul 8, 2026
13 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant