diff --git a/csrc/cpu/attention.cpp b/csrc/cpu/attention.cpp index da5834d845a2d..b60f3e4dca9b6 100644 --- a/csrc/cpu/attention.cpp +++ b/csrc/cpu/attention.cpp @@ -45,28 +45,28 @@ struct KernelVecType { #else #ifdef __aarch64__ #ifndef BF16_SUPPORT - //pass + // pass #else - template <> - struct KernelVecType { - using q_load_vec_type = vec_op::BF16Vec8; - using q_vec_type = vec_op::FP32Vec16; - using k_load_vec_type = vec_op::BF16Vec16; - using k_vec_type = vec_op::FP32Vec16; - using qk_acc_vec_type = vec_op::FP32Vec16; - using v_load_vec_type = vec_op::BF16Vec16; - }; +template <> +struct KernelVecType { + using q_load_vec_type = vec_op::BF16Vec8; + using q_vec_type = vec_op::FP32Vec16; + using k_load_vec_type = vec_op::BF16Vec16; + using k_vec_type = vec_op::FP32Vec16; + using qk_acc_vec_type = vec_op::FP32Vec16; + using v_load_vec_type = vec_op::BF16Vec16; +}; #endif #else - template <> - struct KernelVecType { - using q_load_vec_type = vec_op::BF16Vec8; - using q_vec_type = vec_op::FP32Vec16; - using k_load_vec_type = vec_op::BF16Vec16; - using k_vec_type = vec_op::FP32Vec16; - using qk_acc_vec_type = vec_op::FP32Vec16; - using v_load_vec_type = vec_op::BF16Vec16; - }; +template <> +struct KernelVecType { + using q_load_vec_type = vec_op::BF16Vec8; + using q_vec_type = vec_op::FP32Vec16; + using k_load_vec_type = vec_op::BF16Vec16; + using k_vec_type = vec_op::FP32Vec16; + using qk_acc_vec_type = vec_op::FP32Vec16; + using v_load_vec_type = vec_op::BF16Vec16; +}; #endif #endif diff --git a/csrc/cpu/cpu_types_arm.hpp b/csrc/cpu/cpu_types_arm.hpp index 811d709f8afe9..1d29040690702 100644 --- a/csrc/cpu/cpu_types_arm.hpp +++ b/csrc/cpu/cpu_types_arm.hpp @@ -220,10 +220,10 @@ struct FP32Vec8 : public Vec { float reduce_sum() const { AliasReg ar; ar.reg = reg; - float ans = 0; - unroll_loop([&ans, &ar](int i) { ans += ar.values[i]; }); + float answer = 0; + unroll_loop([&answer, &ar](int i) { answer += ar.values[i]; }); - return ans; + return answer; } FP32Vec8 exp() const { @@ -408,10 +408,10 @@ struct FP32Vec16 : public Vec { float reduce_sum() const { AliasReg ar; ar.reg = reg; - float ans = 0; - unroll_loop([&ans, &ar](int i) { ans += ar.values[i]; }); + float answer = 0; + unroll_loop([&answer, &ar](int i) { answer += ar.values[i]; }); - return ans; + return answer; }; template float reduce_sub_sum(int idx) { @@ -419,12 +419,12 @@ struct FP32Vec16 : public Vec { AliasReg ar; ar.reg = reg; - float ans = 0; + float answer = 0; const int start = idx * group_size; unroll_loop( - [&ans, &start, ar](int i) { ans += ar.values[start + i]; }); + [&answer, &start, ar](int i) { answer += ar.values[start + i]; }); - return ans; + return answer; }; void save(float *ptr) const {