Skip to content

Commit d0b8372

Browse files
committed
fix: Expected input to have different bit width from Result Type: FConvert
1 parent e4a7159 commit d0b8372

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

ggml/src/ggml-vulkan/vulkan-shaders/rope_multi.comp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ void main() {
2121
const uint ix = channel_x*p.s2 + row_x*p.s1 + i0/2;
2222

2323
if (i0 >= p.n_dims) {
24+
#ifdef ROPE_SAME_TYPE
2425
data_d[idst + i0/2 + 0] = data_a[ix + i0/2 + 0];
2526
data_d[idst + i0/2 + 1] = data_a[ix + i0/2 + 1];
27+
#else
28+
data_d[idst + i0/2 + 0] = D_TYPE(data_a[ix + i0/2 + 0]);
29+
data_d[idst + i0/2 + 1] = D_TYPE(data_a[ix + i0/2 + 1]);
30+
#endif
2631

2732
return;
2833
}

ggml/src/ggml-vulkan/vulkan-shaders/rope_neox.comp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ void main() {
2727
}
2828

2929
if (i0 >= p.n_dims) {
30+
#ifdef ROPE_SAME_TYPE
31+
data_d[idst + i0/2 + 0] = data_a[ix + i0/2 + 0];
32+
data_d[idst + i0/2 + 1] = data_a[ix + i0/2 + 1];
33+
#else
3034
data_d[idst + i0/2 + 0] = D_TYPE(data_a[ix + i0/2 + 0]);
3135
data_d[idst + i0/2 + 1] = D_TYPE(data_a[ix + i0/2 + 1]);
36+
#endif
3237

3338
return;
3439
}

ggml/src/ggml-vulkan/vulkan-shaders/rope_norm.comp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ void main() {
2727
}
2828

2929
if (i0 >= p.n_dims) {
30+
#ifdef ROPE_SAME_TYPE
31+
data_d[idst + 0] = data_a[ix + 0];
32+
data_d[idst + 1] = data_a[ix + 1];
33+
#else
3034
data_d[idst + 0] = D_TYPE(data_a[ix + 0]);
3135
data_d[idst + 1] = D_TYPE(data_a[ix + 1]);
36+
#endif
3237

3338
return;
3439
}

ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,7 @@ void string_to_spv_func(std::string name, std::string in_path, std::string out_p
317317

318318
// disable spirv-opt for coopmat shaders for https://github.com/ggerganov/llama.cpp/issues/10734
319319
// disable spirv-opt for bf16 shaders for https://github.com/ggml-org/llama.cpp/issues/15344
320-
// disable spirv-opt for rope shaders for https://github.com/ggml-org/llama.cpp/issues/16860
321-
std::string opt_level = (coopmat || name.find("bf16") != std::string::npos || name.find("rope") != std::string::npos) ? "" : "-O";
320+
std::string opt_level = (coopmat || name.find("bf16") != std::string::npos) ? "" : "-O";
322321

323322
#ifdef _WIN32
324323
std::vector<std::string> cmd = {GLSLC, "-fshader-stage=compute", target_env, opt_level, "\"" + in_path + "\"", "-o", "\"" + out_path + "\""};
@@ -339,6 +338,9 @@ void string_to_spv_func(std::string name, std::string in_path, std::string out_p
339338
for (const auto& define : defines) {
340339
cmd.push_back("-D" + define.first + "=" + define.second);
341340
}
341+
if (name.find("rope") != std::string::npos && defines["D_TYPE"] == defines["A_TYPE"] ) {
342+
cmd.push_back("-DROPE_SAME_TYPE");
343+
}
342344

343345
std::string command;
344346
for (const auto& part : cmd) {

0 commit comments

Comments
 (0)