Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions ggml/src/ggml-vulkan/vulkan-shaders/rope_multi.comp
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ void main() {

const uint row_dst = gl_GlobalInvocationID.x;

if (i0 >= p.n_dims) {
const uint i = row_dst*ne0 + i0;

data_d[i + 0] = data_a[i + 0];
data_d[i + 1] = data_a[i + 1];

return;
}

const uint row_x = row_dst % ne1;
const uint channel_x = row_dst / ne1;

const uint idst = row_dst*ne0 + i0/2;
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0/2;

if (i0 >= p.n_dims) {
data_d[idst + i0/2 + 0] = data_a[ix + i0/2 + 0];
data_d[idst + i0/2 + 1] = data_a[ix + i0/2 + 1];

return;
}

const int sect_dims = p.sections[0] + p.sections[1] + p.sections[2] + p.sections[3];
const int sec_w = p.sections[1] + p.sections[0];
const uint sector = (i0 / 2) % sect_dims;
Expand Down
16 changes: 7 additions & 9 deletions ggml/src/ggml-vulkan/vulkan-shaders/rope_neox.comp
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ void main() {

const uint row_dst = gl_GlobalInvocationID.x;

if (i0 >= p.n_dims) {
const uint i = row_dst*ne0 + i0;

data_d[i + 0] = data_a[i + 0];
data_d[i + 1] = data_a[i + 1];

return;
}

const uint row_x = row_dst % ne1;
const uint channel_x = row_dst / ne1;

const uint idst = row_dst*ne0 + i0/2;
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0/2;

if (i0 >= p.n_dims) {
data_d[idst + i0/2 + 0] = data_a[ix + i0/2 + 0];
data_d[idst + i0/2 + 1] = data_a[ix + i0/2 + 1];

return;
}

const float theta_base = data_pos[channel_x] * pow(p.theta_scale, i0/2.0f);

const float freq_factor = p.has_ff != 0 ? data_ff[i0/2] : 1.0f;
Expand Down
16 changes: 7 additions & 9 deletions ggml/src/ggml-vulkan/vulkan-shaders/rope_norm.comp
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ void main() {

const uint row_dst = gl_GlobalInvocationID.x;

if (i0 >= p.n_dims) {
const uint i = row_dst*ne0 + i0;

data_d[i + 0] = data_a[i + 0];
data_d[i + 1] = data_a[i + 1];

return;
}

const uint row_x = row_dst % ne1;
const uint channel_x = row_dst / ne1;

const uint idst = row_dst*ne0 + i0;
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0;

if (i0 >= p.n_dims) {
data_d[idst + 0] = data_a[ix + 0];
data_d[idst + 1] = data_a[ix + 1];

return;
}

const float theta_base = data_pos[channel_x] * pow(p.theta_scale, i0/2.0f);

const float freq_factor = p.has_ff != 0 ? data_ff[i0/2] : 1.0f;
Expand Down
Loading