Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
las3_pub
/
predictable_parallel_patterns
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0a8b9ebb
authored
May 28, 2019
by
FritzFlorian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove backoff mechanisms for now.
parent
a78ff0d1
Pipeline
#1231
passed with stages
in 3 minutes 50 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
14 deletions
+9
-14
lib/pls/include/pls/internal/base/backoff.h
+2
-2
lib/pls/include/pls/internal/base/system_details.h
+1
-7
lib/pls/src/internal/scheduling/abstract_task.cpp
+6
-5
No files found.
lib/pls/include/pls/internal/base/backoff.h
View file @
0a8b9ebb
...
@@ -14,7 +14,7 @@ namespace internal {
...
@@ -14,7 +14,7 @@ namespace internal {
namespace
base
{
namespace
base
{
class
backoff
{
class
backoff
{
const
unsigned
long
INITIAL_SPIN_ITERS
=
2u
<<
4
u
;
const
unsigned
long
INITIAL_SPIN_ITERS
=
2u
<<
1
u
;
const
unsigned
long
MAX_SPIN_ITERS
=
2u
<<
8u
;
const
unsigned
long
MAX_SPIN_ITERS
=
2u
<<
8u
;
const
unsigned
long
MAX_ITERS
=
2u
<<
10u
;
const
unsigned
long
MAX_ITERS
=
2u
<<
10u
;
const
unsigned
long
YELD_ITERS
=
2u
<<
10u
;
const
unsigned
long
YELD_ITERS
=
2u
<<
10u
;
...
@@ -36,7 +36,7 @@ class backoff {
...
@@ -36,7 +36,7 @@ class backoff {
if
(
current_
>=
YELD_ITERS
)
{
if
(
current_
>=
YELD_ITERS
)
{
PROFILE_LOCK
(
"Yield"
)
PROFILE_LOCK
(
"Yield"
)
this_thread
::
yield
(
);
this_thread
::
sleep
(
5
);
}
}
current_
=
std
::
min
(
current_
*
2
,
MAX_ITERS
);
current_
=
std
::
min
(
current_
*
2
,
MAX_ITERS
);
...
...
lib/pls/include/pls/internal/base/system_details.h
View file @
0a8b9ebb
...
@@ -52,15 +52,9 @@ constexpr pointer_t CACHE_LINE_SIZE = 64;
...
@@ -52,15 +52,9 @@ constexpr pointer_t CACHE_LINE_SIZE = 64;
*
*
* Choose the implementation appropriate for your compiler-cpu combination.
* Choose the implementation appropriate for your compiler-cpu combination.
*/
*/
#if (COMPILER == MVCC)
inline
void
relax_cpu
()
{
_mm_pause
();
}
#elif (COMPILER == GCC || COMPILER == LLVM)
inline
void
relax_cpu
()
{
inline
void
relax_cpu
()
{
asm
(
"pause
"
);
asm
volatile
(
"pause"
::
:
"memory
"
);
}
}
#endif
}
}
}
}
...
...
lib/pls/src/internal/scheduling/abstract_task.cpp
View file @
0a8b9ebb
...
@@ -10,7 +10,7 @@ namespace internal {
...
@@ -10,7 +10,7 @@ namespace internal {
namespace
scheduling
{
namespace
scheduling
{
bool
abstract_task
::
steal_work
()
{
bool
abstract_task
::
steal_work
()
{
thread_local
static
base
::
backoff
backoff
{};
//
thread_local static base::backoff backoff{};
PROFILE_STEALING
(
"abstract_task::steal_work"
)
PROFILE_STEALING
(
"abstract_task::steal_work"
)
const
auto
my_state
=
base
::
this_thread
::
state
<
thread_state
>
();
const
auto
my_state
=
base
::
this_thread
::
state
<
thread_state
>
();
...
@@ -22,7 +22,7 @@ bool abstract_task::steal_work() {
...
@@ -22,7 +22,7 @@ bool abstract_task::steal_work() {
for
(
size_t
i
=
0
;
i
<
max_tries
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
max_tries
;
i
++
)
{
size_t
target
=
(
offset
+
i
)
%
my_scheduler
->
num_threads
();
size_t
target
=
(
offset
+
i
)
%
my_scheduler
->
num_threads
();
if
(
target
==
my_id
)
{
if
(
target
==
my_id
)
{
target
=
(
target
+
1
)
%
my_scheduler
->
num_threads
()
;
continue
;
}
}
auto
target_state
=
my_scheduler
->
thread_state_for
(
target
);
auto
target_state
=
my_scheduler
->
thread_state_for
(
target
);
...
@@ -47,7 +47,7 @@ bool abstract_task::steal_work() {
...
@@ -47,7 +47,7 @@ bool abstract_task::steal_work() {
if
(
internal_stealing
(
current_task
))
{
if
(
internal_stealing
(
current_task
))
{
// internal steal was a success, hand it back to the internal scheduler
// internal steal was a success, hand it back to the internal scheduler
target_state
->
lock_
.
reader_unlock
();
target_state
->
lock_
.
reader_unlock
();
backoff
.
reset
();
//
backoff.reset();
return
true
;
return
true
;
}
}
...
@@ -65,7 +65,7 @@ bool abstract_task::steal_work() {
...
@@ -65,7 +65,7 @@ bool abstract_task::steal_work() {
auto
lock
=
&
target_state
->
lock_
;
auto
lock
=
&
target_state
->
lock_
;
if
(
current_task
->
split_task
(
lock
))
{
if
(
current_task
->
split_task
(
lock
))
{
// top level steal was a success (we did a top level task steal)
// top level steal was a success (we did a top level task steal)
backoff
.
reset
();
//
backoff.reset();
return
false
;
return
false
;
}
}
...
@@ -76,7 +76,8 @@ bool abstract_task::steal_work() {
...
@@ -76,7 +76,8 @@ bool abstract_task::steal_work() {
}
}
// internal steal was no success
// internal steal was no success
backoff
.
do_backoff
();
// backoff.do_backoff();
// base::this_thread::sleep(5);
return
false
;
return
false
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment