Skip to content

Refactor Transpose - #4

Open
glistening wants to merge 1 commit into
lm32from
extract_transpose
Open

Refactor Transpose#4
glistening wants to merge 1 commit into
lm32from
extract_transpose

Conversation

@glistening

Copy link
Copy Markdown
Owner

Extract the KVCache transpose logic into a reusable function.

  • Add transpose_4d() in Transpose.cc for in-place "0213" permutation.
  • Store the logical shape (_shape[4]) inside KVCache so that transpose() can derive dimensions internally, simplifying the caller in Generate.cc.
  • Update _shape after transposition using the perm string generically instead of hardcoding the "0213" case.
  • Adopt ggml-style stride naming (nb1, nb2, nb3) for byte-level strides, consistent with the nb[i] convention in ggml.

ONE-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com

Extract the KVCache transpose logic into a reusable function.

- Add transpose_4d() in Transpose.cc for in-place "0213" permutation.
- Store the logical shape (_shape[4]) inside KVCache so that
  transpose() can derive dimensions internally, simplifying the
  caller in Generate.cc.
- Update _shape after transposition using the perm string
  generically instead of hardcoding the "0213" case.
- Adopt ggml-style stride naming (nb1, nb2, nb3) for byte-level
  strides, consistent with the nb[i] convention in ggml.

ONE-DCO-1.0-Signed-off-by: Sanggyu Lee <sg5.lee@samsung.com>
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.

1 participant