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.
This pull request introduces several changes to the
flash_attentioncodebase, focusing on simplifying code, removing unused functionality, and improving memory layout and kernel generation. The most significant changes include the removal of split-key-value (split-KV) functionality, the introduction of a kernel generation script, and updates to memory layout and masking logic for better performance and maintainability.Removal of Split-KV Functionality:
flash_fwd_launch_template.h, simplifying the forward pass implementation. [1] [2]Introduction of Kernel Generation Script:
generate_kernels.py, a script to auto-generate kernel instantiations for different head dimensions, data types, and causal configurations. This reduces manual kernel definition and improves maintainability.Memory Layout and Masking Improvements:
kernel_traits.hto optimize dynamic masking and zero-hold states, including new layouts for mask values, sort keys, and indices.mask.hto eliminate unnecessary pointer checks and improve clarity.mask.hto use tensor-based shared memory buffers, improving type safety and flexibility.Code Simplification:
index_ttype definition inflash.hto a single global typedef, removing redundant definitions in multiple structs. [1] [2]causal_mask_ptr, fromFlash_fwd_paramsandFlash_bwd_paramsstructs inflash.h. [1] [2]Documentation and References:
kernel_traits.hto clarify the source of a memory layout definition, improving code documentation.