File tree Expand file tree Collapse file tree 3 files changed +21
-27
lines changed
ggml/src/ggml-vulkan/vulkan-shaders Expand file tree Collapse file tree 3 files changed +21
-27
lines changed Original file line number Diff line number Diff line change @@ -14,21 +14,19 @@ void main() {
14
14
15
15
const uint row_dst = gl_GlobalInvocationID.x;
16
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
17
const uint row_x = row_dst % ne1;
27
18
const uint channel_x = row_dst / ne1;
28
19
29
20
const uint idst = row_dst*ne0 + i0/2;
30
21
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0/2;
31
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
+
32
30
const int sect_dims = p.sections[0] + p.sections[1] + p.sections[2] + p.sections[3];
33
31
const int sec_w = p.sections[1] + p.sections[0];
34
32
const uint sector = (i0 / 2) % sect_dims;
Original file line number Diff line number Diff line change @@ -13,21 +13,19 @@ void main() {
13
13
14
14
const uint row_dst = gl_GlobalInvocationID.x;
15
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
16
const uint row_x = row_dst % ne1;
26
17
const uint channel_x = row_dst / ne1;
27
18
28
19
const uint idst = row_dst*ne0 + i0/2;
29
20
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0/2;
30
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
+
31
29
const float theta_base = data_pos[channel_x] * pow(p.theta_scale, i0/2.0f);
32
30
33
31
const float freq_factor = p.has_ff != 0 ? data_ff[i0/2] : 1.0f;
Original file line number Diff line number Diff line change @@ -13,21 +13,19 @@ void main() {
13
13
14
14
const uint row_dst = gl_GlobalInvocationID.x;
15
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
16
const uint row_x = row_dst % ne1;
26
17
const uint channel_x = row_dst / ne1;
27
18
28
19
const uint idst = row_dst*ne0 + i0;
29
20
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0;
30
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
+
31
29
const float theta_base = data_pos[channel_x] * pow(p.theta_scale, i0/2.0f);
32
30
33
31
const float freq_factor = p.has_ff != 0 ? data_ff[i0/2] : 1.0f;
You can’t perform that action at this time.
0 commit comments