| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
e2e testgrid: https://8bcf50593faf4ea38060e236169827e5-dot-us-central1.composer.googleusercontent.com/dags/maxdiffusion_tpu_e2e/grid |
Sorry, something went wrong.
There was a problem hiding this comment.
This pull request renames the Flux transformer module, updates configurations to use Ulysses attention with custom block sizes, optimizes layer normalization calculations, and adds profiling support. A critical issue was identified in attention_flax.py where a missing null check on image_rotary_emb could lead to an AttributeError when it is None.
Sorry, something went wrong.
…nd Flux.2-klein - Implemented performance profiling, kernel fusion, instruction scheduling, and latency optimizations for the Flux model family (Flux.1-dev, Flux.1-schnell, Flux.2-klein-4B/9B) on Cloud TPU v6e (Trillium). - Enabled ulysses_custom_fixed_m attention kernel with base-2 exponential scaling (use_base2_exp: True). - Automatically routes heads_per_tile=1 for fixed-m attention dispatches (preserving heads_per_tile>1 tile batching for non-fixed-m kernels). - Enabled LP LLO instruction scheduler in Pallas (use_experimental_scheduler: True). - Fused Rotary Position Embeddings (RoPE) directly on (B, L, H, D) layout, eliminating 228 redundant transpose/swapaxes ops. - Fused LayerNorm scale and shift calculations into single multiply-add ops. - Maintained latents in native bfloat16 for VAE decoding, cutting VAE decode time by 54.2%. - Fixed null check for image_rotary_emb in FlaxFluxAttention to prevent AttributeError.
| Back | FazBrowse Home | New Git URL |
Summary
This PR implements comprehensive performance profiling, kernel fusion, instruction scheduling, and latency optimizations for the Flux model family (FLUX.1-dev, FLUX.1-schnell, and FLUX.2-klein-4B/9B) on Google Cloud TPU v6e (Trillium).
Across cumulative optimization passes on TPU v6e-8 (1024×1024 resolution):
Key Changes
Cauchy-Schwarz Fixed-$m$ Attention Kernel (ulysses_custom_fixed_m):
Pallas Multi-Head Tile Batching (heads_per_tile: 3 / 4):
Pallas LP LLO Instruction Scheduler (use_experimental_scheduler: True):
Fused Direct RoPE & Transpose Elimination:
Fused AdaLN-Zero Math:
Native BF16 VAE Latent Decode:
Dynamic Text Truncation & Pre-Broadcasted Global Modulation:
Module Renaming:
Performance Comparison Matrix (Cloud TPU v6e-8, 1024×1024 Resolution)
Component-Level Benchmarks
Verification & Testing