Add FA4 fp8 backend to low precision attention api#3947
Draft
howardzhang-cv wants to merge 18 commits intogh/howardzhang-cv/22/basefrom
Draft
Add FA4 fp8 backend to low precision attention api#3947howardzhang-cv wants to merge 18 commits intogh/howardzhang-cv/22/basefrom
howardzhang-cv wants to merge 18 commits intogh/howardzhang-cv/22/basefrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3947
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 1 Unrelated FailureAs of commit 97eb634 with merge base 5ebd10d ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Feb 25, 2026
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Feb 25, 2026
ghstack-source-id: 77f98b3 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Feb 25, 2026
ghstack-source-id: 77f98b3 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Feb 25, 2026
ghstack-source-id: 2f1a14b Pull-Request: pytorch#3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Feb 26, 2026
ghstack-source-id: 2f1a14b Pull-Request: pytorch#3947
This was referenced Feb 27, 2026
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Feb 27, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: e19aa27 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Feb 28, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: e19aa27 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Feb 28, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: e19aa27 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
that referenced
this pull request
Feb 28, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: ae76df9 Pull-Request: #3947
howardzhang-cv
added a commit
that referenced
this pull request
Feb 28, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: c9df159 Pull-Request: #3947
howardzhang-cv
added a commit
that referenced
this pull request
Feb 28, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: d2d46d6 Pull-Request: #3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Mar 2, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: d2d46d6 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
that referenced
this pull request
Mar 2, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: 3ac9da1 Pull-Request: #3947
howardzhang-cv
added a commit
that referenced
this pull request
Mar 3, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: 2e69d43 Pull-Request: #3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Mar 3, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: 2e69d43 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
that referenced
this pull request
Mar 3, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: 843d1d7 Pull-Request: #3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Mar 3, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: 2e69d43 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Mar 5, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: 2e69d43 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
to howardzhang-cv/ao
that referenced
this pull request
Mar 5, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: 2e69d43 Pull-Request: pytorch#3947
howardzhang-cv
added a commit
that referenced
this pull request
Mar 5, 2026
Adds the compile path (fuse_rope=True) for the FA4 backend, mirroring the FA3 fusion pass structure via the shared custom op and fusion pass factories. Key additions: - fp8_fa4/fusion_pass.py: FA4-specific custom ops and compile helper - fp8_fa4_rope_sdpa entry point in attention.py - Replace placeholder compile_fn with real fusion pass in setup.py - Wire up FA4 rope_sdpa_fn in test backend config ghstack-source-id: db41738 Pull-Request: #3947
This was referenced Mar 11, 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.
Stack from ghstack (oldest at bottom):
Summary
New Files
Modified Files
Test Plan
python -m pytest test/prototype/attention/test_fp8_attention.py -vExample Usage
Results
Single-Layer Results
Results directly comparing FA4 SDPA versus FA4 fp8 SDPA (including quantization time):

Llama3 Model Results
Results comparing Llama3 model with FA4 SDPA versus Llama3 using the FA4 fp8 wrapper. Uses RoPE fusion.

Perplexity: 6.19 -> 6.24