@@ -178,13 +178,13 @@ group_duplicate_rows(const Vector<InnerIdType>& ids,
178178 }
179179}
180180
181- struct ReservoirEntry {
182- // A slot is fully assigned before ReservoirState ::size makes it readable.
181+ struct reservoir_entry {
182+ // A slot is fully assigned before reservoir_state ::size makes it readable.
183183 // NOLINTNEXTLINE(modernize-use-equals-default)
184- ReservoirEntry () noexcept {
184+ reservoir_entry () noexcept {
185185 }
186186
187- ReservoirEntry (InnerIdType input_neighbor, uint16_t input_hash, uint16_t input_distance)
187+ reservoir_entry (InnerIdType input_neighbor, uint16_t input_hash, uint16_t input_distance)
188188 : neighbor(input_neighbor), hash(input_hash), distance(input_distance) {
189189 }
190190
@@ -193,15 +193,15 @@ struct ReservoirEntry {
193193 uint16_t distance;
194194};
195195
196- static_assert (sizeof (ReservoirEntry ) == 8 );
196+ static_assert (sizeof (reservoir_entry ) == 8 );
197197
198- struct ReservoirState {
198+ struct reservoir_state {
199199 uint16_t size{0 };
200200 uint16_t farthest{0 };
201201};
202202
203- struct WorkItem {
204- WorkItem (Vector<uint32_t >&& input_points, uint64_t input_level, uint64_t input_seed)
203+ struct work_item {
204+ work_item (Vector<uint32_t >&& input_points, uint64_t input_level, uint64_t input_seed)
205205 : points(std::move(input_points)), level(input_level), seed(input_seed) {
206206 }
207207
@@ -213,11 +213,11 @@ struct WorkItem {
213213using Leaf = Vector<uint32_t >;
214214using Leaves = Vector<Leaf>;
215215
216- struct SplitResult {
217- explicit SplitResult (Allocator* allocator) : pending(allocator), finished(allocator) {
216+ struct split_result {
217+ explicit split_result (Allocator* allocator) : pending(allocator), finished(allocator) {
218218 }
219219
220- Vector<WorkItem > pending;
220+ Vector<work_item > pending;
221221 Leaves finished;
222222};
223223
@@ -286,16 +286,16 @@ class PiPNNPipeline {
286286 partition () const ;
287287
288288 void
289- split_work_item (const WorkItem & item,
290- Vector<WorkItem >& pending,
289+ split_work_item (const work_item & item,
290+ Vector<work_item >& pending,
291291 Leaves& finished,
292292 bool allow_inner_parallelism) const ;
293293
294294 [[nodiscard]] Vector<uint32_t >
295- sample_leaders (const WorkItem & item) const ;
295+ sample_leaders (const work_item & item) const ;
296296
297297 [[nodiscard]] Leaves
298- assign_to_leaders (const WorkItem & item,
298+ assign_to_leaders (const work_item & item,
299299 const Vector<uint32_t >& leaders,
300300 uint64_t fanout,
301301 bool allow_parallelism) const ;
@@ -322,7 +322,7 @@ class PiPNNPipeline {
322322 distance_from_dot (uint32_t lhs, uint32_t rhs, float dot) const ;
323323
324324 Vector<InnerIdType>
325- robust_prune (uint32_t source, const ReservoirEntry * row, uint16_t size) const ;
325+ robust_prune (uint32_t source, const reservoir_entry * row, uint16_t size) const ;
326326
327327 void
328328 write_graph () const ;
@@ -352,8 +352,8 @@ class PiPNNPipeline {
352352 Vector<InnerIdType> ids_;
353353 float * norms_{nullptr };
354354 float * sketches_{nullptr };
355- Vector<ReservoirEntry > reservoirs_;
356- Vector<ReservoirState > reservoir_states_;
355+ Vector<reservoir_entry > reservoirs_;
356+ Vector<reservoir_state > reservoir_states_;
357357 std::unique_ptr<PointsMutex> point_locks_;
358358 uint32_t point_lock_count_{0 };
359359};
@@ -495,10 +495,10 @@ PiPNNPipeline::partition() const {
495495 return finished;
496496 }
497497
498- Vector<WorkItem > work (allocator_);
498+ Vector<work_item > work (allocator_);
499499 work.emplace_back (std::move (initial), 0 , PARTITION_SEED );
500500 for (uint64_t iteration = 0 ; iteration < MAX_PARTITION_ITERATIONS ; ++iteration) {
501- Vector<WorkItem > pending (allocator_);
501+ Vector<work_item > pending (allocator_);
502502 const bool all_items_are_small =
503503 std::all_of (work.begin (), work.end (), [](const auto & item) {
504504 return item.points .size () < MIN_PARALLEL_PARTITION_POINTS ;
@@ -508,10 +508,10 @@ PiPNNPipeline::partition() const {
508508 work.size () > 1 and
509509 (work.size () >= thread_count_ or all_items_are_small);
510510 if (parallelize_work_items) {
511- Vector<std::unique_ptr<SplitResult >> results (allocator_);
511+ Vector<std::unique_ptr<split_result >> results (allocator_);
512512 results.reserve (work.size ());
513513 for (uint64_t item = 0 ; item < work.size (); ++item) {
514- results.emplace_back (std::make_unique<SplitResult >(allocator_));
514+ results.emplace_back (std::make_unique<split_result >(allocator_));
515515 }
516516 Vector<uint64_t > schedule (allocator_);
517517 schedule.resize (work.size ());
@@ -586,8 +586,8 @@ PiPNNPipeline::partition() const {
586586}
587587
588588void
589- PiPNNPipeline::split_work_item (const WorkItem & item,
590- Vector<WorkItem >& pending,
589+ PiPNNPipeline::split_work_item (const work_item & item,
590+ Vector<work_item >& pending,
591591 Leaves& finished,
592592 bool allow_inner_parallelism) const {
593593 const uint64_t requested_fanout =
@@ -653,7 +653,7 @@ PiPNNPipeline::split_work_item(const WorkItem& item,
653653}
654654
655655Vector<uint32_t >
656- PiPNNPipeline::sample_leaders (const WorkItem & item) const {
656+ PiPNNPipeline::sample_leaders (const work_item & item) const {
657657 const auto sampled = static_cast <uint64_t >(
658658 std::ceil (static_cast <double >(item.points .size ()) * parameter_.leader_sample_rate ));
659659 const uint64_t leader_count =
@@ -682,7 +682,7 @@ PiPNNPipeline::sample_leaders(const WorkItem& item) const {
682682}
683683
684684Leaves
685- PiPNNPipeline::assign_to_leaders (const WorkItem & item,
685+ PiPNNPipeline::assign_to_leaders (const work_item & item,
686686 const Vector<uint32_t >& leaders,
687687 uint64_t fanout,
688688 bool allow_parallelism) const {
@@ -1133,7 +1133,7 @@ PiPNNPipeline::insert_candidate(uint32_t source, uint32_t target, float distance
11331133 if (entry.neighbor == target) {
11341134 if (incoming_key < std::make_tuple (entry.distance , ids_[entry.neighbor ], entry.hash )) {
11351135 const bool was_farthest = index == state.farthest ;
1136- entry = ReservoirEntry {target, hash, distance_key};
1136+ entry = reservoir_entry {target, hash, distance_key};
11371137 if (was_farthest) {
11381138 update_farthest (source);
11391139 }
@@ -1148,7 +1148,7 @@ PiPNNPipeline::insert_candidate(uint32_t source, uint32_t target, float distance
11481148 // remaining entries. Returning here is intentional, not a missed scan.
11491149 if (incoming_key < std::make_tuple (entry.distance , ids_[entry.neighbor ], entry.hash )) {
11501150 const bool was_farthest = index == state.farthest ;
1151- entry = ReservoirEntry {target, hash, distance_key};
1151+ entry = reservoir_entry {target, hash, distance_key};
11521152 if (was_farthest) {
11531153 update_farthest (source);
11541154 }
@@ -1158,7 +1158,7 @@ PiPNNPipeline::insert_candidate(uint32_t source, uint32_t target, float distance
11581158
11591159 if (state.size < reservoir_size_) {
11601160 const uint16_t inserted = state.size ;
1161- row[inserted] = ReservoirEntry {target, hash, distance_key};
1161+ row[inserted] = reservoir_entry {target, hash, distance_key};
11621162 ++state.size ;
11631163 if (inserted == 0 ) {
11641164 state.farthest = 0 ;
@@ -1173,7 +1173,7 @@ PiPNNPipeline::insert_candidate(uint32_t source, uint32_t target, float distance
11731173 return ;
11741174 }
11751175
1176- row[state.farthest ] = ReservoirEntry {target, hash, distance_key};
1176+ row[state.farthest ] = reservoir_entry {target, hash, distance_key};
11771177 update_farthest (source);
11781178}
11791179
@@ -1217,7 +1217,7 @@ PiPNNPipeline::distance_from_dot(uint32_t lhs, uint32_t rhs, float dot) const {
12171217}
12181218
12191219Vector<InnerIdType>
1220- PiPNNPipeline::robust_prune (uint32_t source, const ReservoirEntry * row, uint16_t size) const {
1220+ PiPNNPipeline::robust_prune (uint32_t source, const reservoir_entry * row, uint16_t size) const {
12211221 Vector<std::pair<float , uint32_t >> ordered (allocator_);
12221222 ordered.reserve (size);
12231223 for (uint16_t index = 0 ; index < size; ++index) {
0 commit comments