Skip to content

Conversation

@LoserCheems
Copy link
Collaborator

This pull request refactors the handling of the causal mask in the compute_attn_1rowblock function to improve code clarity and maintainability. Instead of using a ternary operator to conditionally initialize tCausalMaskgCausalMask and tCausalMasksCausalMask, the code now uses a more explicit if block.

Key change in causal mask handling:

  • csrc/src/flash_attention_fwd_kernel.h: Replaced the ternary operator with an if block for initializing tCausalMaskgCausalMask and tCausalMasksCausalMask when has_causal_mask is true. This refactor improves readability and ensures that the variables are only initialized when necessary.

@LoserCheems LoserCheems merged commit bda46e3 into main May 19, 2025
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.

3 participants