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

Switch to NP from Jax to improve attention manager performance #184

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

FanhaiLu1
Copy link
Collaborator

@FanhaiLu1 FanhaiLu1 commented Sep 19, 2024

Current Jax implementation is slow. The operation array is tiny, leverage NP compute in CPU can boost the performance.

The performance improved >30x. Below are two benchmark comparison before vs after this PR:

Before
Total: 16 ms, fill_new_page: 3ms, get_page_token_indices: 13ms

After
Total: 0.5 ms, to_nparray: 0.1 ms, fill_new_page: 0.01ms, get_page_token_indices: 0.05 ms to_jax_array:0.3 ms

@FanhaiLu1
Copy link
Collaborator Author

@qihqi @wang2yn84 Please take a look and review this PR.

@FanhaiLu1 FanhaiLu1 merged commit f1fa78c into AI-Hypercomputer:main Sep 24, 2024
5 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.

2 participants