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

[Thread Backend]Fix CPU Thread Binding for Multiple Sockets #5918

Merged
merged 2 commits into from Jun 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/runtime/threading_backend.cc
Expand Up @@ -159,14 +159,8 @@ class ThreadGroup::Impl {
CPU_SET(sorted_order_[sorted_order_.size() - i - 1], &cpuset);
}
} else {
int big_count = big_count_;
// Imagine our x86 has cores 0 - 7
// physical cores are 0 - 3, logical cores are 4 - 7, big_count_ is 8
// we wish we run on physical cores, not logical cores to avoid contention issue.
Copy link
Member

Choose a reason for hiding this comment

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

The big count might be necessary for the big.little ARM targets

Copy link
Member

Choose a reason for hiding this comment

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

Is this possible to detect big.LITTLE somewhere?

Copy link
Member

@tqchen tqchen Jun 24, 2020

Choose a reason for hiding this comment

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

We need to look into the code. Perhaps do num_binds = std::min(MaxConcurrency(), big_count_); to keep backward compact for BIG.LITTLE

#if defined(_M_X64) || defined(__x86_64__)
big_count /= 2; // ignore hyper-threading
#endif
for (int i = 0; i < big_count; ++i) {
int num_cpu_workers = std::min(MaxConcurrency(), big_count_);
for (int i = 0; i < num_cpu_workers; ++i) {
CPU_SET(sorted_order_[i], &cpuset);
}
}
Expand Down