mirror of https://github.com/google/gemma.cpp.git
fix style, add kCamelCase style for constexpr in clang-tidy
This commit is contained in:
parent
5f016fb433
commit
bc845515b7
|
|
@ -1,4 +1,5 @@
|
||||||
FormatStyle: file
|
FormatStyle: file
|
||||||
|
WarningsAsErrors: "*"
|
||||||
Checks: "-*,\
|
Checks: "-*,\
|
||||||
abseil-*,\
|
abseil-*,\
|
||||||
-abseil-string-find-startswith,\
|
-abseil-string-find-startswith,\
|
||||||
|
|
@ -204,3 +205,6 @@ Checks: "-*,\
|
||||||
-readability-uppercase-literal-suffix,\
|
-readability-uppercase-literal-suffix,\
|
||||||
-readability-use-anyofallof
|
-readability-use-anyofallof
|
||||||
"
|
"
|
||||||
|
CheckOptions:
|
||||||
|
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
|
||||||
|
- { key: readability-identifier-naming.ConstexprVariablePrefix, value: k }
|
||||||
|
|
|
||||||
10
ops.h
10
ops.h
|
|
@ -364,8 +364,8 @@ static HWY_NOINLINE HWY_MAYBE_UNUSED void RMSNorm(
|
||||||
float* HWY_RESTRICT out, size_t size) {
|
float* HWY_RESTRICT out, size_t size) {
|
||||||
namespace hn = hwy::HWY_NAMESPACE;
|
namespace hn = hwy::HWY_NAMESPACE;
|
||||||
|
|
||||||
constexpr float eps = 1e-6f;
|
constexpr float kEps = 1e-6f;
|
||||||
constexpr size_t unroll_size = 2;
|
constexpr size_t kUnrollSize = 2;
|
||||||
|
|
||||||
const hn::ScalableTag<hwy::bfloat16_t> dbf;
|
const hn::ScalableTag<hwy::bfloat16_t> dbf;
|
||||||
const hn::Repartition<float, decltype(dbf)> df32;
|
const hn::Repartition<float, decltype(dbf)> df32;
|
||||||
|
|
@ -373,10 +373,10 @@ static HWY_NOINLINE HWY_MAYBE_UNUSED void RMSNorm(
|
||||||
|
|
||||||
const float ss = SquaredL2(x, size);
|
const float ss = SquaredL2(x, size);
|
||||||
const auto vss =
|
const auto vss =
|
||||||
hn::Set(df32, 1.0f / sqrtf(ss / StaticCast<float>(size) + eps));
|
hn::Set(df32, 1.0f / sqrtf(ss / StaticCast<float>(size) + kEps));
|
||||||
|
|
||||||
HWY_DASSERT(size % (unroll_size * MaxLanes(df32)) == 0);
|
HWY_DASSERT(size % (kUnrollSize * MaxLanes(df32)) == 0);
|
||||||
for (size_t i = 0; i < size; i += unroll_size * N32) {
|
for (size_t i = 0; i < size; i += kUnrollSize * N32) {
|
||||||
const hn::Vec<decltype(dbf)> w16 = hn::LoadU(dbf, weight + i);
|
const hn::Vec<decltype(dbf)> w16 = hn::LoadU(dbf, weight + i);
|
||||||
const auto w0 = hn::PromoteLowerTo(df32, w16);
|
const auto w0 = hn::PromoteLowerTo(df32, w16);
|
||||||
const auto w1 = hn::PromoteUpperTo(df32, w16);
|
const auto w1 = hn::PromoteUpperTo(df32, w16);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue