Vectorize KV-Cache by using Vec4 - #222
Draft
officialcjunior wants to merge 2 commits into
Draft
Conversation
Code Metrics Report=============================================================================== Language Files Lines Code Comments Blanks =============================================================================== TOML 1 75 63 2 10 ------------------------------------------------------------------------------- Rust 62 13276 11417 185 1674 |- Markdown 34 311 0 244 67 (Total) 13587 11417 429 1741 =============================================================================== Total 63 13351 11480 187 1684 =============================================================================== |
FL33TW00D
reviewed
Jun 21, 2024
| builder.register_storage("C", BindingMode::ReadWrite, Array::<P>::default()); | ||
| builder.register_storage("S", BindingMode::ReadOnly, Array::<P>::default()); | ||
| builder.register_storage("D", BindingMode::ReadWrite, Array::<P>::default()); | ||
| builder.register_storage("C", BindingMode::ReadWrite, Array::<vec4<f32>>::default()); |
Contributor
There was a problem hiding this comment.
This will only work for vec4<f32>!
Contributor
Author
There was a problem hiding this comment.
Okay, just learnt that Vec4<T> implements WgslPrimitive for any T. Making it Array::<P> itself, from what I understand.
FL33TW00D
reviewed
Jun 21, 2024
| return; | ||
| } | ||
|
|
||
| if (dst_index[dim] < metadata.cum1) { |
Contributor
There was a problem hiding this comment.
What will happen to cum1 here if all lengths are / 4
Contributor
Author
There was a problem hiding this comment.
Hmm 🤔 . I'm still trying to understand this one and what needs to be done about it.
I suppose I need to divide cum1 by 4 in write_metadata too?
FL33TW00D
reviewed
Jun 21, 2024
…or `KernelElement`
Contributor
|
@officialcjunior Haven't forgotten about this, just working on the refactor 👍🏻 |
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.
Currently, the KV-Cache operation is scalar, this PR attempts to vectorize it.
Fixes #210