fix style, add kCamelCase style for constexpr in clang-tidy

This commit is contained in:
enum-class 2024-03-05 20:45:30 +08:00
parent 5f016fb433
commit bc845515b7
2 changed files with 9 additions and 5 deletions

View File

@ -1,4 +1,5 @@
FormatStyle: file
WarningsAsErrors: "*"
Checks: "-*,\
abseil-*,\
-abseil-string-find-startswith,\
@ -204,3 +205,6 @@ Checks: "-*,\
-readability-uppercase-literal-suffix,\
-readability-use-anyofallof
"
CheckOptions:
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
- { key: readability-identifier-naming.ConstexprVariablePrefix, value: k }

10
ops.h
View File

@ -364,8 +364,8 @@ static HWY_NOINLINE HWY_MAYBE_UNUSED void RMSNorm(
float* HWY_RESTRICT out, size_t size) {
namespace hn = hwy::HWY_NAMESPACE;
constexpr float eps = 1e-6f;
constexpr size_t unroll_size = 2;
constexpr float kEps = 1e-6f;
constexpr size_t kUnrollSize = 2;
const hn::ScalableTag<hwy::bfloat16_t> dbf;
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 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);
for (size_t i = 0; i < size; i += unroll_size * N32) {
HWY_DASSERT(size % (kUnrollSize * MaxLanes(df32)) == 0);
for (size_t i = 0; i < size; i += kUnrollSize * N32) {
const hn::Vec<decltype(dbf)> w16 = hn::LoadU(dbf, weight + i);
const auto w0 = hn::PromoteLowerTo(df32, w16);
const auto w1 = hn::PromoteUpperTo(df32, w16);