Closing the gap: Wan 2.2 14B VAE decoder - tt-xla vs tt-metal #5377
Replies: 1 comment
|
Code links point at Headline. The two biggest levers are running full-T instead of the frame-by-frame loop and spatial sharding (which we can't do yet - no halo CCL). A symptom of how broken the sharded path is today: the unsharded decoder on 1 chip is currently faster than our channel-sharded version on 4 chips, more detailed explanation later. tt-xla vs tt-metal - gaps by priorityTable of gaps ordered by impact. For more details read section below.
#1 is small-effort / highest-impact → the natural first move; #2 is large-effort but unlocks full-T at 720p and resolves #3's root cause. #5 (attention) stays medium on purpose: it's one block at the cheapest (latent) resolution, and its More detailed overviewThe gaps reinforce each other, so they read best as one story. The decoder is slow for two compounding reasons: we run it one frame at a time (duplicating the whole graph ~21×), and we shard across channels - the only axis available without a halo CCL - which is also the axis that breaks conv3d. 1. Full-T temporal pass - kill the ×21 unroll · model · small · highestThe latents flowing through the decoder are large, so diffusers decodes the video as a stream - one latent frame at a time ( On Galaxy memory isn't the constraint, so we don't need to stream: we can run all frames through the decoder in one forward pass (full-T), exactly what metal does there ( Where to look:
2. Spatial (H/W) sharding via halo-exchange CCL - the keystone · compiler · large · highestWe shard across channels (Megatron col→row on the resblocks) only because the compiler has no halo-exchange CCL Metal shards the spatial dims instead: Where to look:
3. conv3d blocking config · compiler · medium · highEvery This is the reason of why sharded loses to unsharded (which keeps channels full, so it does hit the table). Fix: drive conv3d blocking from the OpModel like conv2d - shape-driven, so it covers the sharded shapes and odd kernels automatically. Or by sharding the model spatially we will have channels replicated, so we will hit the table for Where to look: The lookup table / heuristic in
What tt-metal folks do (it seems they have even bigger static table hahah)
4. RMSNorm not fused · compiler · medium · mediumOur That is RMSNorm (the We can fuse it by extending Where to look:
5. Replicated high-res layers + attention · model (+compiler) · medium · mediumThe decoder has one attention block (mid-block): a spatial self-attention where, within a frame, every position attends to every other - so the sequence is the H·W grid and the batch is That independence is the whole story: frame-by-frame leaves This is pending since we first need to run full all frames at once which we mentioned in #1 in order for us to benefit this. 6. Smaller compiler wins · compiler · small · low-medTwo independent cleanups. The Neither is a bottleneck; the layout churn mostly vanishes once convs stop bouncing layouts. |
Uh oh!
There was an error while loading. Please reload this page.
Here we discuss the gap between our compiler path for the Wan 2.2 VAE
decoderandtt-metal's hand-written one, and the changes needed to close it, ordered by performance impact. Suggestions welcome :)
All reactions