Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PyTorch] Miscellaneous fixes for FA3 FP8 attention #1174

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

cyanguwa
Copy link
Collaborator

@cyanguwa cyanguwa commented Sep 10, 2024

Description

This PR makes a few changes to the FA3 FP8 attention path:

  • Adds descale_q, descale_k and descale_v to the FA3 call. This allows custom descaling factors for q/k/v instead of 1s. This requires FA3 PR 1210.
  • Fixes the transpose in the qkv_format=sbhd case when fp8_mha=true.
  • Replaces the FA3 installation warning with a debug-level logging message.
  • Casts FA3 output to the same type as cuDNN attention in the unit test.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refractor

Changes

Please list the changes introduced in this PR:

  • See description above.

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@cyanguwa
Copy link
Collaborator Author

/te-ci pytorch

@cyanguwa cyanguwa marked this pull request as ready for review September 10, 2024 17:24
@cyanguwa
Copy link
Collaborator Author

/te-ci pytorch

@cyanguwa
Copy link
Collaborator Author

FA3: pipeline 18489052

@cyanguwa cyanguwa changed the title [PyTorch] Add qkv descales to FA3 [PyTorch] Miscellaneous fixes for FlashAttention with FA3 Sep 18, 2024
@cyanguwa cyanguwa changed the title [PyTorch] Miscellaneous fixes for FlashAttention with FA3 [PyTorch] Miscellaneous fixes for FA3 FP8 attention Sep 18, 2024
@cyanguwa
Copy link
Collaborator Author

/te-ci pytorch

@cyanguwa
Copy link
Collaborator Author

/te-ci pytorch

@cyanguwa
Copy link
Collaborator Author

FA3 pipeline 18528978

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants