BRE12
mic_common.h
1 /*
2  Copyright 2005-2016 Intel Corporation. All Rights Reserved.
3 
4  This file is part of Threading Building Blocks. Threading Building Blocks is free software;
5  you can redistribute it and/or modify it under the terms of the GNU General Public License
6  version 2 as published by the Free Software Foundation. Threading Building Blocks is
7  distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
8  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9  See the GNU General Public License for more details. You should have received a copy of
10  the GNU General Public License along with Threading Building Blocks; if not, write to the
11  Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
12 
13  As a special exception, you may use this file as part of a free software library without
14  restriction. Specifically, if other files instantiate templates or use macros or inline
15  functions from this file, or you compile this file and link it with other files to produce
16  an executable, this file does not by itself cause the resulting executable to be covered
17  by the GNU General Public License. This exception does not however invalidate any other
18  reasons why the executable file might be covered by the GNU General Public License.
19 */
20 
21 #ifndef __TBB_mic_common_H
22 #define __TBB_mic_common_H
23 
24 #ifndef __TBB_machine_H
25 #error Do not #include this internal file directly; use public TBB headers instead.
26 #endif
27 
28 #if ! __TBB_DEFINE_MIC
29  #error mic_common.h should be included only when building for Intel(R) Many Integrated Core Architecture
30 #endif
31 
32 #ifndef __TBB_PREFETCHING
33 #define __TBB_PREFETCHING 1
34 #endif
35 #if __TBB_PREFETCHING
36 #include <immintrin.h>
37 #define __TBB_cl_prefetch(p) _mm_prefetch((const char*)p, _MM_HINT_T1)
38 #define __TBB_cl_evict(p) _mm_clevict(p, _MM_HINT_T1)
39 #endif
40 
42 #define __TBB_full_memory_fence() __asm__ __volatile__("lock; addl $0,(%%rsp)":::"memory")
43 #define __TBB_Pause(x) _mm_delay_32(16*(x))
44 #define __TBB_STEALING_PAUSE 1500/16
45 #include <sched.h>
46 #define __TBB_Yield() sched_yield()
47 
49 #define __TBB_STEALING_ABORT_ON_CONTENTION 1
50 #define __TBB_YIELD2P 1
51 #define __TBB_HOARD_NONLOCAL_TASKS 1
52 
53 #if ! ( __FreeBSD__ || __linux__ )
54  #error Intel(R) Many Integrated Core Compiler does not define __FreeBSD__ or __linux__ anymore. Check for the __TBB_XXX_BROKEN defined under __FreeBSD__ or __linux__.
55 #endif /* ! ( __FreeBSD__ || __linux__ ) */
56 
57 #endif /* __TBB_mic_common_H */