From c37f47cc78daacd8ac7c9dbe1e1e4de6e18db5c6 Mon Sep 17 00:00:00 2001 From: Ashlyn Date: Sun, 11 Oct 2026 09:16:48 -0500 Subject: [PATCH] libref, libavx: logit_softcap calls std::tanh on a float, not std::tanhf std::tanhf is in only from libstdc++ 14; against 13 (Ubuntu 24.04's) the host build stops at libref and all four libavx levels. std::tanh's float overload is tanhf, so the arithmetic is the same to the bit. Co-Authored-By: Claude Opus 5.5 --- libavx/avx_elementwise.cpp | 4 ++-- libref/ref_elementwise.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavx/avx_elementwise.cpp b/libavx/avx_elementwise.cpp index a5ef8b97..2d2540c5 100644 --- a/libavx/avx_elementwise.cpp +++ b/libavx/avx_elementwise.cpp @@ -692,7 +692,7 @@ AVX_KERNEL(logit_softcap) { AVX_PARALLEL_FOR_IF(nel >= AVX_PAR_MIN) for (int64_t i = 0; i < nel; ++i) { const float v = ldt(x, offlin(x, i)); - stt(y, offlin(y, i), cap * std::tanhf(v / cap)); + stt(y, offlin(y, i), cap * std::tanh(v / cap)); } return RAD_OK; } @@ -713,7 +713,7 @@ AVX_KERNEL(logit_softcap) { for (; i + VF_N <= m; i += VF_N) vf_storeu(so + i, vf_fma(c2, vf_sigmoid(vf_mul(vf_loadu(v + i), z)), c1)); for (; i < m; ++i) - so[i] = cap * std::tanhf(v[i] / cap); + so[i] = cap * std::tanh(v[i] / cap); out_row(y, off, m, so); } return RAD_OK; diff --git a/libref/ref_elementwise.cpp b/libref/ref_elementwise.cpp index 830ace9a..4f3daf9d 100644 --- a/libref/ref_elementwise.cpp +++ b/libref/ref_elementwise.cpp @@ -708,7 +708,7 @@ int ref_logit_softcap(const RadArgs* a, RadStream) { #pragma omp parallel for schedule(static) for (int64_t i = 0; i < nel; ++i) { const float v = ldt(x, offlin(x, i)); - stt(y, offlin(y, i), cap * std::tanhf(v / cap)); + stt(y, offlin(y, i), cap * std::tanh(v / cap)); } return RAD_OK; }