Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
6fbda22d
Commit
6fbda22d
authored
6 years ago
by
eqy
Committed by
Tianqi Chen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
use SetAffinity when logical cores > physical cores (hyperthreading) (#1453)
parent
8dbe7794
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/runtime/thread_pool.cc
+0
-3
0 additions, 3 deletions
src/runtime/thread_pool.cc
src/runtime/threading_backend.cc
+8
-2
8 additions, 2 deletions
src/runtime/threading_backend.cc
with
8 additions
and
5 deletions
src/runtime/thread_pool.cc
+
0
−
3
View file @
6fbda22d
...
...
@@ -253,9 +253,6 @@ class ThreadPool {
num_workers_
,
[
this
](
int
worker_id
)
{
this
->
RunWorker
(
worker_id
);
},
exclude_worker0_
/* include_main_thread */
));
num_workers_used_
=
threads_
->
Configure
(
threading
::
ThreadGroup
::
kBig
,
0
,
exclude_worker0_
);
// if MaxConcurrency restricted the number of workers (e.g., due to
// hyperthreading), respect the restriction
num_workers_used_
=
std
::
min
(
num_workers_
,
num_workers_used_
);
}
~
ThreadPool
()
{
for
(
std
::
unique_ptr
<
SpscTaskQueue
>&
q
:
queues_
)
{
...
...
This diff is collapsed.
Click to expand it.
src/runtime/threading_backend.cc
+
8
−
2
View file @
6fbda22d
...
...
@@ -54,10 +54,16 @@ class ThreadGroup::Impl {
if
(
nthreads
)
{
num_workers_used
=
nthreads
;
}
// if MaxConcurrency restricted the number of workers (e.g., due to
// hyperthreading), respect the restriction. On CPUs with N logical cores
// and N/2 physical cores this will set affinity to the first N/2 logical
// ones.
num_workers_used
=
std
::
min
(
num_workers_
,
num_workers_used
);
const
char
*
val
=
getenv
(
"TVM_BIND_THREADS"
);
if
(
val
==
nullptr
||
atoi
(
val
)
==
1
)
{
//
Skip if sorted_order.size() is bigger than the number of
workers
(
th
reads_)
if
(
!
(
sorted_order_
.
size
()
>
static_cast
<
unsigned
int
>
(
num_workers_
))
)
{
//
Do not set affinity if there are more
workers th
an found cores
if
(
sorted_order_
.
size
()
>
=
static_cast
<
unsigned
int
>
(
num_workers_
))
{
SetAffinity
(
exclude_worker0
,
mode
==
kLittle
);
}
else
{
LOG
(
WARNING
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment