Feat: Optinal tile size search before e2e inference#447
Open
eltsai wants to merge 1 commit into
Open
Conversation
Collaborator
Author
|
Updated README to include automatic tile size search (and 2d ring attention) |
syhuang22
reviewed
Jul 15, 2026
syhuang22
reviewed
Jul 15, 2026
syhuang22
reviewed
Jul 15, 2026
syhuang22
left a comment
Collaborator
There was a problem hiding this comment.
In description maybe specify the config (resolution, num frames) to showcase the E2E time to ensure the result of this is best performing and have no regression.
entrpn
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automatic Tile Size Search
Adds a model-agnostic grid search that auto-tunes attention
block_q/block_kvbefore inference. Attention tile sizes strongly affect throughput but the optimum depends on sequence length, VMEM, sharding, etc, for more details see go/diffusion-tile-size-search.utils/tile_size_grid_search.py— model-agnostic core.utils/wan_block_benchmark.py— WAN plug: times one real DiT block (num_layers=1), so results transfer to the full model at ~1/40th the cost.generate_wan.py— opt-in hook that runs the search and injects the winning tiles before the transformer is built.The search maximizes tile size subject to VMEM (fewest-tile BQ ladder + largest-fits BKV), OOM-prunes, and picks the fastest measured config. Default OFF; safe no-op on configs that don't declare the flags.
How to Use It
Auto-tune inside inference (opt-in flags, default off):
Standalone (writes the full grid to CSV):
Example Output
On 8×v7x WAN 2.2 (
ulysses_ring_custom), auto-tuning cut denoise 12.9s → 9.8s.Experiments
Benchmark / no-regression. Measured on WAN 2.2 (T2V-A14B), 1280×720, 81 frames, 8×v7x (
ulysses_ring_custom, dp1-cp8, 5 steps): the search auto-selectsblock_q=9472, block_kv=1024and cuts denoising from 12.9 s → 9.8 s vs the untuned default — matching the best hand-tuned config from a manual sweep, so it reproduces the manual optimum automatically. Because it only overwrites the block sizes when a measured config is faster (and otherwise keeps the configured default, with OOM configs pruned), it is best-performing by construction and cannot introduce a regression.