Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CompilerSpecific.h
Go to the documentation of this file.
1 /*
2  * This file belongs to the Galois project, a C++ library for exploiting
3  * parallelism. The code is being released under the terms of the 3-Clause BSD
4  * License (a copy is located in LICENSE.txt at the top-level directory).
5  *
6  * Copyright (C) 2018, The University of Texas at Austin. All rights reserved.
7  * UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
8  * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY,
9  * FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT AND WARRANTIES OF
10  * PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF
11  * DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH
12  * RESPECT TO THE USE OF THE SOFTWARE OR DOCUMENTATION. Under no circumstances
13  * shall University be liable for incidental, special, indirect, direct or
14  * consequential damages or loss of profits, interruption of business, or
15  * related expenses which may arise from use of Software or Documentation,
16  * including but not limited to those resulting from defects in Software and/or
17  * Documentation, or loss or inaccuracy of data of any kind.
18  */
19 
20 #ifndef GALOIS_SUBSTRATE_COMPILERSPECIFIC_H
21 #define GALOIS_SUBSTRATE_COMPILERSPECIFIC_H
22 
23 #include "galois/config.h"
24 
25 namespace galois::substrate {
26 
27 inline static void asmPause() {
28 #if defined(__i386__) || defined(__amd64__)
29  // __builtin_ia32_pause();
30  asm volatile("pause");
31 #endif
32 }
33 
34 inline static void compilerBarrier() { asm volatile("" ::: "memory"); }
35 
36 // xeons have 64 byte cache lines, but will prefetch 2 at a time
37 constexpr int GALOIS_CACHE_LINE_SIZE = 128;
38 
39 #if defined(__INTEL_COMPILER)
40 #define GALOIS_ATTRIBUTE_NOINLINE __attribute__((noinline))
41 
42 #elif defined(__GNUC__)
43 #define GALOIS_ATTRIBUTE_NOINLINE __attribute__((noinline))
44 
45 #else
46 #define GALOIS_ATTRIBUTE_NOINLINE
47 #endif
48 
49 } // namespace galois::substrate
50 
51 #endif
constexpr int GALOIS_CACHE_LINE_SIZE
Definition: CompilerSpecific.h:37