Skip to content

Commit

Permalink
simplify resizing bit vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
rongou committed Jul 1, 2023
1 parent 3186816 commit 6dbc9ac
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/predictor/gpu_predictor.cu
Original file line number Diff line number Diff line change
Expand Up @@ -803,20 +803,14 @@ class ColumnSplitHelper {
dh::caching_device_vector<BitType>* missing_storage,
std::size_t total_bits) const {
auto const size = BitVector::ComputeStorageSize(total_bits);
auto const old_decision_size = decision_storage->size();
if (old_decision_size < size) {
if (decision_storage->size() < size) {
decision_storage->resize(size);
}
if (old_decision_size != 0) {
thrust::fill(ctx_->CUDACtx()->CTP(), decision_storage->begin(), decision_storage->end(), 0);
}
auto const old_missing_size = missing_storage->size();
if (old_missing_size < size) {
thrust::fill(ctx_->CUDACtx()->CTP(), decision_storage->begin(), decision_storage->end(), 0);
if (missing_storage->size() < size) {
missing_storage->resize(size);
}
if (old_missing_size != 0) {
thrust::fill(ctx_->CUDACtx()->CTP(), missing_storage->begin(), missing_storage->end(), 0);
}
thrust::fill(ctx_->CUDACtx()->CTP(), missing_storage->begin(), missing_storage->end(), 0);
}

Context const* ctx_;
Expand Down

0 comments on commit 6dbc9ac

Please sign in to comment.