|
17 | 17 | namespace xgboost::tree { |
18 | 18 | namespace { |
19 | 19 | struct Pair { |
20 | | - GradientPair first; |
21 | | - GradientPair second; |
| 20 | + GradientPairPrecise first; |
| 21 | + GradientPairPrecise second; |
22 | 22 | }; |
23 | 23 | __host__ XGBOOST_DEV_INLINE Pair operator+(Pair const& lhs, Pair const& rhs) { |
24 | 24 | return {lhs.first + rhs.first, lhs.second + rhs.second}; |
@@ -53,7 +53,7 @@ struct Clip { |
53 | 53 | auto ng = Nclip(x.GetGrad()); |
54 | 54 | auto nh = Nclip(x.GetHess()); |
55 | 55 |
|
56 | | - return {GradientPair{pg, ph}, GradientPair{ng, nh}}; |
| 56 | + return {GradientPairPrecise{pg, ph}, GradientPairPrecise{ng, nh}}; |
57 | 57 | } |
58 | 58 | }; |
59 | 59 |
|
@@ -81,7 +81,7 @@ GradientQuantiser::GradientQuantiser(Context const* ctx, common::Span<GradientPa |
81 | 81 | auto rc = collective::GlobalSum(ctx, info, linalg::MakeVec(reinterpret_cast<ReduceT*>(&p), 4)); |
82 | 82 | collective::SafeColl(rc); |
83 | 83 |
|
84 | | - GradientPair positive_sum{p.first}, negative_sum{p.second}; |
| 84 | + GradientSumT positive_sum{p.first}, negative_sum{p.second}; |
85 | 85 |
|
86 | 86 | std::size_t total_rows = gpair.size(); |
87 | 87 | rc = collective::GlobalSum(ctx, info, linalg::MakeVec(&total_rows, 1)); |
@@ -111,8 +111,8 @@ GradientQuantiser::GradientQuantiser(Context const* ctx, common::Span<GradientPa |
111 | 111 | * rounding is calcuated as exp(m), see the rounding factor calcuation for |
112 | 112 | * details. |
113 | 113 | */ |
114 | | - to_fixed_point_ = GradientSumT(static_cast<T>(1) / to_floating_point_.GetGrad(), |
115 | | - static_cast<T>(1) / to_floating_point_.GetHess()); |
| 114 | + to_fixed_point_ = GradientSumT{static_cast<T>(1) / to_floating_point_.GetGrad(), |
| 115 | + static_cast<T>(1) / to_floating_point_.GetHess()}; |
116 | 116 | } |
117 | 117 |
|
118 | 118 | XGBOOST_DEV_INLINE void AtomicAddGpairShared(xgboost::GradientPairInt64* dest, |
|
0 commit comments