1 /* 2 Copyright (c) 2005-2020 Intel Corporation 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 #ifndef __TBB_mic_common_H 18 #define __TBB_mic_common_H 19 20 #ifndef __TBB_machine_H 21 #error Do not #include this internal file directly; use public TBB headers instead. 22 #endif 23 24 #if ! __TBB_DEFINE_MIC 25 #error mic_common.h should be included only when building for Intel(R) Many Integrated Core Architecture 26 #endif 27 28 #ifndef __TBB_PREFETCHING 29 #define __TBB_PREFETCHING 1 30 #endif 31 #if __TBB_PREFETCHING 32 #include <immintrin.h> 33 #define __TBB_cl_prefetch(p) _mm_prefetch((const char*)p, _MM_HINT_T1) 34 #define __TBB_cl_evict(p) _mm_clevict(p, _MM_HINT_T1) 35 #endif 36 37 /** Intel(R) Many Integrated Core Architecture does not support mfence and pause instructions **/ 38 #define __TBB_full_memory_fence() __asm__ __volatile__("lock; addl $0,(%%rsp)":::"memory") 39 #define __TBB_Pause(x) _mm_delay_32(16*(x)) 40 #define __TBB_STEALING_PAUSE 1500/16 41 #include <sched.h> 42 #define __TBB_Yield() sched_yield() 43 44 /** Specifics **/ 45 #define __TBB_STEALING_ABORT_ON_CONTENTION 1 46 #define __TBB_YIELD2P 1 47 #define __TBB_HOARD_NONLOCAL_TASKS 1 48 49 #if ! ( (__FreeBSD__||__DragonFly__) || __linux__ ) 50 #error Intel(R) Many Integrated Core Compiler does not define (__FreeBSD__||__DragonFly__) or __linux__ anymore. Check for the __TBB_XXX_BROKEN defined under (__FreeBSD__||__DragonFly__) or __linux__. 51 #endif /* ! ( (__FreeBSD__||__DragonFly__) || __linux__ ) */ 52 53 #endif /* __TBB_mic_common_H */ 54