Skip to content

Commit

Permalink
Make qrot, krot contiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
Galunid committed Nov 12, 2023
1 parent 047032d commit be2ac38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4712,20 +4712,20 @@ struct llm_build_context {
cb(Vcur, "Vcur", il);

// RoPE the first n_rot of q/k, pass the other half, and concat.
struct ggml_tensor * qrot = ggml_view_3d(
struct ggml_tensor * qrot = ggml_cont(ctx0, ggml_view_3d(
ctx0, tmpq, hparams.n_rot, n_head, n_tokens,
ggml_element_size(tmpq) * n_embd_head,
ggml_element_size(tmpq) * n_embd_head * n_head,
0
);
));
cb(qrot, "qrot", il);

struct ggml_tensor * krot = ggml_view_3d(
struct ggml_tensor * krot = ggml_cont(ctx0, ggml_view_3d(
ctx0, tmpk, hparams.n_rot, n_head, n_tokens,
ggml_element_size(tmpk) * n_embd_head,
ggml_element_size(tmpk) * n_embd_head * n_head_kv,
0
);
));
cb(krot, "krot", il);

// get the second half of tmpq, e.g tmpq[n_rot:, :, :]
Expand Down

0 comments on commit be2ac38

Please sign in to comment.