Add float32 histogram (#5624)

* new single_precision_histogram param was added.

Co-authored-by: SHVETS, KIRILL <kirill.shvets@intel.com>
Co-authored-by: fis <jm.yuan@outlook.com>
This commit is contained in:
ShvetsKS
2020-06-03 06:24:53 +03:00
committed by GitHub
parent e49607af19
commit cd3d14ad0e
10 changed files with 618 additions and 303 deletions

View File

@@ -141,6 +141,15 @@ class GradientPairInternal {
public:
using ValueT = T;
inline void Add(const ValueT& grad, const ValueT& hess) {
grad_ += grad;
hess_ += hess;
}
inline static void Reduce(GradientPairInternal<T>& a, const GradientPairInternal<T>& b) { // NOLINT(*)
a += b;
}
XGBOOST_DEVICE GradientPairInternal() : grad_(0), hess_(0) {}
XGBOOST_DEVICE GradientPairInternal(T grad, T hess) {
@@ -148,9 +157,8 @@ class GradientPairInternal {
SetHess(hess);
}
// Copy constructor if of same value type
XGBOOST_DEVICE GradientPairInternal(const GradientPairInternal<T> &g)
: grad_(g.grad_), hess_(g.hess_) {} // NOLINT
// Copy constructor if of same value type, marked as default to be trivially_copyable
GradientPairInternal(const GradientPairInternal<T> &g) = default;
// Copy constructor if different value type - use getters and setters to
// perform conversion