refactor: register RoPE kernels and fusion outside ggml

This commit is contained in:
leejet committed 2026-10-31 18:18:33 +08:00
1 parent 02e664d12d
commit f4a1902061
7 files changed
+336 -5

No files matched your search

+2 -2
View File
@@ -1077,8 +1077,8 @@ namespace Rope {
if (backend != nullptr && x->type == GGML_TYPE_F32 && pe->type == GGML_TYPE_F32 &&
x->ne[0] % 2 == 0 && pe->ne[0] == 2 && pe->ne[1] == 2 &&
pe->ne[2] == x->ne[0] / 2 && pe->ne[3] == x->ne[2]) {
auto out = ggml_rope_apply(ctx, x, pe, rope_interleaved);
if (ggml_backend_supports_op(backend, out)) {
auto out = sd_ggml_rope_apply(ctx, backend, x, pe, rope_interleaved);
if (out && ggml_backend_supports_op(backend, out)) {
return out;
}
}
+2 -2
View File
@@ -180,8 +180,8 @@ namespace MiniMaxH3 {
GGML_ASSERT(rot_dim <= x->ne[0]);
#ifndef SD_USE_UPSTREAM_GGML
if (runner_ctx->backend != nullptr && x->type == GGML_TYPE_F32 && pe->type == GGML_TYPE_F32) {
auto out = ggml_rope_apply(ctx, x, pe, false);
if (ggml_backend_supports_op(runner_ctx->backend, out)) {
auto out = sd_ggml_rope_apply(ctx, runner_ctx->backend, x, pe, false);
if (out && ggml_backend_supports_op(runner_ctx->backend, out)) {
return out;
}
}