Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotary Embedding NKI Kernel Tutorial #53

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

apatwal72
Copy link

Issue #, if available:

N/A

Description of changes:

NKI kernel tutorial for applying rotary embedding to query, key tensors. Included benchmarking, and correctness tests with script

Testing:

Please see detailed unit test requirements in the CONTRIBUTING.md

  • The change is covered by numeric check using nki.baremetal
  • The change is covered by performance benchmark test using nki.benchmark
  • The change is covered by end-to-end integration test

Pull Request Checklist

  • I have filled in all the required field in the template
  • I have tested locally that all the tests pass
  • By submitting this pull request, I confirm that my contribution is made under the terms of the MIT-0 license.

JonathanHenson
JonathanHenson previously approved these changes Mar 19, 2025
specify indicies for other dims when storing tiles
aws-qieqingy
aws-qieqingy previously approved these changes Mar 19, 2025
Copy link
Contributor

@aws-qieqingy aws-qieqingy left a comment

Choose a reason for hiding this comment

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

We cannot merge this at the moment. The source of the tutorial is now hosted in an internal location and is displayed at https://awsdocs-neuron.readthedocs-hosted.com/en/latest/general/nki/tutorials.html. All of the existing tutorial has a RTD file that is in a certain format. We plan to migrate the tutorial source code to this repo soon and then we can add the RST file for this tutorial as well.

@aws-qieqingy aws-qieqingy dismissed their stale review March 20, 2025 03:25

Cannot merge for now due to reason stated in a separate comment.

"""
# Rotate Q
output_tile[0, :, :] = q_tile * cos_tile
output_tile[0, :, : q_tile.shape[-1] // 2] = output_tile[
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to assert q_tile.shape[-1] % 2 == 0

also could we assign q_tile.shape[-1] to a temp variable such that we dont need to type q_tile.shape[-1] repeatedly?

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.

5 participants