Skip to content

Stacked projections - #1279

Draft
odilf wants to merge 6 commits into
block-attention-residualsfrom
stacked-projections
Draft

odilf wants to merge 6 commits into
block-attention-residualsfrom
stacked-projections

Conversation

@odilf

@odilf odilf commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

This is honestly a bit slopped out, but it seems that it's mostly inside attention so the blast radius should be reasonably contained.

Also implements output convs.

No support for speculator yet because that also involves implementing DFlare and DSpark and in general it seems very nontrivial.

I've also left as unimplemented! separate projections for non-stacked, since that is never hit, and this PR has already enough stuff.

that's all for inkling, except MoE (with soft capped SiLU).

@odilf
odilf added this pull request to stack #1266 November 30, 2026 15:43
@odilf
odilf force-pushed the stacked-projections branch from e316eec to 7bb7ad4 Compare November 30, 2026 15:57
@odilf
odilf force-pushed the stacked-projections branch 3 times, most recently from a9ba2cc to c9c511f Compare November 30, 2026 19:59
@odilf
odilf force-pushed the stacked-projections branch 2 times, most recently from 37625ff to 99b711a Compare December 1, 2026 20:17
@odilf
odilf force-pushed the stacked-projections branch from 99b711a to 9a60ba5 Compare December 2, 2026 11:02
@odilf
odilf force-pushed the stacked-projections branch from 9a60ba5 to eaef4d2 Compare December 2, 2026 11:16
@odilf
odilf force-pushed the stacked-projections branch from eaef4d2 to c382fca Compare December 2, 2026 18:24
@odilf
odilf force-pushed the stacked-projections branch from c382fca to dd0e3ff Compare December 2, 2026 22:42
Comment on lines +222 to +227
let mut copy = |block: usize| {
let mut copy = command_buffer.allocate_scratch(block_size).map_err(AttentionEncodeError::Backend)?;
command_buffer.encode_copy((&hidden).subrange(block * block_size..(block + 1) * block_size), &mut copy);
Ok::<_, AttentionEncodeError<B>>(copy)
};
let (key, value) = (copy(key_block)?, copy(value_block)?);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could K/V projections read slices of existing buffer directly? so no need for scratch copies.

This branch has not been deployed

No deployments
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.

2 participants