feat(attention): emit forward LSE and harden matmul tuning - #428
Draft
ppodolsky wants to merge 4 commits into
Draft
feat(attention): emit forward LSE and harden matmul tuning#428ppodolsky wants to merge 4 commits into
ppodolsky wants to merge 4 commits into
Conversation
4 tasks
This was referenced Jul 18, 2026
ppodolsky
force-pushed
the
feat/attention-forward-lse
branch
from
July 18, 2026 10:00
93682a1 to
d3b1bce
Compare
The flash forward's running (max, sum) state was discarded after the rescale; a FlashAttention backward needs the per-row log-sum-exp to recompute probabilities without materializing scores. New additive path: - BounceTile::store_row_lse writes m + ln(l) per absolute row through the whitebox fragment layout (the unit owning a row's first column writes; rows below the fully-masked threshold receive exactly -inf, matching the CPU reference convention), with a Tile-level dispatcher. - StageAttention::write_lse / GlobalAttention::execute_with_lse / BatchAttention::execute_with_lse thread a flat [batch * heads, seq_q] FP32 tensor through the existing layers; the global layer emits before the rescale consumes the state. - attention_with_lse entry point + BatchAttentionFamily:: launch_unchecked_with_lse + public launch_ref_with_lse / launch_attention_with_lse. Only the cmma (BlackboxAccelerated) routine emits LSE; the unit routine reports InvalidConfig loudly. Every existing signature is untouched.
ppodolsky
force-pushed
the
feat/attention-forward-lse
branch
from
August 1, 2026 07:52
d3b1bce to
17fcf4a
Compare
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.
Summary
This PR absorbs the temporary compatibility-only draft #429 so CubeK has one upstream review thread.
The LSE output is flat
[batch * heads, seq_q], uses natural log, and writes negative infinity for fully masked rows. Existinglaunch_refand component signatures retain their behavior.The matmul key keeps anchored M/N/K buckets and bounded cardinality. It adds only two stride-legality classes per operand: 16-byte aligned or not aligned. This prevents a cached async-copy/TMA candidate from failing when a later raw shape in the same bucket has incompatible strides.
Dependency validation
mainis the direct base of this branch.tracel-ai/*repositories.Validation
cargo fmt --all -- --checkcargo test -p cubek-matmul strategy::tune_key --libcargo check -p cubek-attentioncargo test -p cubek-attention --no-runThe current Linux CI failure occurred in runner setup: Microsoft's Ubuntu apt repositories returned HTTP 403 before checkout/build tests began. Code-quality and documentation jobs passed.