Sharding of WAN 2.2 VAE #4664
Replies: 3 comments
Conv3D Sharding StrategyAvailable Sharding DimensionsFor a Conv3D with input
Why depth sharding is not beneficialThe WAN VAE decoder uses streaming decode - it processes one temporal frame at a time, feeding Spatial shardingConvolution with a kernel of size k requires each spatial tile to have access to Currently we don't support it and we have open issue in The tt-metal takes this approach: it shards activations along Channel sharding (in Megatron style)That leaves us with only thing we can shard currently -> channels ( The VAE's residual = Sequential(
RMS_norm(in_dim),
SiLU(),
CausalConv3d(in_dim, out_dim, 3), # Conv A
RMS_norm(out_dim),
SiLU(),
CausalConv3d(out_dim, out_dim, 3), # Conv B
)
shortcut = CausalConv3d(in_dim, out_dim, 1)
return residual + shortcutThe ResidualBlock naturally pairs two consecutive
This way, only one collective operation (all_reduce) is needed per pair of layers, and the intermediate tensor between the two layers is never gathered - it stays partitioned (given that we know how to deal with Conv A → C_out sharding (column-parallel):
Conv B → C_in sharding (row-parallel):
The shortcut path ( Per ResidualBlock cost: only 1 all_reduce (at Conv B's output). No all_gather between Conv A→B. |
|
|
For context, here's how the decoder is currently sharded - Megatron col→row pair on every Further sharding consideration: WanResample (upsamplers / downsamplers)There is additional compute parallelism we leave on the table by keeping
We don't apply this today because we want every block to be self-contained: replicated in, replicated out. If we shard If profiling later shows the resample conv is the bottleneck, we can revisit this again. |
Uh oh!
There was an error while loading. Please reload this page.
Here we discuss findings regarding different strategies for sharding residual blocks inside VAE (one that has
conv3dop). If you have any suggestions or ideas, feel free to join :))All reactions