Skip to content

feat(ir, ptx): implement FlashAttention-2 with online softmax - #6

Merged
rahadbhuiya merged 1 commit into
Exploidus:mainfrom
rahadbhuiya:feat/flash-attention-2
Nov 27, 2026
Merged

rahadbhuiya merged 1 commit into
Exploidus:mainfrom
rahadbhuiya:feat/flash-attention-2

Conversation

@rahadbhuiya

Copy link
Copy Markdown
Member

Replaces the placeholder emit_flash_attention kernel with an online softmax implementation (m_i running max and l_i normalizer) in O(N) memory, with causal masking and multi-head support.

Added KernelModule::with_flash_attention in tessera-ir and wired PtxGenerator::compile to emit it.

Tested on RTX 3060 (causal and non-causal, seq_len=64, head_dim=64, 2 heads) against a CPU reference (max_diff < 1e-4), plus cargo test.

Closes #2

@rahadbhuiya
rahadbhuiya merged commit b7df1c2 into Exploidus:main Nov 27, 2026
2 checks passed
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.

feat(ir, ptx): Native FlashAttention-2 kernel with online softmax

1 participant