Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract the pruning strategy from HGraph #373

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

inabao
Copy link
Collaborator

@inabao inabao commented Feb 6, 2025

No description provided.

@inabao inabao added the kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) label Feb 6, 2025
@inabao inabao self-assigned this Feb 6, 2025
GraphInterfacePtr graph,
const FlattenInterfacePtr flatten,
MutexStrategyPtr neighbors_mutexs,
Allocator* allocator);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The is_update parameter has been removed (currently, there are no uses where it would be set to true)

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 95.65217% with 5 lines in your changes missing coverage. Please review.

@@            Coverage Diff             @@
##             main     #373      +/-   ##
==========================================
+ Coverage   91.28%   91.31%   +0.03%     
==========================================
  Files         140      143       +3     
  Lines        8968     8997      +29     
==========================================
+ Hits         8186     8216      +30     
+ Misses        782      781       -1     
Flag Coverage Δ
cpp 91.31% <95.65%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
common 95.61% <97.50%> (+0.07%) ⬆️
datacell 92.50% <ø> (+0.07%) ⬆️
index 91.47% <100.00%> (-0.04%) ⬇️
simd 81.72% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update acc0815...97a611d. Read the comment docs.


void
PointsMutex::Unlock(uint32_t i) {
neighbors_mutex_[i].unlock_shared();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neighbors_mutex_[i].unlock() ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


void
PointsMutex::Resize(uint32_t new_element_num) {
neighbors_mutex_.resize(new_element_num);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Resize is not thread-safe implement ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The control for thread-safety will be handled externally

@@ -849,11 +722,11 @@ HGraph::add_one_point(const float* data, int level, InnerIdType inner_id) {

void
HGraph::resize(uint64_t new_size) {
auto cur_size = this->neighbors_mutex_.size();
auto cur_size = this->labels_.size();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto cur_size = this->neighbors_mutex_ ? this->neighbors_mutex_->Size() : 0; ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, the size represents the capacity, and it has been switched to use max_capacity_ to record it.


private:
Vector<std::shared_ptr<std::shared_mutex>> neighbors_mutex_;
Allocator* allocator_{nullptr};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Copy link
Collaborator

@LHT129 LHT129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) size/L version/0.14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants