Skip to content

Add FlashAttention3 to CP implementations - #1232

Merged
cyanguwa merged 19 commits into
NVIDIA:mainfrom
xrennvidia:xren/cp_fa3
Oct 11, 2024
Merged

cyanguwa merged 19 commits into
NVIDIA:mainfrom
xrennvidia:xren/cp_fa3

Conversation

@xrennvidia

@xrennvidia xrennvidia commented Oct 8, 2024 •

Copy link
Copy Markdown
Collaborator

Description

Enable FA3 in all CP implementation. Work in BF16 and FP16 now.

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

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

@xrennvidia

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

@xrennvidia
xrennvidia requested review from cyanguwa and ksivaman and removed request for ksivaman October 11, 2024 03:04
@cyanguwa
cyanguwa merged commit b36bd0a into NVIDIA:main Oct 11, 2024
@xrennvidia
xrennvidia deleted the xren/cp_fa3 branch October 11, 2024 18:46
timmoon10 pushed a commit to timmoon10/TransformerEngine that referenced this pull request Nov 7, 2024
* fa2 function import renaming

Signed-off-by: Xiaowei Ren <[email protected]>

* refine fa_fwd_kwargs and fa_bwd_kwargs

Signed-off-by: Xiaowei Ren <[email protected]>

* import FA3 fucntions for CP

Signed-off-by: Xiaowei Ren <[email protected]>

* fix output of FA3 fwd

Signed-off-by: Xiaowei Ren <[email protected]>

* fix rng_state in a2a implementation with FA3

Signed-off-by: Xiaowei Ren <[email protected]>

* hack lse correction for packed lse format

Signed-off-by: Xiaowei Ren <[email protected]>

* make CP thd out correction work with packed lse

Signed-off-by: Xiaowei Ren <[email protected]>

* fix for packed softmax_lse

Signed-off-by: Xiaowei Ren <[email protected]>

* fix softmax_lse shape

Signed-off-by: Xiaowei Ren <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* change lse_packed to constexpr

Signed-off-by: Xiaowei Ren <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Xiaowei Ren <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Charlene Yang <[email protected]>
xiaoteng-cui-mt pushed a commit to MooreThreads/MT-TransformerEngine that referenced this pull request Oct 9, 2026
* fa2 function import renaming

Signed-off-by: Xiaowei Ren <[email protected]>

* refine fa_fwd_kwargs and fa_bwd_kwargs

Signed-off-by: Xiaowei Ren <[email protected]>

* import FA3 fucntions for CP

Signed-off-by: Xiaowei Ren <[email protected]>

* fix output of FA3 fwd

Signed-off-by: Xiaowei Ren <[email protected]>

* fix rng_state in a2a implementation with FA3

Signed-off-by: Xiaowei Ren <[email protected]>

* hack lse correction for packed lse format

Signed-off-by: Xiaowei Ren <[email protected]>

* make CP thd out correction work with packed lse

Signed-off-by: Xiaowei Ren <[email protected]>

* fix for packed softmax_lse

Signed-off-by: Xiaowei Ren <[email protected]>

* fix softmax_lse shape

Signed-off-by: Xiaowei Ren <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* change lse_packed to constexpr

Signed-off-by: Xiaowei Ren <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Xiaowei Ren <[email protected]>
Signed-off-by: Charlene Yang <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Charlene Yang <[email protected]>
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