Skip to content

Commit ea5c4fe

Browse files
razdoburdinVika-F
andauthored
Update src/common/column_matrix.h
Co-authored-by: Victoriya Fedotova <[email protected]>
1 parent 6d553fb commit ea5c4fe

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/common/column_matrix.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,15 +460,11 @@ class ColumnMatrix {
460460
std::vector<size_t> k_offsets(n_threads + 1, 0); // offsets of non-zero elements for each thread
461461
// k_offsets[0] = 0;
462462
// k_offsets[tid] - starting offset of non-zero elements processed by thread tid
463-
size_t block_size = DivRoundUp(batch_size, n_threads);
463+
const auto word32size = MissingIndicator::BitFieldT::kValueSize;
464464

465-
/*
466-
* We use bitfield as a missing indicator. To ensure thread safe access to the bitfield
467-
* each underlying word of the bitfiled should be processed by a single thread.
468-
* So we need to align the row-blocks.
469-
*/
470-
block_size = DivRoundUp(block_size, MissingIndicator::BitFieldT::kValueSize) *
471-
MissingIndicator::BitFieldT::kValueSize;
465+
size_t block_size = DivRoundUp(batch_size, n_threads); // preliminary block size
466+
// align block_size to be multiple of kValueSize, so that each thread processes full words in the bitfield
467+
block_size = DivRoundUp(block_size, word32size) * word32size;
472468
/*
473469
* To prevent race conditions on the bitfield, we ensure each thread operates on
474470
* distinct 32-bit words. If a data batch (starting at `base_rowid`) doesn't align

0 commit comments

Comments
 (0)