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
2fece910
authored
6 years ago
by
FritzFlorian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add system specific 'relax cpu' instruction.
parent
aa270645
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletions
+20
-1
lib/pls/include/pls/internal/base/system_details.h
+20
-1
No files found.
lib/pls/include/pls/internal/base/system_details.h
View file @
2fece910
...
...
@@ -24,9 +24,28 @@ constexpr std::uintptr_t CACHE_LINE_SIZE = 64;
* Choose one of the following ways to store thread specific data.
* Try to choose the fastest available on this processor/system.
*/
//
#define PLS_THREAD_SPECIFIC_PTHREAD
//#define PLS_THREAD_SPECIFIC_PTHREAD
#define PLS_THREAD_SPECIFIC_COMPILER
/**
* When spinning one wants to 'relax' the CPU from some task,
* e.g. disabling speculative execution/branch prediction
* or reducing its clock speed.
* This is both good for power draw, as well as for hyperthreading.
*
* Choose the implementation appropriate for your compiler-cpu combination.
*/
#if (COMPILER == MVCC)
#include <emmintrin.h>
inline
void
relax_cpu
()
{
_mm_pause
();
}
#elif (COMPILER == GCC || COMPILER == LLVM)
inline
void
relax_cpu
()
{
asm
(
"pause"
);
}
#endif
}
}
}
...
...
This diff is collapsed.
Click to expand it.
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