[KernelGen][Nvidia] Add _flash_attention_forward_no_dropout_inplace operator with Triton kernel - #5545
Open
chx7514 wants to merge 3 commits into
Open
Conversation
…n, tests and benchmark
chx7514
requested review from
0x45f,
103yiran,
Caeruleann,
bin913,
douxetpur,
hellojack163,
huangyiqun,
tengqm and
w1120029931-bit
as code owners
August 17, 2026 06:35
…on_forward_no_dropout_inplace
chx7514
force-pushed
the
pr/_flash_attention_forward_no_dropout_inplace
branch
from
August 17, 2026 06:58
fcc9a39 to
dcf70a0
Compare
bin913
reviewed
Aug 17, 2026
|
|
||
| # In-place semantics: the result is written back into ``query``. | ||
| query.copy_(out) | ||
| return query, lse, philox_seed, philox_offset, debug_attn_mask |
Collaborator
There was a problem hiding this comment.
Could this be implemented by adding a new interface in flash_api only, without introducing a new operator interface?
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.
Summary
Adds a Triton kernel for
_flash_attention_forward_no_dropout_inplace. Triton kernel implementation for _flash_attention_forward_no_dropout_inplace.A specialised variant of _flash_attention_forward that drops the dropout
argument (implicitly dropout_p=0.0) and writes the attention output in-place.
Testing
to_reference(inp, True)Performance
Test command:
pytest benchmark/test_flash_attention_forward_no_dropout_inplace.py --level core(NVIDIA H20)flash_attention_forward_no_dropout_inplace
Multi-backend Testing
Files Changed
src/flag_gems/ops/_flash_attention_forward_no_dropout_inplace.py: Triton kernel implementationtests/test_flash_attention_forward_no_dropout_inplace.py: Accuracy testbenchmark/test_flash_attention_forward_no_dropout_inplace.py: Performance benchmarksrc/flag_gems/ops/__init__.py: Register import and__all__src/flag_gems/__init__.py: Register to_FULL_CONFIGconf/operators.yaml: Add operator entry (kind: NeuralNetwork, stage: alpha 5.4)