mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-11-15 15:29:53 +00:00
f3f65429c4
* scripts : update sync [no ci] * files : relocate [no ci] * ci : disable kompute build [no ci] * cmake : fixes [no ci] * server : fix mingw build ggml-ci * cmake : minor [no ci] * cmake : link math library [no ci] * cmake : build normal ggml library (not object library) [no ci] * cmake : fix kompute build ggml-ci * make,cmake : fix LLAMA_CUDA + replace GGML_CDEF_PRIVATE ggml-ci * move public backend headers to the public include directory (#8122) * move public backend headers to the public include directory * nix test * spm : fix metal header --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com> * scripts : fix sync paths [no ci] * scripts : sync ggml-blas.h [no ci] --------- Co-authored-by: slaren <slarengh@gmail.com>
38 lines
901 B
Plaintext
38 lines
901 B
Plaintext
#version 450
|
|
|
|
#include "rope_head.comp"
|
|
|
|
void main() {
|
|
const uint col = gl_GlobalInvocationID.y * 2;
|
|
const uint row = gl_GlobalInvocationID.x;
|
|
|
|
if (col >= p.ncols) {
|
|
return;
|
|
}
|
|
|
|
if (col >= p.n_dims) {
|
|
const uint i = row*p.ncols + col;
|
|
|
|
data_d[i + 0] = data_a[i + 0];
|
|
data_d[i + 1] = data_a[i + 1];
|
|
|
|
return;
|
|
}
|
|
|
|
const uint i = row*p.ncols + col;
|
|
const uint i2 = row/p.p_delta_rows;
|
|
|
|
const float theta_base = data_pos[i2] * pow(p.theta_scale, col/2.0f);
|
|
|
|
const float freq_factor = p.has_ff != 0 ? data_ff[col/2] : 1.0f;
|
|
|
|
float cos_theta, sin_theta;
|
|
rope_yarn(theta_base / freq_factor, col, cos_theta, sin_theta);
|
|
|
|
const float x0 = float(data_a[i + 0]);
|
|
const float x1 = float(data_a[i + 1]);
|
|
|
|
data_d[i + 0] = D_TYPE(x0*cos_theta - x1*sin_theta);
|
|
data_d[i + 1] = D_TYPE(x0*sin_theta + x1*cos_theta);
|
|
}
|