diff --git a/ggml/src/ggml-spacemit/ime.cpp b/ggml/src/ggml-spacemit/ime.cpp index 493c989d4ccf..a1f95206e45a 100644 --- a/ggml/src/ggml-spacemit/ime.cpp +++ b/ggml/src/ggml-spacemit/ime.cpp @@ -1860,10 +1860,6 @@ class tensor_traits_f16 : public ggml::spacemit::tensor_traits_base { const int ith = ctx.ith; const int nth = ctx.nth; - if (ith == 0 && getenv("GGML_SPACEMIT_Q41_TRACE") != nullptr) { - fprintf(stderr, "q41_mul_mat: N=%zu M=%zu K=%zu (%s)\n", N, M, K, M == 1 ? "decode" : "prefill"); - } - const size_t out_row_stride = dst->nb[1]; // bytes constexpr size_t m_tile = F16_M_TILE; diff --git a/ggml/src/ggml-spacemit/rvv_kernels.cpp b/ggml/src/ggml-spacemit/rvv_kernels.cpp index a9b5032d9baa..e61dc4a5abac 100644 --- a/ggml/src/ggml-spacemit/rvv_kernels.cpp +++ b/ggml/src/ggml-spacemit/rvv_kernels.cpp @@ -4109,7 +4109,9 @@ void forward_scale_f32(ggml::spacemit::context & ctx, ggml_tensor * op) { GGML_ASSERT(src0->type == GGML_TYPE_F32 && dst->type == GGML_TYPE_F32); float scale; + float bias; memcpy(&scale, op->op_params, sizeof(float)); + memcpy(&bias, (const char *) op->op_params + sizeof(float), sizeof(float)); const int64_t ith = ctx.ith; const int64_t nth = ctx.nth; @@ -4136,6 +4138,9 @@ void forward_scale_f32(ggml::spacemit::context & ctx, ggml_tensor * op) { const size_t vl = __riscv_vsetvl_e32m4(remaining); vfloat32m4_t v = __riscv_vle32_v_f32m4(src_row, vl); v = __riscv_vfmul_vf_f32m4(v, scale, vl); + if (bias != 0.0f) { + v = __riscv_vfadd_vf_f32m4(v, bias, vl); + } __riscv_vse32_v_f32m4(dst_row, v, vl); src_row += vl; dst_row += vl;