-
Notifications
You must be signed in to change notification settings - Fork 20
[FA] Unify Base + Opt FWD kernels #233
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
Open
codingwithsurya
wants to merge
3
commits into
main
Choose a base branch
from
export-D75388323
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
This pull request was exported from Phabricator. Differential Revision: D75388323 |
Summary: This PR consolidates redundant TMA attention kernels into a unified implementation. Previously, `_attn_fwd_tma` and `_attn_fwd_tma_ws` contained duplicate code (mainly the TMA descriptors) and didn't leverage the existing `ENABLE_WS` flag. I've merged the redundant kernels into a single `_attn_fwd_tma_unified` kernel. We now use the `ENABLE_WS` flag to toggle between regular and warp-specialized execution. Changes: * Merged both kernels into `_attn_fwd_tma_unified` kernel with handling of regular and warp-specialized paths * Utilized existing `ENABLE_WS` parameter to control warp specialization * Unified TMA descriptor creation logic Differential Revision: D75307125
Summary: Separated the TMA kernel variant handling into distinct code paths rather than using a conditional parameter. Changed from a unified approach with a dynamic `is_warp_specialized` flag to explicit separate conditions for `tma` and `tma_ws` variants. This improves code clarity by making the execution path more explicit + makes it easier for compiler to optimize. Differential Revision: D75308966
Summary: I merged the "base" (`_attn_fwd`) and "opt" (`_attn_fwd_opt`) variants of the forward pass of the attention kernel into a single `_attn_fwd_unified` kernel to streamline the codebase and avoid redundancy. Both the base and opt kernels were great candidates to be merged since they were nearly identical code paths. I still need to integrate the warp spec path (`attn_fwd_ws`) after some bug-fixing. For now it's still available as its own autotuned kernel. Differential Revision: D75388323
0c93d76
to
5566672
Compare
This pull request was exported from Phabricator. Differential Revision: D75388323 |
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:
I merged the "base" (
_attn_fwd
) and "opt" (_attn_fwd_opt
) variants of the forward pass of the attention kernel into a single_attn_fwd_unified
kernel to streamline the codebase and avoid redundancy. Both the base and opt kernels were great candidates to be merged since they were nearly identical code paths.This PR also includes diffs from #232 due to Github Export from Phabricator. #232 should be merged before this.
Test Plan:
Unit Tests and Benchmarking
Differential Revision: D75388323