Merged
Conversation
- Added the `flash_sparse_forward.py` file containing the implementation of the Flash Sparse Attention forward kernel, including the `_fwd_inner_sparse_base_kernel` and `_fwd_base_sparse_kernel` functions. - Updated the `interface.py` file to import the new Flash Sparse Attention forward functions from the newly created `flash_sparse_forward` module. - Renamed imports for consistency, changing `flash_dense_fwd` to `flash_dense_forward`, `flash_dense_bwd` to `flash_dense_backward`, `flash_sparse_fwd` to `flash_sparse_forward`, `flash_sparse_bwd` to `flash_sparse_backward`, `flash_gated_fwd` to `flash_gated_forward`, and `flash_gated_bwd` to `flash_gated_backward`.
Contributor
There was a problem hiding this comment.
Pull request overview
Renames Triton attention implementation modules (fwd/bwd) to clearer *_forward / *_backward names and updates call sites to use newly split-out Triton helper kernels for forward combine and backward pre/post-processing.
Changes:
- Update imports in tests and Triton interface to new module names (
*_forward,*_backward). - Replace references to old combine/preprocess/postprocess modules with new modules (
flash_combine,flash_backward_preprocess,flash_backward_postprocess). - Add new Triton kernel modules for forward combine and backward pre/post-processing.
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_utils.py | Updates imports to renamed Triton modules. |
| flash_sparse_attn/ops/triton/interface.py | Updates public Triton interface imports to renamed modules. |
| flash_sparse_attn/ops/triton/flash_dense_forward.py | Switches split-KV combine call to flash_combine. |
| flash_sparse_attn/ops/triton/flash_dense_backward.py | Switches backward pre/post calls to new modules. |
| flash_sparse_attn/ops/triton/flash_sparse_forward.py | Switches split-KV combine call to flash_combine. |
| flash_sparse_attn/ops/triton/flash_sparse_backward.py | Switches backward pre/post calls to new modules. |
| flash_sparse_attn/ops/triton/flash_gated_forward.py | Switches split-KV combine call to flash_combine. |
| flash_sparse_attn/ops/triton/flash_gated_backward.py | Switches backward pre/post calls to new modules. |
| flash_sparse_attn/ops/triton/flash_combine.py | New Triton kernel wrapper for combining split-KV forward partials. |
| flash_sparse_attn/ops/triton/flash_backward_preprocess.py | New Triton kernel wrapper for backward preprocess (dPsum, LSE log2, dq_accum init). |
| flash_sparse_attn/ops/triton/flash_backward_postprocess.py | New Triton kernel wrapper for backward postprocess (scale/store dq and optional da). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.