From b22708fd90e482636e1d9e1d13b78ffac3fada20 Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Wed, 9 Jul 2025 00:00:44 +0200 Subject: [PATCH] fix cuda --- ggml/src/ggml-cuda/scale.cu | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ggml/src/ggml-cuda/scale.cu b/ggml/src/ggml-cuda/scale.cu index eb4a5f0fcd..f915bf5faa 100644 --- a/ggml/src/ggml-cuda/scale.cu +++ b/ggml/src/ggml-cuda/scale.cu @@ -24,8 +24,10 @@ void ggml_cuda_op_scale(ggml_backend_cuda_context & ctx, ggml_tensor * dst) { GGML_ASSERT(src0->type == GGML_TYPE_F32); GGML_ASSERT( dst->type == GGML_TYPE_F32); - float scale = ((const float *)(dst->op_params))[0]; - float bias = ((const float *)(dst->op_params))[1]; + float scale; + float bias; + memcpy(&scale, dst->op_params, sizeof(float)); + memcpy(&bias, (float *) dst->op_params + 1, sizeof(float)); scale_f32_cuda(src0_d, dst_d, scale, bias, ggml_nelements(src0), stream); }