This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new a9d12f7b820 [Debug](float) Add clang debug tune float accuracy (#25041)
a9d12f7b820 is described below
commit a9d12f7b8208479ccaa448f2472eea01e61f2115
Author: HappenLee <[email protected]>
AuthorDate: Sat Oct 7 09:34:50 2023 +0800
[Debug](float) Add clang debug tune float accuracy (#25041)
---
be/src/vec/aggregate_functions/aggregate_function_avg.h | 3 +++
be/src/vec/aggregate_functions/aggregate_function_avg_weighted.h | 6 ++++++
be/src/vec/aggregate_functions/aggregate_function_sum.h | 7 ++++++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg.h
b/be/src/vec/aggregate_functions/aggregate_function_avg.h
index 88704a96fd4..9697658ec70 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_avg.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_avg.h
@@ -135,6 +135,9 @@ public:
void add(AggregateDataPtr __restrict place, const IColumn** columns,
size_t row_num,
Arena*) const override {
+#ifdef __clang__
+#pragma clang fp reassociate(on)
+#endif
const auto& column = assert_cast<const ColVecType&>(*columns[0]);
if constexpr (IsDecimalNumber<T>) {
this->data(place).sum += column.get_data()[row_num].value;
diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.h
b/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.h
index c99d5df8d67..fe6f50481ba 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_avg_weighted.h
@@ -50,6 +50,9 @@ namespace doris::vectorized {
template <typename T>
struct AggregateFunctionAvgWeightedData {
void add(const T& data_val, double weight_val) {
+#ifdef __clang__
+#pragma clang fp reassociate(on)
+#endif
if constexpr (IsDecimalV2<T>) {
DecimalV2Value value = binary_cast<Int128,
DecimalV2Value>(data_val);
data_sum = data_sum + (double(value) * weight_val);
@@ -70,6 +73,9 @@ struct AggregateFunctionAvgWeightedData {
}
void merge(const AggregateFunctionAvgWeightedData& rhs) {
+#ifdef __clang__
+#pragma clang fp reassociate(on)
+#endif
data_sum = data_sum + rhs.data_sum;
weight_sum = weight_sum + rhs.weight_sum;
}
diff --git a/be/src/vec/aggregate_functions/aggregate_function_sum.h
b/be/src/vec/aggregate_functions/aggregate_function_sum.h
index e81e7b4af28..9f58023d507 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_sum.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_sum.h
@@ -56,7 +56,12 @@ template <typename T>
struct AggregateFunctionSumData {
T sum {};
- void add(T value) { sum += value; }
+ void add(T value) {
+#ifdef __clang__
+#pragma clang fp reassociate(on)
+#endif
+ sum += value;
+ }
void merge(const AggregateFunctionSumData& rhs) { sum += rhs.sum; }
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]