Skip to content

Conversation

@apoorvtintin
Copy link
Contributor

This PR adds support for flash attention kernel for Neuron implemented through Neuron Kernel Interface (NKI).

The flash attention kernel works with TRN1 and TRN2.

@@ -0,0 +1,129 @@
from absl import logging
Copy link
Contributor

Choose a reason for hiding this comment

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

Copyright?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also please add comments for the file.

return out


def _mha_forward(query, key, value, bias, causal, softmax_scale):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get a support for segment ID and dropout as well? Both are quite needed nowadays.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Segment ID support is in progress and will be added soon

Copy link
Contributor

@ruomingp ruomingp left a comment

Choose a reason for hiding this comment

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

Will defer to @kelvin-zou for approval.

@apoorvtintin
Copy link
Contributor Author

This has been implemented in a new PR #939. That PR addresses all comments in this PR but is from a different fork of Axlearn.

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.

4 participants