[float8] add _auto_filter_for_recipe to float8#2410
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2410
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit ded0931 with merge base 101c039 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
Author
|
cc @vkuzo for review |
vkuzo
approved these changes
Jun 24, 2025
vkuzo
left a comment
Contributor
There was a problem hiding this comment.
looks good, can we make sure the name has an underscore and also add a test before landing?
ae04451 to
ded0931
Compare
danielvegamyhre
added a commit
to pytorch/torchtitan
that referenced
this pull request
Jul 1, 2025
Fixes #1207 ## Problem - float8 rowwise + vanilla TP in torchtitan had flat perf with respect to bfloat16 (see #1207). - RCA In #1207 found attention.wk and attention.wv layers were so small that float8 rowwise conversion resulted in approx ~40% slowdown for those layers, which nullified the perf benefits from fp8 rowwise conversion on larger linears. - This is because the default `filter_fqns` for float8 model conversion are fine for the fp8 tensorwise recipe, but bad for the float8 rowwise recipe. ### Solution This has been a footgun for various users as well (including Poolside), so I created an "auto filter" (pytorch/ao#2410) which automatically filters Linears for a given float8 recipe, by checking for the following criteria: 1. dims not divisible by 16 (hardware requirement for float8) 2. dim sizes below thresholds that may result in worse perf **for that given recipe**, using simple heuristics based on the linked recipe perf tables above. 3. fqn matches one of the user defined `filter_fqns` It prevents users from hitting this common footgun, while also preserving the flexibility to define their model-specific fqns. ## Results Benchmarks show a ~10% TPS improvement for TP and ~15% TPS improvement for async TP (over bf16 TP baseline). Llama3 70b on 256 H100s with FSDP=32, TP=8, torch.compile, full AC, local batch size 16: - [bfloat16 baseline](https://fburl.com/mlhub/ji9smr5u) = ~597TPS - [fp8 rowwise WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/cu4o6w5m) = ~600 TPS - [fp8 rowwise WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/mgzz309o) = ~660 TPS - [fp8 rowwise + async TP WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/76q4mel9 ) = ~625 TPS - [fp8 rowwise + async TP WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/6b07aa4d) = ~695 TPS
wwwjn
pushed a commit
to pytorch/torchtitan
that referenced
this pull request
Jul 1, 2025
Fixes #1207 ## Problem - float8 rowwise + vanilla TP in torchtitan had flat perf with respect to bfloat16 (see #1207). - RCA In #1207 found attention.wk and attention.wv layers were so small that float8 rowwise conversion resulted in approx ~40% slowdown for those layers, which nullified the perf benefits from fp8 rowwise conversion on larger linears. - This is because the default `filter_fqns` for float8 model conversion are fine for the fp8 tensorwise recipe, but bad for the float8 rowwise recipe. ### Solution This has been a footgun for various users as well (including Poolside), so I created an "auto filter" (pytorch/ao#2410) which automatically filters Linears for a given float8 recipe, by checking for the following criteria: 1. dims not divisible by 16 (hardware requirement for float8) 2. dim sizes below thresholds that may result in worse perf **for that given recipe**, using simple heuristics based on the linked recipe perf tables above. 3. fqn matches one of the user defined `filter_fqns` It prevents users from hitting this common footgun, while also preserving the flexibility to define their model-specific fqns. ## Results Benchmarks show a ~10% TPS improvement for TP and ~15% TPS improvement for async TP (over bf16 TP baseline). Llama3 70b on 256 H100s with FSDP=32, TP=8, torch.compile, full AC, local batch size 16: - [bfloat16 baseline](https://fburl.com/mlhub/ji9smr5u) = ~597TPS - [fp8 rowwise WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/cu4o6w5m) = ~600 TPS - [fp8 rowwise WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/mgzz309o) = ~660 TPS - [fp8 rowwise + async TP WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/76q4mel9 ) = ~625 TPS - [fp8 rowwise + async TP WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/6b07aa4d) = ~695 TPS
mori360
pushed a commit
to mori360/torchtitan
that referenced
this pull request
Jul 8, 2025
Fixes pytorch#1207 ## Problem - float8 rowwise + vanilla TP in torchtitan had flat perf with respect to bfloat16 (see pytorch#1207). - RCA In pytorch#1207 found attention.wk and attention.wv layers were so small that float8 rowwise conversion resulted in approx ~40% slowdown for those layers, which nullified the perf benefits from fp8 rowwise conversion on larger linears. - This is because the default `filter_fqns` for float8 model conversion are fine for the fp8 tensorwise recipe, but bad for the float8 rowwise recipe. ### Solution This has been a footgun for various users as well (including Poolside), so I created an "auto filter" (pytorch/ao#2410) which automatically filters Linears for a given float8 recipe, by checking for the following criteria: 1. dims not divisible by 16 (hardware requirement for float8) 2. dim sizes below thresholds that may result in worse perf **for that given recipe**, using simple heuristics based on the linked recipe perf tables above. 3. fqn matches one of the user defined `filter_fqns` It prevents users from hitting this common footgun, while also preserving the flexibility to define their model-specific fqns. ## Results Benchmarks show a ~10% TPS improvement for TP and ~15% TPS improvement for async TP (over bf16 TP baseline). Llama3 70b on 256 H100s with FSDP=32, TP=8, torch.compile, full AC, local batch size 16: - [bfloat16 baseline](https://fburl.com/mlhub/ji9smr5u) = ~597TPS - [fp8 rowwise WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/cu4o6w5m) = ~600 TPS - [fp8 rowwise WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/mgzz309o) = ~660 TPS - [fp8 rowwise + async TP WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/76q4mel9 ) = ~625 TPS - [fp8 rowwise + async TP WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/6b07aa4d) = ~695 TPS
liangel-02
pushed a commit
that referenced
this pull request
Aug 25, 2025
* add auto_filter_for_recipe to float8 * lint * address comments * add tests
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 13, 2026
Fixes pytorch#1207 ## Problem - float8 rowwise + vanilla TP in torchtitan had flat perf with respect to bfloat16 (see pytorch#1207). - RCA In pytorch#1207 found attention.wk and attention.wv layers were so small that float8 rowwise conversion resulted in approx ~40% slowdown for those layers, which nullified the perf benefits from fp8 rowwise conversion on larger linears. - This is because the default `filter_fqns` for float8 model conversion are fine for the fp8 tensorwise recipe, but bad for the float8 rowwise recipe. ### Solution This has been a footgun for various users as well (including Poolside), so I created an "auto filter" (pytorch/ao#2410) which automatically filters Linears for a given float8 recipe, by checking for the following criteria: 1. dims not divisible by 16 (hardware requirement for float8) 2. dim sizes below thresholds that may result in worse perf **for that given recipe**, using simple heuristics based on the linked recipe perf tables above. 3. fqn matches one of the user defined `filter_fqns` It prevents users from hitting this common footgun, while also preserving the flexibility to define their model-specific fqns. ## Results Benchmarks show a ~10% TPS improvement for TP and ~15% TPS improvement for async TP (over bf16 TP baseline). Llama3 70b on 256 H100s with FSDP=32, TP=8, torch.compile, full AC, local batch size 16: - [bfloat16 baseline](https://fburl.com/mlhub/ji9smr5u) = ~597TPS - [fp8 rowwise WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/cu4o6w5m) = ~600 TPS - [fp8 rowwise WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/mgzz309o) = ~660 TPS - [fp8 rowwise + async TP WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/76q4mel9 ) = ~625 TPS - [fp8 rowwise + async TP WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/6b07aa4d) = ~695 TPS
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 25, 2026
Fixes pytorch#1207 ## Problem - float8 rowwise + vanilla TP in torchtitan had flat perf with respect to bfloat16 (see pytorch#1207). - RCA In pytorch#1207 found attention.wk and attention.wv layers were so small that float8 rowwise conversion resulted in approx ~40% slowdown for those layers, which nullified the perf benefits from fp8 rowwise conversion on larger linears. - This is because the default `filter_fqns` for float8 model conversion are fine for the fp8 tensorwise recipe, but bad for the float8 rowwise recipe. ### Solution This has been a footgun for various users as well (including Poolside), so I created an "auto filter" (pytorch/ao#2410) which automatically filters Linears for a given float8 recipe, by checking for the following criteria: 1. dims not divisible by 16 (hardware requirement for float8) 2. dim sizes below thresholds that may result in worse perf **for that given recipe**, using simple heuristics based on the linked recipe perf tables above. 3. fqn matches one of the user defined `filter_fqns` It prevents users from hitting this common footgun, while also preserving the flexibility to define their model-specific fqns. ## Results Benchmarks show a ~10% TPS improvement for TP and ~15% TPS improvement for async TP (over bf16 TP baseline). Llama3 70b on 256 H100s with FSDP=32, TP=8, torch.compile, full AC, local batch size 16: - [bfloat16 baseline](https://fburl.com/mlhub/ji9smr5u) = ~597TPS - [fp8 rowwise WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/cu4o6w5m) = ~600 TPS - [fp8 rowwise WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/mgzz309o) = ~660 TPS - [fp8 rowwise + async TP WITH attention.wk, attention.wv converted](https://fburl.com/mlhub/76q4mel9 ) = ~625 TPS - [fp8 rowwise + async TP WITHOUT attention.wk, attention.wv converted](https://fburl.com/mlhub/6b07aa4d) = ~695 TPS
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.
Part of pytorch/torchtitan#1207
Problem
filter_fqnsfor float8 model conversion are fine for the fp8 tensorwise recipe, but bad for the float8 rowwise recipe.Solution
This has been a footgun for various users as well (including Poolside), so I created an "auto filter" (#2410) which automatically filters Linears for a given float8 recipe, by checking for the following criteria:
filter_fqnsI integrated a PoC into torchtitan and the auto filter improved fp8 rowwise perf both local Llama3 8b run and Llama3 70b MAST run, compared to the default filter_fn we have now.
It prevents users from hitting this common footgun, while also preserving the flexibility to define their model-specific fqns.
Results
See pytorch/torchtitan#1207 for Llama3 70b results, TL;DR is filtering wk and wv improves TPS ~10% for vanilla TP and ~15% for async TP.