mirror of https://github.com/google/gemma.cpp.git
Remove unused "two-sizes" version of MulByConstAndAdd.
PiperOrigin-RevId: 684515900
This commit is contained in:
parent
1eb9ce19dd
commit
3cf519a53e
|
|
@ -488,26 +488,18 @@ static HWY_INLINE HWY_MAYBE_UNUSED void MulByConst(const float c,
|
||||||
MulByConst(c, x, size, size);
|
MulByConst(c, x, size, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWY_NOINLINE void MulByConstAndAdd(const float c,
|
static HWY_NOINLINE HWY_MAYBE_UNUSED void MulByConstAndAdd(
|
||||||
const float* HWY_RESTRICT x,
|
float c, const float* HWY_RESTRICT x, float* HWY_RESTRICT out,
|
||||||
float* HWY_RESTRICT out,
|
size_t size) {
|
||||||
const size_t size,
|
|
||||||
const size_t max_pos) {
|
|
||||||
namespace hn = hwy::HWY_NAMESPACE;
|
namespace hn = hwy::HWY_NAMESPACE;
|
||||||
using D = hn::ScalableTag<float>;
|
using D = hn::ScalableTag<float>;
|
||||||
using V = hn::Vec<D>;
|
using V = hn::Vec<D>;
|
||||||
hn::Transform1(D(), out, max_pos, x,
|
hn::Transform1(D(), out, size, x,
|
||||||
[c](const auto d, const V v_out, const V v_x) HWY_ATTR {
|
[c](const auto d, const V v_out, const V v_x) HWY_ATTR {
|
||||||
return hn::MulAdd(v_x, hn::Set(d, c), v_out);
|
return hn::MulAdd(v_x, hn::Set(d, c), v_out);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWY_INLINE HWY_MAYBE_UNUSED void MulByConstAndAdd(
|
|
||||||
float c, const float* HWY_RESTRICT x, float* HWY_RESTRICT out,
|
|
||||||
size_t size) {
|
|
||||||
MulByConstAndAdd(c, x, out, size, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
// See below for a specialized version for top-1 sampling.
|
// See below for a specialized version for top-1 sampling.
|
||||||
static HWY_NOINLINE void Softmax(float* HWY_RESTRICT x, const size_t size,
|
static HWY_NOINLINE void Softmax(float* HWY_RESTRICT x, const size_t size,
|
||||||
const size_t mask_pos) {
|
const size_t mask_pos) {
|
||||||
|
|
|
||||||
|
|
@ -106,9 +106,8 @@ HWY_NOINLINE void SourceMulByConst(float c, float* HWY_RESTRICT x, size_t size,
|
||||||
}
|
}
|
||||||
|
|
||||||
HWY_NOINLINE void SourceMulByConstAndAdd(float c, const float* HWY_RESTRICT x,
|
HWY_NOINLINE void SourceMulByConstAndAdd(float c, const float* HWY_RESTRICT x,
|
||||||
float* HWY_RESTRICT out, size_t size,
|
float* HWY_RESTRICT out, size_t size) {
|
||||||
size_t max_pos) {
|
for (size_t i = 0; i < size; ++i) {
|
||||||
for (size_t i = 0; i < max_pos; ++i) {
|
|
||||||
out[i] += x[i] * c;
|
out[i] += x[i] * c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -234,8 +233,8 @@ struct TestMulByConstAndAdd {
|
||||||
}
|
}
|
||||||
T constant = Random<T>(rng);
|
T constant = Random<T>(rng);
|
||||||
|
|
||||||
SourceMulByConstAndAdd(constant, o, e, count, count);
|
SourceMulByConstAndAdd(constant, o, e, count);
|
||||||
MulByConstAndAdd(constant, o, x, count, count);
|
MulByConstAndAdd(constant, o, x, count);
|
||||||
|
|
||||||
hwy::AssertArraySimilar(e, x, count, hwy::TargetName(HWY_TARGET), __FILE__,
|
hwy::AssertArraySimilar(e, x, count, hwy::TargetName(HWY_TARGET), __FILE__,
|
||||||
__LINE__);
|
__LINE__);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue