Spaces:
Running
Running
Commit ·
367fa85
1
Parent(s): aaf2d96
vulkan : fix rope with partial rotation and non-cont src (llama/14582)
Browse files
ggml/src/ggml-vulkan/vulkan-shaders/rope_multi.comp
CHANGED
|
@@ -14,21 +14,19 @@ void main() {
|
|
| 14 |
|
| 15 |
const uint row_dst = gl_GlobalInvocationID.x;
|
| 16 |
|
| 17 |
-
if (i0 >= p.n_dims) {
|
| 18 |
-
const uint i = row_dst*ne0 + i0;
|
| 19 |
-
|
| 20 |
-
data_d[i + 0] = data_a[i + 0];
|
| 21 |
-
data_d[i + 1] = data_a[i + 1];
|
| 22 |
-
|
| 23 |
-
return;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
const uint row_x = row_dst % ne1;
|
| 27 |
const uint channel_x = row_dst / ne1;
|
| 28 |
|
| 29 |
const uint idst = row_dst*ne0 + i0/2;
|
| 30 |
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0/2;
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
const int sect_dims = p.sections[0] + p.sections[1] + p.sections[2] + p.sections[3];
|
| 33 |
const int sec_w = p.sections[1] + p.sections[0];
|
| 34 |
const uint sector = (i0 / 2) % sect_dims;
|
|
|
|
| 14 |
|
| 15 |
const uint row_dst = gl_GlobalInvocationID.x;
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
const uint row_x = row_dst % ne1;
|
| 18 |
const uint channel_x = row_dst / ne1;
|
| 19 |
|
| 20 |
const uint idst = row_dst*ne0 + i0/2;
|
| 21 |
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0/2;
|
| 22 |
|
| 23 |
+
if (i0 >= p.n_dims) {
|
| 24 |
+
data_d[idst + i0/2 + 0] = data_a[ix + i0/2 + 0];
|
| 25 |
+
data_d[idst + i0/2 + 1] = data_a[ix + i0/2 + 1];
|
| 26 |
+
|
| 27 |
+
return;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
const int sect_dims = p.sections[0] + p.sections[1] + p.sections[2] + p.sections[3];
|
| 31 |
const int sec_w = p.sections[1] + p.sections[0];
|
| 32 |
const uint sector = (i0 / 2) % sect_dims;
|
ggml/src/ggml-vulkan/vulkan-shaders/rope_neox.comp
CHANGED
|
@@ -13,21 +13,19 @@ void main() {
|
|
| 13 |
|
| 14 |
const uint row_dst = gl_GlobalInvocationID.x;
|
| 15 |
|
| 16 |
-
if (i0 >= p.n_dims) {
|
| 17 |
-
const uint i = row_dst*ne0 + i0;
|
| 18 |
-
|
| 19 |
-
data_d[i + 0] = data_a[i + 0];
|
| 20 |
-
data_d[i + 1] = data_a[i + 1];
|
| 21 |
-
|
| 22 |
-
return;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
const uint row_x = row_dst % ne1;
|
| 26 |
const uint channel_x = row_dst / ne1;
|
| 27 |
|
| 28 |
const uint idst = row_dst*ne0 + i0/2;
|
| 29 |
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0/2;
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
const float theta_base = data_pos[channel_x] * pow(p.theta_scale, i0/2.0f);
|
| 32 |
|
| 33 |
const float freq_factor = p.has_ff != 0 ? data_ff[i0/2] : 1.0f;
|
|
|
|
| 13 |
|
| 14 |
const uint row_dst = gl_GlobalInvocationID.x;
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
const uint row_x = row_dst % ne1;
|
| 17 |
const uint channel_x = row_dst / ne1;
|
| 18 |
|
| 19 |
const uint idst = row_dst*ne0 + i0/2;
|
| 20 |
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0/2;
|
| 21 |
|
| 22 |
+
if (i0 >= p.n_dims) {
|
| 23 |
+
data_d[idst + i0/2 + 0] = data_a[ix + i0/2 + 0];
|
| 24 |
+
data_d[idst + i0/2 + 1] = data_a[ix + i0/2 + 1];
|
| 25 |
+
|
| 26 |
+
return;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
const float theta_base = data_pos[channel_x] * pow(p.theta_scale, i0/2.0f);
|
| 30 |
|
| 31 |
const float freq_factor = p.has_ff != 0 ? data_ff[i0/2] : 1.0f;
|
ggml/src/ggml-vulkan/vulkan-shaders/rope_norm.comp
CHANGED
|
@@ -13,21 +13,19 @@ void main() {
|
|
| 13 |
|
| 14 |
const uint row_dst = gl_GlobalInvocationID.x;
|
| 15 |
|
| 16 |
-
if (i0 >= p.n_dims) {
|
| 17 |
-
const uint i = row_dst*ne0 + i0;
|
| 18 |
-
|
| 19 |
-
data_d[i + 0] = data_a[i + 0];
|
| 20 |
-
data_d[i + 1] = data_a[i + 1];
|
| 21 |
-
|
| 22 |
-
return;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
const uint row_x = row_dst % ne1;
|
| 26 |
const uint channel_x = row_dst / ne1;
|
| 27 |
|
| 28 |
const uint idst = row_dst*ne0 + i0;
|
| 29 |
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0;
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
const float theta_base = data_pos[channel_x] * pow(p.theta_scale, i0/2.0f);
|
| 32 |
|
| 33 |
const float freq_factor = p.has_ff != 0 ? data_ff[i0/2] : 1.0f;
|
|
|
|
| 13 |
|
| 14 |
const uint row_dst = gl_GlobalInvocationID.x;
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
const uint row_x = row_dst % ne1;
|
| 17 |
const uint channel_x = row_dst / ne1;
|
| 18 |
|
| 19 |
const uint idst = row_dst*ne0 + i0;
|
| 20 |
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0;
|
| 21 |
|
| 22 |
+
if (i0 >= p.n_dims) {
|
| 23 |
+
data_d[idst + 0] = data_a[ix + 0];
|
| 24 |
+
data_d[idst + 1] = data_a[ix + 1];
|
| 25 |
+
|
| 26 |
+
return;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
const float theta_base = data_pos[channel_x] * pow(p.theta_scale, i0/2.0f);
|
| 30 |
|
| 31 |
const float freq_factor = p.has_ff != 0 ? data_ff[i0/2] : 1.0f;
|