fix: prevent core dump in CPU backend if using FP8 (e4m3) tensors (#2140)

This commit is contained in:
akleine authored and GitHub committed 2026-10-15 22:26:27 +08:00
1 parent 120e3e875c
commit 2891378bb1
1 file changed
+2 -1
+2 -1
View File
@@ -14,6 +14,7 @@
#include "core/ggml_extend.h" #include "core/ggml_extend.h"
#include "core/ggml_runner.h" #include "core/ggml_runner.h"
#include "core/ggml_extend_backend.h"
#include "model.h" #include "model.h"
class GGMLBlock { class GGMLBlock {
@@ -222,7 +223,7 @@ public:
if (force_prec_f32) { if (force_prec_f32) {
ggml_prec_set_acc(fp8_matmul, GGML_PREC_F32); ggml_prec_set_acc(fp8_matmul, GGML_PREC_F32);
} }
supports_fp8_matmul = ggml_backend_supports_op(ctx->backend, fp8_matmul); supports_fp8_matmul = ggml_backend_supports_op(ctx->backend, fp8_matmul) && !sd_backend_is_cpu(ctx->backend);
} }
if (!supports_fp8_matmul) { if (!supports_fp8_matmul) {
w = ggml_cast(ctx->ggml_ctx, w, GGML_TYPE_BF16); w = ggml_cast(ctx->ggml_ctx, w, GGML_TYPE_BF16);