github ggml-org/llama.cpp b12682

pre-releaseone hour ago
Details

ggml : use a range-reduced log1p for softplus (#32655)

  • metal : use a range-reduced log1p for softplus

Use the atanh series for x in [-0.5, 1] and precise::log(1 + x) otherwise.
This avoids the cancellation in log(1 + exp(x)) for negative inputs and does
not rely on fast-math folding of (1 + e) - 1.

Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB)

  • tests : add a softplus test for negative inputs

Use inputs in [-16.6, -16.0], where log(1 + exp(x)) has up to ~2x
relative error. This catches both the old form and the fast-math-folded
compensated form.

Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB)

  • ggml : use log1pf in ggml_compute_softplus_f32

Use log1pf(expf(input)) so the host helper keeps the true value for
x < -16.64.

Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB)
Co-authored-by: IsNot-10 209144869@qq.com

  • vulkan : use a range-reduced log1p for softplus

Use the atanh series for x in [-0.5, 1] and log(1 + x) otherwise.

Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB)
Co-authored-by: IsNot-10 209144869@qq.com

  • opencl : use a range-reduced log1p for softplus

Use the atanh series for x in [-0.5, 1] and log(1 + x) otherwise.

Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB)
Co-authored-by: IsNot-10 209144869@qq.com

  • vulkan : move log1p to utils.glsl

Move the range-reduced log1p out of unary.comp into utils.glsl so that
other ops such as topk_moe and ssm_scan can include it. The body is
unchanged; only the call site in op_softplus is renamed.

Co-authored-by: IsNot-10 209144869@qq.com
Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (MacBook, M5 Max, 128GB)


Co-authored-by: IsNot-10 209144869@qq.com

Website:

Attestations:

macOS/iOS:

Linux:

Android:

Windows:

openEuler:

  • DISABLED
  • openEuler x86 (310p)
  • openEuler x86 (910b, ACL Graph)
  • openEuler aarch64 (310p)
  • openEuler aarch64 (910b, ACL Graph)

UI:

Don't miss a new llama.cpp release

NewReleases is sending notifications on new releases.