diff --git a/src/common/column_matrix.h b/src/common/column_matrix.h index 454b226e6a66..448099e37b0b 100644 --- a/src/common/column_matrix.h +++ b/src/common/column_matrix.h @@ -139,12 +139,16 @@ class DenseColumnIter : public Column { }; /** - * \brief Column major matrix for gradient index. This matrix contains both dense column - * and sparse column, the type of the column is controlled by sparse threshold. When the - * number of missing values in a column is below the threshold it's classified as dense - * column. + * @brief Column major matrix for gradient index on CPU. + * + * This matrix contains both dense columns and sparse columns, the type of the column + * is controlled by the sparse threshold parameter. When the number of missing values + * in a column is below the threshold it's classified as dense column. */ class ColumnMatrix { + /** + * @brief A bit set for indicating whether an element in a dense column is missing. + */ struct MissingIndicator { LBitField32 missing; RefResourceView storage; @@ -159,8 +163,9 @@ class ColumnMatrix { storage = common::MakeFixedVecWithMalloc(m_size, init ? ~std::uint32_t{0} : std::uint32_t{0}); InitView(); } - void Clear(typename LBitField32::index_type i) { missing.Clear(i); } - + /** @brief Set the i^th element to be a valid element (instead of missing). */ + void SetValid(typename LBitField32::index_type i) { missing.Clear(i); } + /** @brief assign the storage to the view. */ void InitView() { missing = LBitField32{Span{storage.data(), storage.size()}}; } }; @@ -174,7 +179,7 @@ class ColumnMatrix { // not thread-safe with bool vector. // FIXME(jiamingy): We can directly assign kMissingId to the index to avoid missing // flags. - missing_.Clear(feature_offsets_[fid] + rid); + missing_.SetValid(feature_offsets_[fid] + rid); } else { ColumnBinT* begin = &local_index[feature_offsets_[fid]]; begin[num_nonzeros_[fid]] = bin_id - index_base_[fid]; @@ -186,7 +191,9 @@ class ColumnMatrix { public: using ByteType = bool; // get number of features - [[nodiscard]] bst_feature_t GetNumFeature() const { return static_cast(type_.size()); } + [[nodiscard]] bst_feature_t GetNumFeature() const { + return static_cast(type_.size()); + } ColumnMatrix() = default; ColumnMatrix(GHistIndexMatrix const& gmat, double sparse_threshold) { @@ -194,7 +201,7 @@ class ColumnMatrix { } /** - * \brief Initialize ColumnMatrix from GHistIndexMatrix with reference to the original + * @brief Initialize ColumnMatrix from GHistIndexMatrix with reference to the original * SparsePage. */ void InitFromSparse(SparsePage const& page, const GHistIndexMatrix& gmat, double sparse_threshold, @@ -206,8 +213,8 @@ class ColumnMatrix { } /** - * \brief Initialize ColumnMatrix from GHistIndexMatrix without reference to actual - * data. + * @brief Initialize ColumnMatrix from GHistIndexMatrix without reference to actual + * data. * * This function requires a binary search for each bin to get back the feature index * for those bins. diff --git a/src/common/io.cc b/src/common/io.cc index 90812d44a40d..d00f54b64e27 100644 --- a/src/common/io.cc +++ b/src/common/io.cc @@ -200,6 +200,9 @@ std::string FileExtension(std::string fname, bool lower) { } } +// For some reason, NVCC 12.1 marks the function deleted if we expose it in the header. +ResourceHandler::~ResourceHandler() noexcept(false) = default; + struct MMAPFile { #if defined(xgboost_IS_WIN) HANDLE fd{INVALID_HANDLE_VALUE}; diff --git a/src/common/io.h b/src/common/io.h index c3bd5d641b79..c6adff8ddcc4 100644 --- a/src/common/io.h +++ b/src/common/io.h @@ -10,9 +10,11 @@ #include #include -#include // for byte, size_t +#include // for min +#include // for byte, size_t #include #include +#include // for numeric_limits #include // for unique_ptr #include // for string #include // for move @@ -145,7 +147,7 @@ class ResourceHandler { [[nodiscard]] virtual std::size_t Size() const = 0; // Allow exceptions for cleaning up resource. - virtual ~ResourceHandler() noexcept(false){}; + virtual ~ResourceHandler() noexcept(false); ResourceHandler() = default; // Use shared_ptr to manage a pool like resource handler. All copy and assignment