Archived
libref, libavx: logit_softcap calls std::tanh on a float, not std::tanhf
std::tanhf is in <cmath> 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 <noreply@anthropic.com>
This commit is contained in:
1 parent
d59e0bb003
commit
c37f47cc78
2 files changed
+3
-3
No files matched your search
@@ -692,7 +692,7 @@ AVX_KERNEL(logit_softcap) {
|
|||||||
AVX_PARALLEL_FOR_IF(nel >= AVX_PAR_MIN)
|
AVX_PARALLEL_FOR_IF(nel >= AVX_PAR_MIN)
|
||||||
for (int64_t i = 0; i < nel; ++i) {
|
for (int64_t i = 0; i < nel; ++i) {
|
||||||
const float v = ldt(x, offlin(x, 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;
|
return RAD_OK;
|
||||||
}
|
}
|
||||||
@@ -713,7 +713,7 @@ AVX_KERNEL(logit_softcap) {
|
|||||||
for (; i + VF_N <= m; i += VF_N)
|
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));
|
vf_storeu(so + i, vf_fma(c2, vf_sigmoid(vf_mul(vf_loadu(v + i), z)), c1));
|
||||||
for (; i < m; ++i)
|
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);
|
out_row(y, off, m, so);
|
||||||
}
|
}
|
||||||
return RAD_OK;
|
return RAD_OK;
|
||||||
|
|||||||
@@ -708,7 +708,7 @@ int ref_logit_softcap(const RadArgs* a, RadStream) {
|
|||||||
#pragma omp parallel for schedule(static)
|
#pragma omp parallel for schedule(static)
|
||||||
for (int64_t i = 0; i < nel; ++i) {
|
for (int64_t i = 0; i < nel; ++i) {
|
||||||
const float v = ldt(x, offlin(x, 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;
|
return RAD_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user