llama.cpp b11703:Hexagon HVX 向量化 softplus
原标题:b11703
AI 摘要
llama.cpp 发布 b11703 版本,将 softplus 激活函数在 Hexagon HVX 后端上向量化,用共享的 hvx_softplus_f32_aa() 辅助函数替换原先标量 logf(1+expf(x)) 循环,复用已有的 hvx_vec_exp_f32 与 hvx_vec_log_f32 原语,不引入新的数值近似。实现通过 Q6_V_vmux_QVV 选择保留标量参考中 x > 20 的保护条件,使向量路径结果与 CPU 一致。该版本同时提供 macOS、Linux、Windows、Android 等多平台预编译包。
正文节选
<details open> hexagon: vectorize softplus with HVX (#30435) softplus_f32 and tile_softplus_f32 ran a scalar logf(1.0f + expf(x)) loop. Replace both with a shared hvx_softplus_f32_aa() helper built from the backend's existing hvx_vec_exp_f32 / hvx_vec_log_f32 primitives, so no new numerical approximation is introduced. hvx_vec_exp_f32 clamps its input to (-88, 88) before exponentiating, so a naive log(1 + exp(x)) composition would saturate to ~88.72 for large x instead of returning x. The Q6_